Add "room" awareness to each device

Posted on
Fri Jul 06, 2018 3:48 pm
FlyingDiver offline
User avatar
Posts: 7217
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Add "room" awareness to each device

You need to do two things. At plugin startup:

Code: Select all
    def startup(self):
        indigo.devices.subscribeToChanges()


And then implement the routine to monitor changes:

Code: Select all
    def deviceUpdated(self, oldDevice, newDevice):
        indigo.PluginBase.deviceUpdated(self, oldDevice, newDevice)

    # do something here



joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jul 06, 2018 4:15 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Add "room" awareness to each device

FlyingDiver wrote:
Code: Select all
 def deviceUpdated(self, oldDevice, newDevice):
    indigo.PluginBase.deviceUpdated(self, oldDevice, newDevice)
    # do something here


I'm not positive that it makes a difference, but you should probably use the super method to call the plugin's parent class's method:

Code: Select all
def deviceUpdated(self, oldDevice, newDevice):
    super(Plugin, self).deviceUpdated(oldDevice, newDevice)
    # do something here


If for no other reason, we might change the base class (or add another one) in the future so to migrate all you'd need to do is change it in the Plugin class definition.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 06, 2018 6:33 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Add "room" awareness to each device

Good to know. Bookmarked.


Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 6 guests