Piston not fireing on status change for devices


#1

1) Give a description of the problem
I created a simple piston to monitor the status of devices if they are offline. The issue is that it’s not firing off when testing it. The devices I defined are Sengled ZigBee bulbs.

2) What is the expected behavior?
When SmartThinigs detects the bulb is offline to run the piston

3) What is happening/not happening?

Not seeing the offline event in the piston log but the SmartThings event list for the device shows the event for the device going offline. After the piston is saved you can see in the logs that it subscribed to the devices status but at 10:01 when SmartThinigs showed one of the bulbs went offline there was no activity in the piston.

**4) Post a Green Snapshot of the piston

**5) Attach any logs


#2

I just rearranged your piston…only change I made was to add the Debug in line 28 to see what the data coming actually looks like.

Edit: Oops, I lied, I added the expression count(Devices_not_responding) is greater than 0 to check if there are any devices saved in the variable.

Edit2: I see a flaw in my arrangement, the All devices are ONLINE part needs to be addressed.


#3

One more try…


#4

you should get rid of the last ‘if {count(devices_responding)} is equal to 0’
and put that set piston (all devices online) into an else statement for the above ‘if {count(devices_not_responding)} is greater than 0’


#5

Hah, which is the same as my first setup… over thinking stuff.


#6

Thanks for the replies. This issue isn’t the structure of the piston, It’s that the event of offline isn’t triggering. I changed the piston to match your edits just to settle that part of the discussion.

After making the changes. Saving the piston, doing a test run and then disconnecting the lamp, the next ping from SmartThings put the device in offline state and no event was observed in the piston from webcore. I then ran another test run just to capture the log in the piston so there is no question that the event never was see. Here is the logs from the piston:

And here is the events from the device in SmartThings:

At 1:25 PM I saved and tested the piston
At 1:38 PM SmartThings said the device was offline
At 1:47 PM I tested the piston

Between 1:25 PM and 1:47 pm there should have been event triggered

Would we say this is a bug? Something else?


#7

Values are case sensitive, the pic says offline, not OFFLINE. I’m ona small screen so I may not be seeing everything.


#8

Understood but it should be receiving events. I have since coded it as “changes” and a single device in the condition so I can capture any status changes and still no events are coming in. There is something not right here.


#9

Try a simple one… don’t hit Test, wait for the event by however means you do it.

if Bulb’s $status changes
then
Log to console Status changed to {$currentEventValue}
end if


#10

I let both a offline and online event be triggered and the piston never fired even with the very simple piston:

There is something not working for events in web core for these types of devices. Even though SmartThings sees the events webcore isn’t.

If I poll manually say using a condition vs. trigger I do get all the status back from the device.


#11

You just reminded me to look at one of my pistons. I don’t think I was able to trigger off of that attribute which is why I have a piston that polls every 5 minutes for the status of a presence sensor.


#12

yes I was poling every day but then I had a few bulbs offline and figured I could capture that offline with an event.