[ANSWERED]: Previous states of a device

Posted on
Mon May 11, 2015 4:32 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

[ANSWERED]: Previous states of a device

Hi, are the previous states of a device available to a trigger? I am thinking in database terms here where you can have your "before" row and compare it to the "new" row to decide what to do. This will be handy when firing trigger since I can put something conditions around it. If not I am guessing one way to achieve this could be to fire an action on the trigger (the last one) to store the "current" value of the device state into a variable. That way the next time the trigger fires I can have the previous value available.

Posted on
Thu May 14, 2015 5:03 pm
matt (support) offline
Site Admin
User avatar
Posts: 21421
Joined: Jan 27, 2003
Location: Texas

Re: Previous states of a device

Not via a Trigger, but if you create a plugin you can do it by calling indigo.devices.subscribeToChanges() then defining the method:

Code: Select all
def deviceUpdated(self, origDev, newDev):

which will get called whenever a device changes both with the before and after device instances.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest