ciejer / metservice-weather

Metservice New Zealand component for Home Assistant
MIT License
17 stars 0 forks source link

Integration regularly becomes unavailable #46

Open Krispkiwi opened 9 months ago

Krispkiwi commented 9 months ago

System Health details

System Information

version core-2024.2.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.1.63-haos-raspi
arch aarch64
timezone Pacific/Auckland
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4921 Installed Version | 1.34.0 Stage | running Available Repositories | 1396 Downloaded Repositories | 16
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.5 -- | -- update_channel | stable supervisor_version | supervisor-2024.02.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 109.3 GB disk_used | 12.5 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (17.1.1), Studio Code Server (5.15.0), Samba share (12.3.0), Home Assistant Google Drive Backup (0.112.1), Mosquitto broker (6.4.0), RPC Shutdown (2.4), ESPHome (2024.2.0), Cloudflared (5.1.4), Zigbee2MQTT (1.35.3-1), ADB - Android Debug Bridge (0.7.0), MQTT Explorer (browser-1.0.3), Node-RED (17.0.7), Vaultwarden (Bitwarden) (0.21.1), Uptime Kuma (0.12.0)
Dashboards dashboards | 1 -- | -- resources | 2 views | 0 mode | storage
Recorder oldest_recorder_run | February 13, 2024 at 10:16 PM -- | -- current_recorder_run | February 24, 2024 at 8:35 AM estimated_db_size | 604.73 MiB database_engine | sqlite database_version | 3.44.2
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

It looks like every so often the integration needs to be refreshed as it loses its connection and goes into an unavailable state but reloading any sensor kicks the entire thing back into gear.

Reproduction steps

  1. Install the integration
  2. Wait for it disconnect
  3. Press reload

Debug logs

No response

Diagnostics dump

No response

ciejer commented 9 months ago

Hi @Krispkiwi - could you please add a bit more detail? What exactly goes into "unavailable" state? How are you "refreshing a sensor"?

My home instance is currently sitting at 9 days without dropping (since I reconfigured for the latest version) - any logs would be useful?

Thanks - Chris

Krispkiwi commented 9 months ago

Hi @Krispkiwi - could you please add a bit more detail? What exactly goes into "unavailable" state? How are you "refreshing a sensor"?

My home instance is currently sitting at 9 days without dropping (since I reconfigured for the latest version) - any logs would be useful?

Thanks - Chris

Hey mate, I've enabled debugging on the integration, not sure where to grab the logs from though.

Basically all the sensors in the integration that I have enabled fall into an unavailable state and i get the "This entity is no longer being provided by the metservice_weather integration. If the entity is no longer in use, delete it in settings" message however if I go into the integration and press reload, all sensors I am using from the integration come back online. I probably could automate this to refresh every time they go unavailable but figured its best to report it to you.

kotuku73 commented 9 months ago

Tēnā kōrua, I've had the same experience as @Krispkiwi.

Here's a likely looking snippet from my logs this morning

2024-02-25 20:19:29.581 ERROR (MainThread) [custom_components.metservice_weather.coordinator] Error fetching MetService data: TimeoutError()
2024-02-25 20:19:35.408 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up metservice_weather platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/metservice_weather/sensor.py", line 59, in async_setup_entry
    WeatherSensor(coordinator, description)
  File "/config/custom_components/metservice_weather/sensor.py", line 98, in __init__
    self._sensor_data = _get_sensor_data_public(
                        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/metservice_weather/sensor.py", line 210, in _get_sensor_data_public
    result = get_from_dict(sensors[RESULTS_CURRENT], keys)
                           ~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
Krispkiwi commented 8 months ago

Tēnā kōrua, I've had the same experience as @Krispkiwi.

Here's a likely looking snippet from my logs this morning

2024-02-25 20:19:29.581 ERROR (MainThread) [custom_components.metservice_weather.coordinator] Error fetching MetService data: TimeoutError()
2024-02-25 20:19:35.408 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up metservice_weather platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/metservice_weather/sensor.py", line 59, in async_setup_entry
    WeatherSensor(coordinator, description)
  File "/config/custom_components/metservice_weather/sensor.py", line 98, in __init__
    self._sensor_data = _get_sensor_data_public(
                        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/metservice_weather/sensor.py", line 210, in _get_sensor_data_public
    result = get_from_dict(sensors[RESULTS_CURRENT], keys)
                           ~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

I can confirm that setting up the entities to reload when they become unavailable seems to solve it from a practical standpoint with a quick automation, it's a workaround for now.

ciejer commented 2 weeks ago

This should hopefully be fixed now with 0.7.0 - please confirm if any issues are still occurring.

Perchycs commented 1 week ago

After I updated to 0.7.0 the weather warnings sensor is now unavailable, not sure if it is to do with this?