MyQ Plugin development - how to stop polls?

  • Last Post 04 March 2017
nelis249 posted this 09 February 2017

I've developed a MyQ plugin so that I can control the garage door. I'm trying to figure out if there is an event handler or property if a device is removed? I need this to kill a polling thread for the specific device.

Currently a user adds the device

The plugin starts the polling thread

If the user removes the device, the thread is still going unless restarting the service.

Order By: Standard | Newest | Votes
rscott posted this 09 February 2017

There's not currently a "stop tracking" event. I'll try to sneak one in there for you.

By the way, is this something you expect to happen a lot with the MyQ or are you trying to be clean and thorough?

nelis249 posted this 15 February 2017

I'm just being thorough. Testing validation I noticed that when I added---removed---added a device, the first add started a poll thread and was still running after re-adding a device, then 2 threads running until service restarted. I started going down the road of implementing a thread pool in the IHaController along with another thread polling devices to check for removal but it's clunky. A remove event of some type would seem more efficient/appropriate.

Dignan17 posted this 25 February 2017

I would love this plugin! Very cool. Is it able to detect the state of the garage door? Can you send discrete commands like open and close, regardless of state, or is it a toggle?

nelis249 posted this 04 March 2017

Yea it gets door state, you can open and close regardless of state (not a toggle).

Not sure what my plan is yet. I'm first making it robust with my own usage.