adorobis / hacomfoairmqtt

Home Assistant integration for ComfoAir 350 device via serial communication and MQTT
MIT License
37 stars 16 forks source link

unit_of_measurement="�C", #56

Closed euDominic closed 1 year ago

euDominic commented 1 year ago

The new version of the phyton script can no longer be started.

Various errors occur from....

root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 934 state_topic="comfoair/outsidetemp", device_class="temperature", unit_of_measurement="�C", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# ^C root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 934 state_topic="comfoair/outsidetemp", device_class="temperature", unit_of_measurement="�C", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 934 state_topic="comfoair/outsidetemp", device_class="temperature", unit_of_measurement="�C", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 939 state_topic="comfoair/supplytemp", device_class="temperature", unit_of_measurement="�C", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 1045 state_topic="comfoair/ewttemp", device_class="temperature", unit_of_measurement="�C", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 1050 command_topic="comfoair/ewtlowtemp", unit_of_measurement="�C", icon="mdi:thermometer-low", ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb0 in position 0: invalid start byte root@ComfoAir:/opt/ca350/bin# python3 ca350.py File "/opt/ca350/bin/ca350.py", line 1050 command_topic="comfoair/ewtlowtemp", unit_of_measurement="�C", icon="mdi:thermometer-low",

The solution was...

to change unit_of_measurement="°C" to unit_of_measurement="°C".

adorobis commented 1 year ago

Strange, probably my workflow is broken somewhere as it works for me but before committing to github I copy paste from notepad to vs code... Will fix it as soon as possible

adorobis commented 1 year ago

It is even more strange, I've just taken the same file and it still works in my system. I have even now downloaded the file from github and it still works ok. How did you get the new version?

euDominic commented 1 year ago

I copied it from the RAW view and pasted it into my .py file.

src/ca350.py

adorobis commented 1 year ago

So this is the problem. You are loosing the utf-8 encoding when doing that. Rather download the file and store where needed. If you do copy/paste of the content make sure the file is in proper encoding - which editor are you using?

euDominic commented 1 year ago

Oh dear, yes, that makes sense. I used the winscp editor.

I think the "problem" can be closed.

as always, the error is in front of the monitor 😂.

adorobis commented 1 year ago

Cool, I've been there before...