This object is in archive! 
What would you recommend: Variable or virtual switch
Need Answer
Right now I use a variable as a day/night switch. It is set to "1" 30min after sunrise and back to "0" 30min before sunset. Sometimes, after a reboot, the variable is set back to 0 during the day and I use an other rule to set it back to 1 again manually.
Now my question: Wouldn´t it be better to use a virtual switch instead or are there any drawbacks with virtual switches? The advantage of a switch is that I can see the state and change it via the App in no time but are there any disadvantages compared to a variable?
No connection
Real-time notifications may not work
Hey,
I use virtual switches and mostly it works fine. Even after a reset.
Hey,
I use virtual switches and mostly it works fine. Even after a reset.
Variables will be reset if the box restarts. Switches keep their state...
Variables will be reset if the box restarts. Switches keep their state...
Hello,
I use the virtual meter, it has 16 values to use and does not reset after a reboot of the box.
Hello,
I use the virtual meter, it has 16 values to use and does not reset after a reboot of the box.
Hi,
For this same purpose I use a virtual sensor, which cannot be changed accidentally from the app and it stores it's value. The only variable I use is to detect a reboot or power off, whenever I see this value go to zero I run a rule that recalculates several virtual switches and sensors (including daylight) and then sets a value to this variable and won't run again until another reboot is performed.
Hi,
For this same purpose I use a virtual sensor, which cannot be changed accidentally from the app and it stores it's value. The only variable I use is to detect a reboot or power off, whenever I see this value go to zero I run a rule that recalculates several virtual switches and sensors (including daylight) and then sets a value to this variable and won't run again until another reboot is performed.
Thanks a lot, that convinces me to use a virtual switch or meter. And the idea of using a variable to detect a reboot is also a good idea.
@Alberto: What do you use to look after the variable for reboot? A scheduler? Could you please post that rule?
Best regards and again thanks to everyone
Thanks a lot, that convinces me to use a virtual switch or meter. And the idea of using a variable to detect a reboot is also a good idea.
@Alberto: What do you use to look after the variable for reboot? A scheduler? Could you please post that rule?
Best regards and again thanks to everyone
Klaus,
Sorry for my delayed answer. Yes, for me started very simple, using two rules as follows;
1. A scheduler that activates a virtual sensor, waits for a few seconds and then deactivates it.
2. Rule that is activated when this virtual sensor is active and if the variable (in my case SFS) is less than 1 then it runs and recalculates what I need.
After a few months my rule number 2 started to be very long so I decided to split it in two rules, and then with some issues that firmware upgrades caused to my zipabox I decided to make a 5 repetition reboot housekeeping.
1. Rule 1 same as above
2. Rule 2 runs when variable is less than 1 and minute flasher active, do some stuff and set value 1 to SFS.
3. Rule 3 runs when variable is from 2 to 5 and minute flasher active, do some stuff and increments value by 1.
Any question feel free to ask.
Klaus,
Sorry for my delayed answer. Yes, for me started very simple, using two rules as follows;
1. A scheduler that activates a virtual sensor, waits for a few seconds and then deactivates it.
2. Rule that is activated when this virtual sensor is active and if the variable (in my case SFS) is less than 1 then it runs and recalculates what I need.
After a few months my rule number 2 started to be very long so I decided to split it in two rules, and then with some issues that firmware upgrades caused to my zipabox I decided to make a 5 repetition reboot housekeeping.
1. Rule 1 same as above
2. Rule 2 runs when variable is less than 1 and minute flasher active, do some stuff and set value 1 to SFS.
3. Rule 3 runs when variable is from 2 to 5 and minute flasher active, do some stuff and increments value by 1.
Any question feel free to ask.
Thank you very much Alberto! I think my rule will be much shorter because I don´t have to reset so many values but your explanation was a very useful for me.
Klaus
Thank you very much Alberto! I think my rule will be much shorter because I don´t have to reset so many values but your explanation was a very useful for me.
Klaus
Replies have been locked on this page!