dominikamann / oekofen-pellematic-compact

A Ökofen Pellematic Compact Integration based on JSON/TCP-Inteface for Home Assistant.
Apache License 2.0
34 stars 7 forks source link

Encoding correction and http response correctly closing #18

Closed cnico closed 1 year ago

cnico commented 1 year ago

Hi, You did a great job with this integration of pellematic data. I use it now and it replaces all the yaml configuration using the REST integration. The correct encoding of the REST result for french specific characters is iso-8859-1 and not utf-8 so I corrected it. I also implemented a close on the request in order to free ressources. It resolves these types of error after a few hour of polling without homeassistant restart :

2023-03-16 23:36:22.656 ERROR (MainThread) [custom_components.oekofen_pellematic_compact] Error reading pellematic data Traceback (most recent call last): File "/usr/local/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/local/lib/python3.10/http/client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.10/http/client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.10/http/client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.10/http/client.py", line 1037, in _send_output self.send(msg) File "/usr/local/lib/python3.10/http/client.py", line 975, in send self.connect() File "/usr/local/lib/python3.10/http/client.py", line 941, in connect self.sock = self._create_connection( File "/usr/local/lib/python3.10/socket.py", line 845, in create_connection raise err File "/usr/local/lib/python3.10/socket.py", line 833, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Operation timed out

If you can merge it in your branch, it would be great.

For information, my pellemetic version is v4.00

dominikamann commented 1 year ago

Hi @cnico, thank you for the improvement 👍 Yes the encoding was incorrect. I will test it and create a new release 🚀 Dom