cozylife / hass_cozylife_local_pull

home asstiant plugin
81 stars 35 forks source link

add UDP retries and compatible with python3.9 #2

Closed yuqianma closed 2 years ago

yuqianma commented 2 years ago

Two commits:

python3.9's json.loads remove encoding argument. https://docs.python.org/3/library/json.html#json.loads According to python doc, json.loads assumes input is UTF-8, UTF-16 or UTF-32. So encoding is unnecessary even before 3.9.

UDP is not stable. In my case, there are always timeouts before first data arrived. I use a MSG_PEEK to ensure it's ready.

cozylife commented 2 years ago

OK