[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

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
1 Like

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…

sure. so have a global list of devices and a local list of corresponding temps then run through them in a for loop.

that will do it.

1 Like

Is there a way to write a row of 10 columns to a Google spreadsheet from a piston? Would love to see an example of how it is done.

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.

image

were-not-worthy-gif-11

1 Like

:slight_smile:

https://imgur.com/gallery/5kkm91F

Didn’t seem to work. Still have the same error.

@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.

sorry.

1 Like

@JDogg016 there doesnt seem to be an attribute specified here for the rain gauge. format should be [Rain Gauge : attribute] to write to fuel stream.

Below is a piston that creates piston tiles and clicking on the tiles will toggle the switch. This is for all the lightbulbs i have.

However, i have 2 other pistons to automate some bulbs that run a simple fade at a specific time. Here is one such piston:-

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.

1 Like

looking back again noticed this line. :slight_smile: 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:

1 Like

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.

you are welcome. there are a couple of conditions that may not hold true for the combination of any of your other pistons. :slight_smile:

they are:

  1. the 1st piston uses on event
  2. in the 1st piston on event subscribes to device Dimmer 1 switch along with other switches for all other devices that are in the variable deviceList
  3. the 2nd piston turns off device Dimmer 1 after the fade
  4. since 1st piston subscribes to device Dimmer 1 switch, this causes the 1st piston to get executed
  5. when the 1st piston is executed, the unconditional block of code in the piston that toggles all the lights toggles them

if i was not able to explain that clearly, please ask and i will try again :slight_smile:

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. :confused:

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 :slight_smile: 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.

you are using this if check to find which tile was clicked?

if yes, please put the last for loop under this if condition and lets see if all works as it should :slight_smile:

https://yyz2.discourse-cdn.com/smartthings/uploads/default/optimized/3X/a/d/ad4d78e4cfdfa1e24b6c1a84ffe189d6ea214798_1_690x93.png