Comm Enabled and device[Start|Stop]Comm ?

Posted on
Fri Nov 01, 2013 4:12 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Comm Enabled and device[Start|Stop]Comm ?

In my Plugin I have set-up two methods to handle deviceStartComm(self,dev) and deviceStopComm(self,dev). The problem I am having is that when I check or uncheck the tick box in the Comm Enabled column in the Home window device list, the methods aren't being called AFAIK.

I know the deviceStartComm(self,dev) method works because if I reload the Plugin, it gets executed for each device that has been created by my Plugin.

For deviceStopComm(self,dev) the help documentation says:
This is the complementary method to deviceStartComm() - it gets called when the device should no longer be active/enabled. For instance, when the user disables or deletes a device, this method gets called.


I can confirm that this method is called when the device is deleted but not when it is disabled (which I assume means Comm Disabled?).

Any pointers and suggestions appreciated :)

Posted on
Fri Nov 01, 2013 5:48 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Comm Enabled and device[Start|Stop]Comm ?

It is working in our tests here. I'm not sure what would cause it not to be called.

What other callback methods are you defining?

Image

Posted on
Fri Nov 01, 2013 7:04 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Comm Enabled and device[Start|Stop]Comm ?

matt (support) wrote:
It is working in our tests here. I'm not sure what would cause it not to be called.

What other callback methods are you defining?

These are the Plugin methods:
Code: Select all
def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs)
def __del__(self)
def validatePrefsConfigUi(self, valuesDict)
def runConcurrentThread(self)
def deviceUpdated(self, origDev, newDev)
def startup(self)
def validateDeviceConfigUi(self, valuesDict, typeId, devId)
def deviceStartComm(self, dev)
def deviceStopComm(self, dev)

There are other methods which I have setup to handle actions etc.

Posted on
Fri Nov 01, 2013 8:06 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Comm Enabled and device[Start|Stop]Comm ?

It is probably the deviceUpdated() override. It shouldn't be overridden. Try removing that method and see if it works.

Image

Posted on
Fri Nov 01, 2013 8:55 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Comm Enabled and device[Start|Stop]Comm ?

matt (support) wrote:
It is probably the deviceUpdated() override. It shouldn't be overridden. Try removing that method and see if it works.

Yes it works with the deviceUpdated() removed.

I am not quite clear from your reply as to whether it is an Indigo issue or I should be doing something else :?

I am using the deviceUpdated() to pick up the temperature changes on the Stella-Zs. :)

Posted on
Fri Nov 01, 2013 9:18 am
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Comm Enabled and device[Start|Stop]Comm ?

If you need to implement deviceUpdated (and your need to override is perfectly reasonable), then you need to call the parent implementation of deviceUpdated:

Code: Select all
indigo.PluginBase.deviceUpdated(self, origDev, newDev)


in your override. The base class implementation decides whether to restart comm to the device by calling deviceStopComm/deviceStartComm.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Nov 01, 2013 9:55 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Comm Enabled and device[Start|Stop]Comm ?

jay (support) wrote:
If you need to implement deviceUpdated (and your need to override is perfectly reasonable), then you need to call the parent implementation of deviceUpdated:

Code: Select all
indigo.PluginBase.deviceUpdated(self, origDev, newDev)


in your override. The base class implementation decides whether to restart comm to the device by calling deviceStopComm/deviceStartComm.


OK, I see - makes perfect sense :)

I have done the change and all is working now :D

Thanks guys for your help and patience with all these questions :)

Posted on
Fri Nov 01, 2013 11:31 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Comm Enabled and device[Start|Stop]Comm ?

Yes, sorry for my too short explanation (it was from an iPhone). Your case is an example of where you would indeed want to override it.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 17 guests