Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
369 stars 26 forks source link

After v1.3.1 update, sensors are not updating. #142

Closed mermelmadness closed 1 year ago

mermelmadness commented 1 year ago

I updated to v1.3.1, which I know is a pre-release, but wanted to let you know that none of the sensors that are selectable from the Configure section are updating and have been static for the past 15 hours or so.

image image image

My config for the sensors: image image

and my entry in sensors.yaml:

  - platform: pirateweather
    api_key: <API KEY>
    scan_interval: '00:02:15'

Should I try a new API key?

alexander0042 commented 1 year ago

Good catch! I'm seeing this as well on my end, so let me investigate

alexander0042 commented 1 year ago

Follow-up question- did you add a "time" sensor, and is it updating?

mermelmadness commented 1 year ago

I did, but it is in a weird numerical format and also not updating.

image

mermelmadness commented 1 year ago

If the Time sensor messed stuff up you can remove it. I'll figure out an alternative.

alexander0042 commented 1 year ago

Nope, not the time sensor. I'm thinking it might have something to do with re-configuring the sensors, but not sure yet

mermelmadness commented 1 year ago

Random thought. Now that all these are individual sensors instead of attributes of a single sensor, did I exceed my 10,000 API calls per month? Is each sensor making its own call now?

alexander0042 commented 1 year ago

Good thought, but luckily that's not it! The data update coordinator handles all the fetching, so no matter how many sensor or weather entities you have for a given location, it's all done in a single call. I've isolated this down to making a change using the configure button- updates stop working whenever it's configured. The key question is if this is a new issue, or something that has always been happening before 1.3

cloneofghosts commented 1 year ago

From my limited testing this issue seems to happen if you have the time sensor selected in your list of sensors. I was having the same issue and it seems that removing the sensor (and restarting HA) seems to have solved the issue for me. I'm going to observe it for a bit longer to say conclusively if that is the issue or not.

Have you tried removing the time sensor to see if that solves your issue?

alexander0042 commented 1 year ago

Oh interesting, I didn't try restarting. Definitely let me know if that works- first with the time sensor, then without

mermelmadness commented 1 year ago

So I had already disabled the time sensor and restarted, which worked. Now all temps are updating.

image

Will try re-adding the Time sensor and restart again.

mermelmadness commented 1 year ago

Enabling Time without restarting freezes the sensors.

Enabling Time with restarting leaves the sensors frozen.

mermelmadness commented 1 year ago

Hmm, now nothing is updating, not even the weather entity.

image

alexander0042 commented 1 year ago

Ok, I think I've got a solution here! For some reason it's not linking with the existing weather coordinator when options are changed. In the current version I had a check to see if there was an existing coordinator, but that was only there in case someone wanted both a daily and hourly forecast in their dashboard. Now that both of those are handled in one place, that's no longer required! Long story short, 1.3.2 is incoming shortly

mermelmadness commented 1 year ago

I see. Ok, will look out it and test.

mermelmadness commented 1 year ago

1.3.2 installed and HA restarted. I have my scan interval set to 2min 15sec and it doesn't seem to be updating at that interval.

image

alexander0042 commented 1 year ago

Do you mind going to setting -> logs -> load full logs? The coordinator logs an info log every time it checks for an update, so it should show up there if it's updating

mermelmadness commented 1 year ago

This is the only log entry I can find for PirateWeather:

2023-11-15 11:29:06.329 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration pirateweather which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-15 11:29:18.023 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.pirateweather
2023-11-15 11:29:18.024 WARNING (MainThread) [custom_components.pirateweather.sensor] Configuration of Pirate Weather sensor in YAML is deprecated Your existing configuration has been imported into the UI automatically and can be safely removed from your configuration.yaml file
2023-11-15 11:29:18.103 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'conversation', 'device_automation', 'switch', 'system_health', 'hacs', 'generic', 'assist_pipeline', 'hardware', 'timer', 'light', 'blueprint', 'utility_meter', 'default_config', 'lovelace', 'bluetooth_adapters', 'ffmpeg', 'zone', 'input_datetime', 'group', 'openrgb', 'roku', 'tplink', 'map', 'shell_command', 'moon', 'teamtracker', 'scrape', 'ipp', 'tts', 'config', 'mobile_app', 'image_upload', 'waze_travel_time', 'enphase_envoy', 'media_source', 'input_number', 'weatherdotcom', 'template', 'rest_command', 'roomba', 'thread', 'esphome', 'brother', 'automation', 'input_select', 'flume', 'hue', 'wled', 'person', 'search', 'schedule', 'octoprint', 'honeywell', 'onboarding', 'pirateweather', 'input_boolean', 'mqtt', 'stt', 'scene', 'counter', 'diagnostics', 'tag', 'cast', 'trace', 'tasmota', 'history', 'sensor', 'my', 'stream', 'application_credentials', 'mass', 'google_sheets', 'logbook', 'spotify', 'persistent_notification', 'analytics', 'script', 'notify', 'wemo', 'jokes', 'repairs', 'input_text', 'energy', 'homeassistant_alerts', 'auth', 'input_button', 'camera', 'upnp', 'wake_word', 'sun', 'ibeacon', 'zwave_js', 'file_upload', 'smartthinq_sensors'}
2023-11-15 11:29:18.217 INFO (MainThread) [homeassistant.setup] Setting up pirateweather
2023-11-15 11:29:18.217 INFO (MainThread) [homeassistant.setup] Setup of domain pirateweather took 0.0 seconds
2023-11-15 11:29:22.048 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597
2023-11-15 11:29:22.070 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.2474,-73.2289
2023-11-15 11:29:23.720 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.pirateweather
2023-11-15 11:29:26.132 INFO (MainThread) [homeassistant.components.weather] Setting up weather.pirateweather
2023-11-15 11:31:40.319 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597
2023-11-15 11:33:56.145 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597
2023-11-15 11:36:12.129 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597
2023-11-15 11:38:28.041 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597
2023-11-15 11:40:44.017 INFO (MainThread) [custom_components.pirateweather.weather_update_coordinator] Pirate Weather data update for 41.247420285933096,-73.22891145944597

image

alexander0042 commented 1 year ago

That's great! Check out those bottom lines, that's the update coordinator checking for updates every 2 seconds, which is looking promising. Also worth adding a the time sensor back in, since that should update every go

mermelmadness commented 1 year ago

Time sensor is back in, but is still displaying that odd 10-digit string. The other sensors are still not showing as updated recently.

mermelmadness commented 1 year ago

Unless I'm being too impatient. I can let it run for a few hours and report back.

alexander0042 commented 1 year ago

Yea, the 10-digit string is the UNIT time for the forecast. I'm not sure if HA has a better way of displaying it (maybe ISO), but it should change with every update: image

mermelmadness commented 1 year ago

Mine isn't updating like that image

alexander0042 commented 1 year ago

Can you try selecting "reload" from the three dot menu on the integration page? I'm thinking that might kick it into gear

mermelmadness commented 1 year ago

Ok, that did it. And now that I know it's Unix time I wrote this template to convert it to human-readable MM/DD.

      forecast_date_2d:
        friendly_name: "Forecast Date 2d"
        value_template: "{{ states('sensor.pirateweather_time_2d') | int | timestamp_custom('%m/%d') }}"
mermelmadness commented 1 year ago

Ok, everything seems to be working as expected now. Thank you for your prompt responses and for maintaining this integration.