Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[environment canada] Weather update failed; no timestamp found #101533

Closed
shmick opened this issue Oct 6, 2023 · 15 comments · Fixed by #101798
Closed

[environment canada] Weather update failed; no timestamp found #101533

shmick opened this issue Oct 6, 2023 · 15 comments · Fixed by #101798

Comments

@shmick
Copy link
Contributor

shmick commented Oct 6, 2023

The problem

All Environment Canada sensors other than AQHI and the radar map are not updating

Wasn't sure if this started in 2023.10.0 so I reverted to 2023.9.3 and it's still a problem.

What version of Home Assistant Core has the issue?

2023.10.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

environment canada

Link to integration documentation on our website

https://www.home-assistant.io/integrations/environment_canada/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-10-06 08:18:55.398 ERROR (MainThread) [homeassistant.components.environment_canada] Unexpected error fetching environment_canada weather data: Weather update failed; no timestamp found
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/components/environment_canada/__init__.py", line 116, in _async_update_data
    await self.ec_data.update()
  File "/lsiopy/lib/python3.11/site-packages/env_canada/ec_weather.py", line 378, in update
    raise ECWeatherUpdateFailed("Weather update failed; no timestamp found")
env_canada.ec_weather.ECWeatherUpdateFailed: Weather update failed; no timestamp found
2023-10-06 08:18:55.409 WARNING (MainThread) [homeassistant.components.environment_canada] Unable to retrieve Environment Canada weather

Additional information

I tried to remove and re-add my location but that also doesn't work and I get the following error

