Cloud DB can be use in saving the state of button?

Hi

im new in MIT APP and i have created 1 app to try and i use tinydb in my light switch automation i manage to save the state of button if it is on or off so even i closed and open again the apps it will show the button what is the last state before i close the app

now my problem is if my phone already swith on and i closed the apps and when my wife open his app the state not showing what was my last state in button made

can i use cloud db to update the state in multiple phones that install my controller?

Yes you can. To identify different devices, use an IP Address:

1 Like

hi thanks for the quick reply

i was thinking its like 1 database online in one apps so even 5 phone install this app in every state made by any phone who install this on it will update the state in online database then if some one open the apps it will automatic update the last state made by any one who have this app

so i think ip tracker is more like identifing of user if im not wrong

the theory is like in tinyDB but this one it should be online database so every one using this app they will get update state of button every time 1 phone has made change in button on or off

IP tracker identifies the device. If you want to identify the user, you can set up an account system.

1 Like

Hi

any one have idea how to use Cloud DB on my blocks i use tinyDB, i would like to store the state in online DB like CloudDB

These might help :

https://www.youtube.com/watch?v=0FJi64GyebI

Basic Understanding of CloudDB (and using Lists to store and manipulate data)

FAQ Section: CloudDB

CloudDB Chat App

3 Likes

Do you get a response from your server (Web1.Get) when you send a command ? e.g. (state on) or (state off)

1 Like

yes every thing is okey and working my problem is i can't get the right coding to work in cloud DB so every one using this app will update also the state on there phone even they are using at the same time or any time they open the apps

Try like this (not tested)

4 Likes

Hello Offspeed. There is a potential gotcha in your plan because you really need your own Web Server hosting your own CloudDB. The default DB hosted by MIT is for everyone to experiment with, primarily for the education sector. So data can potentially have a short life, which is OK for the purpose the DB has been provided for, but for your App to be reliable you need data reliability.

Since the data you store-retrieve is tiny, I don't think paying for your own Web Server Host is feasible, unless you happen to already have one. I think another, free solution could be to use Google Sheets instead. TimAI2 is the expert on those. Another alternative would be to use your Google Drive (TimAI2 again!):

2 Likes

Hi TIMAI2
Thank you for giving me some hint code and i manage to apply it on what im currently doing and i found out why its not working thank you very much :blush:

Hi ChrisWard
Thank you for giving me idea and heads up i think that's the reason i encounter error when the phone lock and i open again to change the state error in database is not responding for some times but when i give them some min all is perfect as i want :blush:

thank you all

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.