Device Offline Piston Help


#1

1) Give a description of the problem
piston isn’t running when a device status goes offline
2) What is the expected behaviour?
piston to run

3) What is happening/not happening?
as above

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE

)

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

I don’t think it works that way. A device going offline does not produce an event, because it is offline.

All the apps I have seen for this type of thing poll all the devices periodically. So I think that is what you will need to do.


#3

I agree with @Terminal. Also be careful with case-sensitivity. I believe status is usually all upper case OFFLINE/ONLINE.

I use a every 30 minute block to check status and battery levels.


#4

$status is a fake attribute. You can test what it is in a condition and you’ll get the result of device.getStatus() which is ACTIVE, INACTIVE, ONLINE, OFFLINE or HUB_DISCONNECTED (so it is what you see displayed for devices in the IDE). However a side effect of treating it as an attribute is that webCoRE will happily let you use it in other places attributes work, like in triggers, which won’t do anything.


#5

Cheers guys for your help, makes sense


#6

I am trying to write a piston to periodically (say every hour) poll all my devices to see whether they are up/online.

How do I poll a device in WebCore ? Is there a command for this ?

Walter