I am using the app to control an Arduino that controls relays to do various tasks. The app, after picking the proper bluetooth signal, remembers it for later use, and on exit, completely closes the app and disconnects from bluetooth. The disconnect was needed so that another device would be able to connect. The Arduino and relays stay in whatever state they are in until receiving instructions, via bluetooth, to do something else.
For the three buttons, that toggle on/off, there is a text box to indicate if the switch is on or off with text stored in a tinyDB.
The two buttons, that are simple toggle switches, work correctly with the correct label in the text box, in use and on app open.
First problem is if those switches are left "ON" the next time you open the app it shows ON which is correct. To get it to turn OFF you have to tap button twice. If left OFF when you open app one tap turns it on.
Second main problem, if the door is left locked when the app is started the text shows locked as soon is bluetooth shows connected the text changes to "unlocked" while the lock stays locked.
Also attaching aia file
ControlPanel_2_1_1.aia (2.2 MB)