Page 3 of 4

Re: New Python plugin for Logitech Harmony

Posted: Tuesday 18 December 2018 21:25
by gordonb3
The main issue with that of course being that .Net is not exactly platform independent. With respect to the Domoticz build environment there is as far as I can see no standard library that implements websockets, although there does appear to be something of a plugin header-only library for boost but I'm unsure whether that can be located some place other than within the main boost include dir.

Since Logitech mentioned they were looking into it I'd say it's probably best to wait and see what they come up with on short notice rather than us trying to implement the alternative API, which I gather needs to be sniffed as nobody appears to have any public documentation on it yet.

Re: New Python plugin for Logitech Harmony

Posted: Tuesday 18 December 2018 21:32
by EscApe
Some great progress over here:
https://github.com/chadcb/harmonyhub

I was able to get my hubId and perform a button press (mute on/off on my receiver). A successful PoC! :D kudos tot chadcb!

Re: New Python plugin for Logitech Harmony

Posted: Wednesday 19 December 2018 18:54
by EscApe
Oke, based on the info I found in the repos's mentioned before I have created a first (beta/test/poc) version of a python class for the harmony WebSockets api. It works :-D

https://github.com/d-EScape/HarmonyApi

@gordonb3, are you planning to modify the build in harmony connector? Maybe this info/example is helpful.
No use building a new python plugin if the real harmony integration will also be supporting the WebSockets api.

Re: New Python plugin for Logitech Harmony

Posted: Wednesday 19 December 2018 19:33
by Jezza
I have received this response to my complaint to Logitech about the update:
"Logitech recently released a firmware update for Harmony hub-based remotes that addressed some security vulnerabilities brought to our attention by a third-party cyber security firm. Logitech takes our customers’ security seriously, and we work diligently to fix these kinds of issues as they’re discovered.

Last week we began rolling out this update. We are aware that some customers using undocumented Harmony APIs for local home control were affected as a side-effect of our closing these vulnerabilities. These private local control APIs were never supported Harmony features. While it is unfortunate that customers using these unsupported features are affected by this fix, the overall security of our products and all of our customers is our priority.

We urge customers to update to this latest firmware, version 4.15.206. Please see this article for complete directions on checking and updating your current firmware version.

*Hub-based products include: Harmony Elite, Harmony Pro, Harmony Home Hub, Harmony Ultimate Hub, Harmony Hub, Harmony Home Control, Harmony Smart Control, Harmony Companion, Harmony Smart Keyboard, Harmony Ultimate, and Ultimate Home.

I hope to have informed you sufficiently."


On their Twitter feed they have stated that "We don't have plans to reenable this private API."

Deeply disappointed with this attitude from Logitech. I hope someone is able to come up with a work around.

Re: New Python plugin for Logitech Harmony

Posted: Wednesday 19 December 2018 20:17
by EscApe
Hi Jezza and others,

While I agree with you and also voiced my complaints I would like to ask you and others to not make this thread about Logitech policy. There are plenty of forum discussions on that topic. Let's focus on getting a solution.

In only two days several people have found ways to use another api on the bridge and with some elbow grease we could get things up and running again. I was able to create a stand-alone python class, but could not get the same principals to work in the Domoticz plugin system. i am certain that my knowledge about the plugin system is the limiting factor here! I do not have the time to figure it out, but if someone wants to fork and modify my original plugin then please go ahead!

Re: New Python plugin for Logitech Harmony

Posted: Wednesday 19 December 2018 22:33
by rimram31
Bad news from Logitech.

I'm following this closely last hours as I'm using this API (with ha bridge not dz) and it seems home assistant publish today a websocket implementation, python based, which make home assistant harmony work again with last firmware

https://www.home-assistant.io/blog/2018 ... local-api/ => Home Assistant fix 0.84.4
source code is here: https://github.com/home-assistant/pyhar ... /client.py (websockets branch)

Sure this may help to implement a websocket based version

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 15:58
by EscApe
I have been experimenting with what I now know about the WebSocket API and trying to get it to work as a Connection in the python plugin, but my efforts were unsuccessful. It looks like upgrading the connection to a WebSocket connection works, but sending commands seems to take some complicated encapsulation. My knowledge about the plugin framework and the websocket protocol is too limited, so I am not going to figure this out on my own.

If anyone can figure out the basics I might be able to fix this plugin. You could also fork my plugin and refactor it for WebSocket connections. At least you would have a ready to use framework for the Domoticz part of the plugin ;-)

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 16:17
by mvzut
EscApe wrote: Friday 21 December 2018 15:58 I have been experimenting with what I now know about the WebSocket API and trying to get it to work as a Connection in the python plugin, but my efforts were unsuccessful. It looks like upgrading the connection to a WebSocket connection works, but sending commands seems to take some complicated encapsulation. My knowledge about the plugin framework and the websocket protocol is too limited, so I am not going to figure this out on my own.

