MarFanNL / HeishamonMQTT

Simple plugin to manage Heishamon through MQTT
MIT License
1 stars 4 forks source link

with latest heishamon3.x errors in plugin #12

Open balans911 opened 2 years ago

balans911 commented 2 years ago

i love the plugin use it for almost a year now without problems a big thnx 4 that!, but i now have this error in domoticz. it started with the latest released Heishamon

https://github.com/IgorYbema/HeishaMon/tree/v3.0/binaries

2022-06-23 18:38:11.343 Error: heishamon: Call to function 'onMessage' failed, exception details: 2022-06-23 18:38:11.344 Error: heishamon: Traceback (most recent call last): 2022-06-23 18:38:11.344 Error: heishamon: File "/home/pi/domoticz/plugins/HeishamonMQTT/plugin.py", line 613, in onMessage 2022-06-23 18:38:11.344 Error: heishamon: _plugin.onMessage(Connection, Data) 2022-06-23 18:38:11.344 Error: heishamon: File "/home/pi/domoticz/plugins/HeishamonMQTT/plugin.py", line 293, in onMessage 2022-06-23 18:38:11.344 Error: heishamon: self.mqttClient.onMessage(Connection, Data) 2022-06-23 18:38:11.344 Error: heishamon: File "/home/pi/domoticz/plugins/HeishamonMQTT/mqtt.py", line 157, in onMessage 2022-06-23 18:38:11.344 Error: heishamon: payload = Data['Payload'].decode('utf8') if 'Payload' in Data else '' 2022-06-23 18:38:11.344 Error: heishamon: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 1: invalid continuation byte

when i drop back to a previous 2.2-x it disappears ,so just a hint for upcoming releases I and probably others would loved this fixed.

Thnx in advance

CrazyICT commented 1 year ago

I got the same issue since V3:

2022-09-26 13:43:38.117 Error: Heishamon MQTT: ----> Line 613 in '/home/pi/domoticz/plugins/HeishamonMQTT/plugin.py', function onMessage 2022-09-26 13:43:38.117 Error: Heishamon MQTT: ----> Line 293 in '/home/pi/domoticz/plugins/HeishamonMQTT/plugin.py', function onMessage 2022-09-26 13:43:38.117 Error: Heishamon MQTT: ----> Line 157 in '/home/pi/domoticz/plugins/HeishamonMQTT/mqtt.py', function onMessage 2022-09-26 13:43:40.384 Error: Heishamon MQTT: 'onMessage' failed 'UnicodeDecodeError':''utf-8' codec can't decode byte 0xc8 in position 1: invalid continuation byte'.

MikeyMan83 commented 1 year ago

Same here. No clue what's causing it. First error line is less than helpful.

MikeyMan83 commented 1 year ago

Fixed it.

In MQTT.py:

Line 156 and beyond:

        topic = Data['Topic'] if 'Topic' in Data else ''
#        payload =  Data['Payload'].decode('utf8') if 'Payload' in Data else ''
        payload =  Data['Payload'].decode('latin-1') if 'Payload' in Data else ''

Changed decoding from utf8 to latin-1.

balans911 commented 1 year ago

great find, this fixed it