eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
348 stars 59 forks source link

[BUG] MQTT not working with utf8 encoded payload (ex.: from fhem) #58

Closed popy2k14 closed 4 years ago

popy2k14 commented 4 years ago

Describe the bug mqtt publish from fhem is not working with the following command:

set myBroker publish /smarthome/sz/tv/cmd {"command":"volume_down"}

I have debugged it, and it seems the payload is utf8 encoded! So after changing line 338 from:

message = json.loads(msg.payload)

to:

message = json.loads(msg.payload.decode('utf-8'))

fixed the issue for me! I think that change makes no problem with no utf8 encoded strings, but that has to be tried. Sadly i dont have any other mqtt device to test.

Can you please test this on your side and add this fix?

To Reproduce see above

Expected behavior fhem mqtt publish should work with pylips

popy2k14 commented 4 years ago

Have created an PR see #59

eslavnov commented 4 years ago

Fixed by #59