If anyone can figure out the basics I might be able to fix this plugin. You could also fork my plugin and refactor it for WebSocket connections. At least you would have a ready to use framework for the Domoticz part of the plugin ;-)
Hi EscApe,
Sorry if this is a stupid question, but I was under the impression that you were able to communicate with the Hub using Python, with the code you shared in an earlier post, and that you could already start activities etc.? Did I understand that correctly, and if so, why can't you simply load your class into a plugin and perform these same actions from there? Is there a difference between a plain Python program and running the same commands from a script? I might misunderstand things completely here. But the situation seems very similar to what I did recently: building a plugin around an existing Python API (in my case for the MAX Cube).

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 16:39
by EscApe
The class was an experiment to get to know the basics. The two main reasons not to use it in the plugin:
- It doesn't use the (asynchronous) Domoticz.Connection... and the plugin really should for all sorts of reasons
- It relies on the requests class, which has known issues in the plugin framework (like crashing Domoticz)

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 16:43
by mvzut
EscApe wrote:The class was an experiment to get to know the basics. The two main reasons not to use it in the plugin:
- It doesn't use the (asynchronous) Domoticz.Connection... and the plugin really should for all sorts of reasons
- It relies on the requests class, which has known issues in the plugin framework (like crashing Domoticz)
Hmmm ok, I see. That is indeed much more complex than simple http / JSON communication and goes beyond my current experience. I hope somebody is willing to help!

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 17:41
by poudenes
Maybe you can find some info here


http://forum.micasaverde.com/index.php/ ... #msg434166




Verzonden vanaf mijn iPhone met Tapatalk Pro

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 18:19
by EscApe
Oke... making some unexpected progress but still looking for assistance ...

The Websocket frames need to be properly constructed and extracted. http://lucumr.pocoo.org/2012/9/24/websockets-101/
I managed to construct a frame that actually triggers a request and results in a message from the hub. I was able to get the current state of the hub in my log.:D However it is a piece of frankencode I would be ashamed to share ;-)

Is there anyone who can write two elegant functions to endode and decode a websocks frame?
The encode function would get a utf-8 encoded Json string and return a properly framed Websocket frame (or even better: a list of (multiple) frames to accommodate longer messages).

I won't stop trying, but a more experienced programmer might get the framing (encoding/decoding) working much much quicker. Please let me know if you want to take on the challenge so I don't waste time and can focus on getting the rest working.

I see a feature request coming: support for WebSocket protocol in Domoticz.Connection.

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 20:12
by gordonb3
Just did a quick test with `websocketpp` for Domoticz' internal connector but this appears to strip the required parameters from the connect uri. :(

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 20:36
by ednl
Logitech is working on new firmware for January.

For now, there's the solution to revert back or the logitech development team solution:
https://community.logitech.com/s/questi ... rabilities
Follow the procedure, connect your hub back to your wifi and enable Harmony again in domoticz.

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 20:44
by jpvaneijk
Was informing about this same dev solution.
Seems Logitech is getting sensitive for all negative plublicty?

By the way, anyone familiar with NEEO Brain and is there any Domotizs support for this?

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 21:00
by EscApe
@gordonb3

Seems like the Domoticz.Connection (type="None") also strips some headers... Longer responses from the hub get broken up into separate messages, but the info to reconstruct them is missing. The websockets header should contain an opcode that indicates the message is part of a previously send message (or a last message), but the plugin only sees the returned payload.

Ah well .. I'm surprised I got this far ;-)

Logitech seems to have a 'development' firmware 4.15.210 that reintroduces the old api... It might still be better to get Websocket supported. As far as anything can be future-proof with Logitech. :?

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 21:19
by EscApe
To get the old api working again you no longer have to downgrade. Logitech has released a 'at your own risk' firmware 4.15.210.
I have installed it and it's al working again! :D

to install firmware 4.15.210 start the harmony desktop software, login and select your remote. Press Alt-F9 and you will get a menu with firmware update options. Scroll all the way down and you will find version 4.15.210. Follow instructions and it's a bingo :-D

Still think the WebSockets development should continue.

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 21:37
by LouiS22
EscApe wrote: Friday 21 December 2018 21:19 To get the old api working again you no longer have to downgrade. Logitech has released a 'at your own risk' firmware 4.15.210.
I have installed it and it's al working again! :D

to install firmware 4.15.210 start the harmony desktop software, login and select your remote. Press Alt-F9 and you will get a menu with firmware update options. Scroll all the way down and you will find version 4.15.210. Follow instructions and it's a bingo :-D

Still think the WebSockets development should continue.
Haha, Logitech quickly defeated...

Re: New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 23:11
by poudenes
I agree that the smart guys here still develop the plugin for using the socket way. I'm not that smart but always up for testing haha :)


Verzonden vanaf mijn iPhone met Tapatalk Pro

New Python plugin for Logitech Harmony

Posted: Friday 21 December 2018 23:32
by mvzut
I thought it would be a smart idea to block internet access for the hub after the update to 4.15.210, to avoid that it would be overwritten again without my consent. However, for some reason the hub doesn't seem to react anymore to commands once I shut it off from the internet. That's weird, isn't it? Since we only use the local API?!