Ludy87 / xplora_watch

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

State request update gives error and integration not starts at reload 🐛 #169

Closed smarthomefamilyverrips closed 1 year ago

smarthomefamilyverrips commented 1 year ago

What version of Integration has the issue?

2.7.2

I get the following errors in my logs:

Logger: homeassistant.components.automation.update_state_watch_kids Source: custom_components/xplora_watch/coordinator.py:196 Integration: Automation (documentation, issues) First occurred: 17:15:05 (2 occurrences) Last logged: 17:15:05

Update State Watch Kids: Error executing script. Unexpected error for call_service at pos 1: While executing automation automation.update_state_watch_kids Traceback (most recent call last): 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 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xplora_watch/services.py", line 67, in async_see await see_service.async_see(kwargs[ATTR_SERVICE_TARGET] if ATTR_SERVICE_TARGET in kwargs else ["all"]) File "/config/custom_components/xplora_watch/services.py", line 120, in async_see await self._coordinator._async_update_data(targets) File "/config/custom_components/xplora_watch/coordinator.py", line 127, in _async_update_data self.watch_entry.update(await self.data_loop(wuids, message_limit, remove_message)) File "/config/custom_components/xplora_watch/coordinator.py", line 156, in data_loop await self.get_map() File "/config/custom_components/xplora_watch/coordinator.py", line 196, in get_map async with session.get(URL_OPENSTREETMAP.format(self.lat, self.lng, language)) as response: File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 893, in start with self._timer: File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 721, in exit raise asyncio.TimeoutError from None asyncio.exceptions.TimeoutError

AND

This error originated from a custom integration.

Logger: custom_components.xplora_watch.coordinator Source: helpers/update_coordinator.py:182 Integration: Xplora® Watch (documentation, issues) First occurred: 17:15:12 (1 occurrences) Last logged: 17:15:12

Error requesting xplora_watch-5115 data: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en')

AND

This error originated from a custom integration.

Logger: homeassistant.helpers.script.websocket_api_script Source: custom_components/xplora_watch/coordinator.py:197 Integration: Xplora® Watch (documentation, issues) First occurred: 17:20:16 (1 occurrences) Last logged: 17:20:16

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en') Traceback (most recent call last): 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 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xplora_watch/services.py", line 67, in async_see await see_service.async_see(kwargs[ATTR_SERVICE_TARGET] if ATTR_SERVICE_TARGET in kwargs else ["all"]) File "/config/custom_components/xplora_watch/services.py", line 120, in async_see await self._coordinator._async_update_data(targets) File "/config/custom_components/xplora_watch/coordinator.py", line 127, in _async_update_data self.watch_entry.update(await self.data_loop(wuids, message_limit, remove_message)) File "/config/custom_components/xplora_watch/coordinator.py", line 156, in data_loop await self.get_map() File "/config/custom_components/xplora_watch/coordinator.py", line 197, in get_map res: dict[str, Any] = await response.json() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en')

System Health details

System Information

version core-2023.2.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.7
os_name Linux
os_version 5.15.90
arch aarch64
timezone Europe/Bucharest
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4986 Installed Version | 1.30.1 Stage | running Available Repositories | 1204 Downloaded Repositories | 20
AccuWeather can_reach_server | ok -- | -- remaining_requests | 11
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | March 15, 2023 at 02:00 relayer_connected | true remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-4.ui.nabu.casa can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 9.5 -- | -- update_channel | stable supervisor_version | supervisor-2023.01.1 agent_version | 1.4.1 docker_version | 20.10.22 disk_total | 113.9 GB disk_used | 28.9 GB healthy | true supported | true board | odroid-n2 supervisor_api | ok version_api | ok installed_addons | Spotify Connect (0.12.2), Home Assistant Google Drive Backup (0.110.1), File editor (5.5.0), SSH & Web Terminal (13.0.2), Samba share (10.0.0), MariaDB (2.5.2), ESPHome (2023.2.2), Assistant Relay (0.7.4), Mosquitto broker (6.1.3), Zigbee2MQTT (1.30.1-1)
Dashboards dashboards | 1 -- | -- resources | 12 views | 11 mode | storage
Recorder oldest_recorder_run | February 7, 2023 at 17:18 -- | -- current_recorder_run | February 17, 2023 at 15:48 estimated_db_size | 1673.34 MiB database_engine | mysql database_version | 10.6.10
Sonoff version | 3.4.0 (5406fa7) -- | -- cloud_online | 10 / 10 local_online | 10 / 10
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

