There is a problem when the application restarts

What is the name of your app?

Describe your app:

Screenshots:

App Store/Download link:

AIA file (Optional)

Hello everyone everyone. I need your help with an application I’m trying to do.

I have made a lighting control application, when I enter the application and give the command to open, the lamp is on, the on button is activated, as seen in the block, I control over the link.

The problem is when I close the application and open it again, the lights that were on turn off.

after starting the app the first time, all lights are off?
there is redundancy in your blocks… you might want to do it like this to set the value in TinyDB only once and call the Web.Url only once in both cases (true or false)


and if the blocks in all these checkbox checked events are the same, you could use the advanced blocks to reduce even more… DRY - Don’t repeat yourself

How to work with the advanced features

A Multiple Choice Quiz: How to work with the advanced features

Taifun

2 Likes

Thank you for your reply.

Since it is “is checked” at the beginning of the block, every time I open the application, if the lamps are on, it turns off. I removed the extra commands. But still could not solve the problem.

See this event will trigger only if it is checked.

Tell us, do you want to run the same website even the switched is turned on & off?

please provide an updated screenshot of your relevant blocks
also please answer this question

Taifun

When I first open the application, it doesn’t do anything.
I turn on the lamp, when I close the application and open it again, the lamp turns off.

Yes i want to run the same website.

Try like this. But you need to click this block that time only it will work

you have to store the value always in TinyDB… after it has been switched on and off…
therefore the StoreValue block must be outside of the if else statement

when exactly do you want to call that URL, only after the lamp has been switched on?
if not, follow additionally @Still-learning’s advice

Taifun

1 Like

Unfortunately, in both cases, when I exit the application and re-enter, the link becomes active and sends a command.

Then you need to think to activate this command withe by clicking any button only. When you rewnter and still it is clicked mean surely it will activate