2023-10-06 10:24:25.871 ERROR (MainThread) [homeassistant.components.environment_canada.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/components/environment_canada/config_flow.py", line 53, in async_step_user
    info = await validate_input(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/components/environment_canada/config_flow.py", line 29, in validate_input
    await weather_data.update()
  File "/lsiopy/lib/python3.11/site-packages/env_canada/ec_weather.py", line 378, in update
    raise ECWeatherUpdateFailed("Weather update failed; no timestamp found")
env_canada.ec_weather.ECWeatherUpdateFailed: Weather update failed; no timestamp found

No response

@home-assistant
Copy link

home-assistant bot commented Oct 6, 2023

Hey there @gwww, @michaeldavie, mind taking a look at this issue as it has been labeled with an integration (environment_canada) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of environment_canada can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign environment_canada Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


environment_canada documentation
environment_canada source
(message by IssueLinks)

@shmick
Copy link
Contributor Author

shmick commented Oct 6, 2023

It appears to be related to my weather station id.

Using the env_canada python module I was able to re-create the error using ON/s0000773 but it works fine with ON/s0000430

code:

import asyncio
from env_canada import ECWeather
ec_en = ECWeather(station_id="ON/s0000773")
asyncio.run(ec_en.update())
result = ec_en.conditions
print(result)

outpout:

Traceback (most recent call last):
  File "/home/steve/venv/test.py", line 9, in <module>
    asyncio.run(ec_en.update())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/steve/venv/lib/python3.10/site-packages/env_canada/ec_weather.py", line 378, in update
    raise ECWeatherUpdateFailed("Weather update failed; no timestamp found")
env_canada.ec_weather.ECWeatherUpdateFailed: Weather update failed; no timestamp found

code:

import asyncio
from env_canada import ECWeather
ec_en = ECWeather(station_id="ON/s0000430")
asyncio.run(ec_en.update())
result = ec_en.conditions
print(result)

outpout:

{'temperature': {'label': 'Temperature', 'unit': 'C', 'value': 19.6}, 'dewpoint': {'label': 'Dew Point', 'unit': 'C', 'value': 16.6}, 'wind_chill': {'label': 'Wind Chill', 'value': None}, 'humidex': {'label': 'Humidex', 'value': None}, 'pressure': {'label': 'Pressure', 'unit': 'kPa', 'value': 101.1}, 'tendency': {'label': 'Tendency', 'unit': 'kPa', 'value': 'falling'}, 'humidity': {'label': 'Humidity', 'unit': '%', 'value': 83}, 'visibility': {'label': 'Visibility', 'unit': 'km', 'value': 24.1}, 'condition': {'label': 'Condition', 'value': 'Mostly Cloudy'}, 'wind_speed': {'label': 'Wind Speed', 'unit': 'km/h', 'value': 18}, 'wind_gust': {'label': 'Wind Gust', 'unit': 'km/h', 'value': 33}, 'wind_dir': {'label': 'Wind Direction', 'value': 'S'}, 'wind_bearing': {'label': 'Wind Bearing', 'unit': 'degrees', 'value': 173}, 'high_temp': {'label': 'High Temperature', 'unit': 'C', 'value': 19}, 'low_temp': {'label': 'Low Temperature', 'unit': 'C', 'value': 13}, 'uv_index': {'label': 'UV Index', 'value': 2}, 'pop': {'label': 'Chance of Precip.', 'value': None}, 'icon_code': {'label': 'Icon Code', 'value': '03'}, 'high_temp_yesterday': {'label': 'High Temperature Yesterday', 'unit': 'C', 'value': 27.1}, 'low_temp_yesterday': {'label': 'Low Temperature Yesterday', 'unit': 'C', 'value': 16.2}, 'precip_yesterday': {'label': 'Precipitation Yesterday', 'unit': 'mm', 'value': 0.0}, 'normal_high': {'label': 'Normal High Temperature', 'unit': 'C', 'value': 14}, 'normal_low': {'label': 'Normal Low Temperature', 'unit': 'C', 'value': 5}, 'sunrise': {'label': 'Sunrise'}, 'sunset': {'label': 'Sunset'}, 'text_summary': {'label': 'Forecast', 'value': 'Today. Showers. Risk of a thunderstorm this afternoon. Local amount 5 to 10 mm. Wind south 20 km/h. Temperature steady near 19. Humidex 25. UV index 2 or low.'}}

@jj-csg
Copy link

jj-csg commented Oct 6, 2023

Observed the same for a nearby site. There appears to be a data outage for currentCondition, but forecast data is still available. See https://dd.weather.gc.ca/citypage_weather/xml/ON/s0000773_e.xml

Perhaps instead of error'ing out at the first data pull fail, we could continue attempting to pull subsequent data (e.g. from forecastGroup)?

Side note: this data outage might be related to outage at the Buttonville station, which is down since yesterday morning (maybe permanently? - the site is closing). EC website does seem to have a fallback and references another station now, but the XML datamart does not appear to do so.

@shmick
Copy link
Contributor Author

shmick commented Oct 6, 2023

@jj-csg good observation about Buttonville being shutdown. I tried the next closest ones in Markham s0000585 and Vaughan s0000584 and it's also giving me the Weather update failed; no timestamp found error, so maybe something is amiss at EnvCan right now.

@McGeaverBeaver
Copy link

Same issue here, Can't get any of the Markham or Richmond Hill ones working..

What I did was take my own coordinates of my personal location.. and then take every station available in the list, put them in chatGPT, and told it to give me a list of stations that are closest to me..

found the Markham one was actually further, but the Vaughan s0000584 is also having issues.. Whitby s0000708 seems to be fine.

@michaeldavie
Copy link
Contributor

This seems like a problem with the data source rather than the integration.

@michaeldavie
Copy link
Contributor

@home-assistant close

@shmick
Copy link
Contributor Author

shmick commented Oct 9, 2023

@michaeldavie while this does appear to be a data issue with Env Canada, it would be nice if the integration was able to work with incomplete data. Right now it completely fails due to the missing currentConditions in the XML, but the rest of the data is there.

Using s0000773 as example, CBC is surfacing the rest of the data just fine on their weather page even though the Current Conditions data is not being updated.

@McGeaverBeaver
Copy link

McGeaverBeaver commented Oct 9, 2023 via email

@michaeldavie
Copy link
Contributor

@home-assistant reopen

@home-assistant home-assistant bot reopened this Oct 11, 2023
@michaeldavie
Copy link
Contributor

image image image

@michaeldavie
Copy link
Contributor

Thanks for the suggestion! This fix should be included in the next release.

@shmick
Copy link
Contributor Author

shmick commented Oct 11, 2023

Thanks for the suggestion! This fix should be included in the next release.

Looks great, @michaeldavie! Thanks again for your work on this, it's appreciated.

@jj-csg
Copy link

jj-csg commented Oct 11, 2023

Thanks, @michaeldavie for the fix!

For all others interested, I wrote to EC regarding the data outage and received a response. As suspected, NAVCAN's YKZ Buttonville weather station is confirmed to be permanently closed (with the airport closing end of Nov). EC's website and app do use YTZ as backup, but the Datamart (used for this integration) does not. Their next relevant update is scheduled for March 2024, so no currentConditions will be returned for Markham, Vaughan and Richmond Hill until then.

@michaeldavie
Copy link
Contributor

This fix has been included in version 2023.10.2.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants