jpmens/mqtt-launcher

Blocking commands result in queued actions.

Opened this issue · 0 comments

Thank you for this - it's very good and useful!

I spotted a feature that when a command is running and there is a likelihood of a second mqtt message pattern being matched the first command blocks the next until complete. While this is OK for short running commands or scripts it can cause a problem with queued messages and unresponsive switches.

My situation is Smartthings, motion detected which triggers a camera capture (which then sleeps for 30 seconds) and then I tried to issue a virtual switch command but it was not-responsive. The log seemed to show the commands queue and then fire once the first command finishes - I am sure this is by design.

2021-04-24 18:49:33,382 smartthings/Driveway Motion/motion/state 0 active
2021-04-24 18:49:33,389 Running t=smartthings/Driveway Motion/motion/state: ['sudo', '/home/pi/ha/getimages']
2021-04-24 18:50:06,856 smartthings/Garage/switch/state 0 off
2021-04-24 18:50:06,860 Running t=smartthings/Garage/switch/state: ['/home/pi/ha/garage.py']

So the fix is for me to put the first command into the background but may be worth noting this in the example config so others don't trip over it.

Thanks a lot!
Ian