Ludy87 / xplora_watch

Xplora® Watch Home Assistant Integration
MIT License
49 stars 6 forks source link

binary mode doesn't take an encoding argument #181

Closed Ludy87 closed 1 year ago

Ludy87 commented 1 year ago
          Thanks for the quick response.

I still get error message but it looks different now:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 640, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xplora_watch/services.py", line 80, in async_read_message await sensor_update_service.async_read_message(kwargs[ATTR_SERVICE_TARGET]) File "/config/custom_components/xplora_watch/services.py", line 183, in async_read_message await self._fetch_chat_image(watch, msg_id) File "/config/custom_components/xplora_watch/services.py", line 202, in _fetch_chat_image encoded_base64_string_to_file(self._hass, image.get("fetchChatImage"), msg_id, "jpeg", "image") File "/config/custom_components/xplora_watch/helper.py", line 53, in encoded_base64_string_to_file with open(f"{media_path}/{file_name}.{file_type}", "wb", encoding="utf8") as f: ValueError: binary mode doesn't take an encoding argument

_Originally posted by @bergfalk in https://github.com/Ludy87/xplora_watch/issues/179#issuecomment-1455048291_

bergfalk commented 1 year ago

After updating to v2.7.12 and restarting Home Assistant everything worked and I received all messages. Later I restarted Home Assistant and then the integration stopped working. No success in reinstalling it and restarting Home Assistant. After downgrading to v2.7.11 the integration worked again except the service read messages. I then updated to v2.7.12 again and restarted the Home Assistant and everything worked again until the next time Home Assistant was restarted. Then the integration stopped working again:

2023-03-05 .... INFO (MainThread) [homeassistant.setup] Setting up xplora_watch 2023-03-05 .... DEBUG (MainThread) [custom_components.xplora_watch] Set up the Xplora® Watch Version 2 component. 2023-03-05 .... INFO (MainThread) [homeassistant.setup] Setup of domain xplora_watch took 0.0 seconds 2023-03-05 .... DEBUG (MainThread) [custom_components.xplora_watch] Configure based on config entry. 2023-03-05 .... DEBUG (MainThread) [custom_components.xplora_watch.coordinator] pyxplora_api lib version: 2.5.29-1288 2023-03-05 .... DEBUG (MainThread) [custom_components.xplora_watch.coordinator] Fetch data from Xplora: ........ 2023-03-05 .... DEBUG (MainThread) [custom_components.xplora_watch.coordinator] Finished fetching xplora_watch-..... data in 6.713 seconds (success: False) 2023-03-05 .... WARNING (MainThread) [homeassistant.config_entries] Config entry 'Xplora®' for xplora_watch integration not ready yet; Retrying in background

Ludy87 commented 1 year ago

I see no error just a warning: Config entry 'Xplora®' for xplora_watch integration not ready yet; Retrying in background

bergfalk commented 1 year ago

I did not get any error messages just the warnings that the integration did not start. But now 2 hours later it apparently has started again. I don't now the reason for this. Maybe related to something else.

Thanks for the quick fixes!