Tracking State


(Matty & Troy) #1

I’m trying to track state of devices. My use case at the moment is to monitor a switch (WeMo or Philips Hue).

I would like to know if there is any change to anything in between an event being triggered, and the device being restored.

For example, motion sensor triggers a lamp to turn on. The rule is for the lamp to be restored to the state that it was before the motion trigger event X minutes after there is no motion.

First of all - I need to be able to capture a switches complete state at any given moment, this doesn’t seem possible at the moment - it’s being discussed here - Getting Philips Hue Values

I have created the following subscriptions in an effort to track a possible change:

subscribe(targetDevice, "switch", stateChange)
subscribe(targetDevice, "level", stateChange)
subscribe(targetDevice, "hue", stateChange)
subscribe(targetDevice, "saturation ", stateChange)

The problem I am having is that it takes (on average) five minutes to detect any changes. Calling a .refresh on the device does not detect recent changes


Failed to fire events and tracking state