why not use device variables and store all the devices you want to check there?
global variable of type device devicesTemp
global variable of type device devicesMotion
if ANY of devicesTemp temperature is greater than 78
and
ANY of devicesMotion was active in the last 30 mins
turn on attic fan
else if ALL of devicesTemp temperature is less than 72
turn off attic fan
end if
Errr… how do I get a global variable that has more than one device in it? The documentation on the use of arrays and ‘device’ are a bit sparse. I’m sure I’m just getting something mixed up syntactically but not quite sure where…
actually - I misspoke, I’m trying to sort of treat variables as devices (thus the array). The reason being, different temp sensors have different thresholds, but should all have a ‘turn the fan on’ trigger point if that makes sense. So its not so much that I need the devices to directly trigger the fan as it is the aggregated “true” statement…
see this. @TempDevices is a global varaible of type device with multiple devices. also, if turnON is true i don’t actually do anything you could do anything you wanted - turn on attic fan or turn on ac zone etc etc.
@Jeff_Johnson note, you will need to move the setting variables to false block inside the every 15 minutes do block otherwise they will not get initialized before each for loop.
The problem i am facing is that when the piston with the fade action ends, all bulbs listed in the first example toggles by itself. I have checked on the ST app to see what was causing all the lights to toggle and it pointed to this piston.
Anybody with some help on why this is happening is much appreciated.
take look at for loop in line 42. that is outside of the on event. so when the second piston turns off the switch to one of the devices in the deviceList of the first piston, the first piston will be executed and all of the lights in deviceList will get toggled.
looking back again noticed this line. you should wrap that for loop at the bottom with an if condition that checks for tile click. on that if condition use virtual devices to find tile clicked.
currently virtual device tile doesnt allow for an easy way to check if ANY tile was clicked. if that is what you want just use the following if condition to wrap that for loop:
Thanks for pointing those 2 out. Will try it out when i get home. But it’s still pretty weird how the 2nd piston effects the first piston. I’ve many other pistons running and the only 2 pistons that effect it is when i put a “fade to” command.
Thanks so much for the explanation. And i get the explanation, but if that was the case, why when there is only a 'fade; command does this happen? I removed the fade command so that the dimmer would just turn off and everything works as expected. It’s not a big deal, i can think of several other ways to do it, but i just find it strange that it only happens when there is a fade. I have another piston using a fade command, and that as well, toggles all the lights.
you are welcome. it should not only happen on the fade but on the turn off as well. the below image is from the 1st piston. it subscribes to all of the devices in deviceList for any event that changes the switch, level and color for those devices.
if you dont mind trying, instead of removing the fade remove the turn off in the second piston and try please.
Tried as suggested and the result is still the same. After going through each individual bulb’s history, only 1 bulb did not toggle, all others toggled…which makes it even more confusing as it could not be the global variable i had for @AllLights
I’m going to try as well by removing the ‘on events’ to using ‘If’ and see if that works or not.
UPDATE:
Did the change and it was the same result…but this time a different bulb did not toggle and the 1 bulb that did not toggle earlier, toggled!! Looks like the toggling of bulbs are pretty random. Which makes things even more confusing.