I get the following errors in my logs:

Logger: homeassistant.components.automation.update_state_watch_kids Source: custom_components/xplora_watch/coordinator.py:196 Integration: Automation (documentation, issues) First occurred: 17:15:05 (2 occurrences) Last logged: 17:15:05

Update State Watch Kids: Error executing script. Unexpected error for call_service at pos 1: While executing automation automation.update_state_watch_kids Traceback (most recent call last): 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 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xplora_watch/services.py", line 67, in async_see await see_service.async_see(kwargs[ATTR_SERVICE_TARGET] if ATTR_SERVICE_TARGET in kwargs else ["all"]) File "/config/custom_components/xplora_watch/services.py", line 120, in async_see await self._coordinator._async_update_data(targets) File "/config/custom_components/xplora_watch/coordinator.py", line 127, in _async_update_data self.watch_entry.update(await self.data_loop(wuids, message_limit, remove_message)) File "/config/custom_components/xplora_watch/coordinator.py", line 156, in data_loop await self.get_map() File "/config/custom_components/xplora_watch/coordinator.py", line 196, in get_map async with session.get(URL_OPENSTREETMAP.format(self.lat, self.lng, language)) as response: File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request await resp.start(conn) File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 893, in start with self._timer: File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 721, in exit raise asyncio.TimeoutError from None asyncio.exceptions.TimeoutError

AND

This error originated from a custom integration.

Logger: custom_components.xplora_watch.coordinator Source: helpers/update_coordinator.py:182 Integration: Xplora® Watch (documentation, issues) First occurred: 17:15:12 (1 occurrences) Last logged: 17:15:12

Error requesting xplora_watch-5115 data: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en')

AND

This error originated from a custom integration.

Logger: homeassistant.helpers.script.websocket_api_script Source: custom_components/xplora_watch/coordinator.py:197 Integration: Xplora® Watch (documentation, issues) First occurred: 17:20:16 (1 occurrences) Last logged: 17:20:16

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en') Traceback (most recent call last): 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 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/xplora_watch/services.py", line 67, in async_see await see_service.async_see(kwargs[ATTR_SERVICE_TARGET] if ATTR_SERVICE_TARGET in kwargs else ["all"]) File "/config/custom_components/xplora_watch/services.py", line 120, in async_see await self._coordinator._async_update_data(targets) File "/config/custom_components/xplora_watch/coordinator.py", line 127, in _async_update_data self.watch_entry.update(await self.data_loop(wuids, message_limit, remove_message)) File "/config/custom_components/xplora_watch/coordinator.py", line 156, in data_loop await self.get_map() File "/config/custom_components/xplora_watch/coordinator.py", line 197, in get_map res: dict[str, Any] = await response.json() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://nominatim.openstreetmap.org/reverse?lat=46.49847355&lon=26.50547498&format=jsonv2&accept-language=en')

Reproduction steps

  1. request a state update with watch.see

Debug logs

No info
github-actions[bot] commented 1 year ago

:wave: @smarthomefamilyverrips, it is checked whether there is a bug. Please have some patience. This action was performed automatically.

smarthomefamilyverrips commented 1 year ago

@Ludy87 if i change configuration from openstreetmap to opencage (free trial) submit and reload integration then the integration starts up normal again

Ludy87 commented 1 year ago

Hi,

https://nominatim.openstreetmap.org/ the website is disrupted, I will probably integrate a mechanism that opencage will then be used.

smarthomefamilyverrips commented 1 year ago

@Ludy87 thanks for the quick response 👍 will leave it at opencage for the moment then

smarthomefamilyverrips commented 1 year ago

@Ludy87 seems is working again with openstreetmap 👍

Ludy87 commented 1 year ago

nice to hear, nevertheless I will post an update in the next few days to avoid the error. It's not the first time this has happened.

github-actions[bot] commented 1 year ago

:wave: @smarthomefamilyverrips, we found the bug, it will be fixed shortly. This action was performed automatically.

github-actions[bot] commented 1 year ago

:wave: @smarthomefamilyverrips, your proposal will be considered. Please have some patience. This action was performed automatically.

smarthomefamilyverrips commented 1 year ago

nice to hear, nevertheless I will post an update in the next few days to avoid the error. It's not the first time this has happened.

@Ludy87 sounds great, Thanks!!! 👍