New Python plugin for Logitech Harmony
Posted: Saturday 27 January 2018 21:58
Update 19/02/2018:
Improved (connection) error handling for the alternative version (using Domoticz connection framework)
http://www.domoticz.com/forum/viewtopic ... 86#p171786
Update 17/02/2018:
Alternative version available for testing. If loading urllib crashes your Domoticz you can give this one a try.
http://www.domoticz.com/forum/viewtopic ... 12#p171505
Update 31/01/2018: I think the plugin is now ready for everyday use. I have made it a little more robust. You can set the number of retries before a connection error is logged. The connection errors are quite common with the Harmony Hub. I love the Harmony hub but it tends te be unresponsive for a short while quite frequently.
The timeout for polling the hub can now be configured in the hardware screen. If you use a short interval (e.g. poll interval is 5 seconds) you should also use a short timeout (1 second) te prevent the plugin from blocking the event system. When polling every 5 seconds with a timeout of 3 seconds the plugin could theoretically take up (3/5) 60% of the event system, but only if there are (temporary) connection issues. This would be the case for any python plugin, since the plugin system runs in a single thread.
If you already installed the plugin make sure you set the new parameters on the configuration screen.
Surely there is more room for improvement, like cleaning up the code and constantly adhering to coding standards :-S. Those will stay on my to-do list a little longer because of other priorities. I would welcome any help from the community help on optimizing and enhancing the plugin.
Update 28/01/2018: Issue seems to be fixed. The plugin no longer breaks the hardware configuration page.
Description
The build-in Harmony hardware support in Domoticz frequently hangs my entire Domoticz system. I suspect it is overloading the event system when the Harmony hub becomes unresponsive at times. Since it doesn't seem to be maintained, I have created an alternative. This python plugin connects to the restful-harmony daemon by bwsystems
Restful-harmony does the heavy lifting. My plugin just interfaces with it.
Functionality is very similar to the build in Harmony support for Domoticz:
- a Domoticz device is created for every activity (on startup).
- the current activity is polled every x seconds and the corresponding device will show 'On'. Others will be 'Off'
- if you turn any of the devices 'On' in Domoticz the corresponding Activity is started on Harmony
Solved:So far so good.. this is where te trouble starts ..
If i have this and my other python plugin (iDetect) installed and enabled, the hardware configuration screen gets messed up. Both are shown with the same hardware-type (but they aren't) and configuration parameters are not displayed (initial configuration went fine). Is this a know issue?
I will incude a screenshot of the malformed configuration page and the plugin itself. It might just work on your setup(?)
Comments, tips, enhancements are much appreciated. If anyone wants to take on the challenge to turn this hobby project into a robust solution: feel free
Installation:
-Make sure you have python3.4 installed and not python3.5. Otherwise some imports may crash Domoticz (seems te be an issue with the plugin system)
-Make sure you have a functioning restful-harmony server running (https://github.com/bwssytems/restful-harmony)
-Unzip attached harmony.zip into a folder under ~/domoticz/plugins (keep the included icon-file zipped) and restart domoticz
-Add hardware 'Logitech Harmony restful connector'
Version 0.0.4 (31/01/2018):
Improved (connection) error handling for the alternative version (using Domoticz connection framework)
http://www.domoticz.com/forum/viewtopic ... 86#p171786
Update 17/02/2018:
Alternative version available for testing. If loading urllib crashes your Domoticz you can give this one a try.
http://www.domoticz.com/forum/viewtopic ... 12#p171505
Update 31/01/2018: I think the plugin is now ready for everyday use. I have made it a little more robust. You can set the number of retries before a connection error is logged. The connection errors are quite common with the Harmony Hub. I love the Harmony hub but it tends te be unresponsive for a short while quite frequently.
The timeout for polling the hub can now be configured in the hardware screen. If you use a short interval (e.g. poll interval is 5 seconds) you should also use a short timeout (1 second) te prevent the plugin from blocking the event system. When polling every 5 seconds with a timeout of 3 seconds the plugin could theoretically take up (3/5) 60% of the event system, but only if there are (temporary) connection issues. This would be the case for any python plugin, since the plugin system runs in a single thread.
If you already installed the plugin make sure you set the new parameters on the configuration screen.
Surely there is more room for improvement, like cleaning up the code and constantly adhering to coding standards :-S. Those will stay on my to-do list a little longer because of other priorities. I would welcome any help from the community help on optimizing and enhancing the plugin.
Update 28/01/2018: Issue seems to be fixed. The plugin no longer breaks the hardware configuration page.
Description
The build-in Harmony hardware support in Domoticz frequently hangs my entire Domoticz system. I suspect it is overloading the event system when the Harmony hub becomes unresponsive at times. Since it doesn't seem to be maintained, I have created an alternative. This python plugin connects to the restful-harmony daemon by bwsystems
Restful-harmony does the heavy lifting. My plugin just interfaces with it.
Functionality is very similar to the build in Harmony support for Domoticz:
- a Domoticz device is created for every activity (on startup).
- the current activity is polled every x seconds and the corresponding device will show 'On'. Others will be 'Off'
- if you turn any of the devices 'On' in Domoticz the corresponding Activity is started on Harmony
Solved:So far so good.. this is where te trouble starts ..
If i have this and my other python plugin (iDetect) installed and enabled, the hardware configuration screen gets messed up. Both are shown with the same hardware-type (but they aren't) and configuration parameters are not displayed (initial configuration went fine). Is this a know issue?
I will incude a screenshot of the malformed configuration page and the plugin itself. It might just work on your setup(?)
Comments, tips, enhancements are much appreciated. If anyone wants to take on the challenge to turn this hobby project into a robust solution: feel free

Installation:
-Make sure you have python3.4 installed and not python3.5. Otherwise some imports may crash Domoticz (seems te be an issue with the plugin system)
-Make sure you have a functioning restful-harmony server running (https://github.com/bwssytems/restful-harmony)
-Unzip attached harmony.zip into a folder under ~/domoticz/plugins (keep the included icon-file zipped) and restart domoticz
-Add hardware 'Logitech Harmony restful connector'
Version 0.0.4 (31/01/2018):