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

Icon format in forecast changed #120046

Closed
kevinhaas opened this issue Jun 20, 2024 · 7 comments · Fixed by #120164
Closed

Icon format in forecast changed #120046

kevinhaas opened this issue Jun 20, 2024 · 7 comments · Fixed by #120164

Comments

@kevinhaas
Copy link

kevinhaas commented Jun 20, 2024

The problem

Calling weather.get_forecasts on my NWS entities is currently throwing:

Failed to call service weather.get_forecasts. Unknown error

I attached the detailed logs which seem to reference the icon, and @MatthewFlamm already diagnosed it as such. Happening with both of the stations I had added.

#119114 (comment)
MatthewFlamm/pynws#207

What version of Home Assistant Core has the issue?

core-2024.6.2

What was the last working version of Home Assistant Core?

core-2024.6.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

NWS

Link to integration documentation on our website

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

Diagnostics information

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/weather/websocket_api.py", line 103, in ws_subscribe_forecast
await entity.async_update_listeners({forecast_type})
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 987, in async_update_listeners
native_forecast_list: list[Forecast] | None = await getattr(
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1236, in async_forecast_twice_daily
return await self._async_forecast("twice_daily")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1220, in _async_forecast
list[Forecast] | None, getattr(self, f"async_forecast{forecast_type}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/nws/weather.py", line 284, in _async_forecast_twice_daily
return self._forecast(self.nws.forecast, DAYNIGHT)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 450, in forecast
return self._convert_forecast(forecast)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 513, in _convert_forecast
time, weather = parse_icon(forecast_entry["icon"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 181, in parse_icon
time = icon_list[5]
~~~~~~~~~^^^
IndexError: list index out of range

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 987, in async_update_listeners
native_forecast_list: list[Forecast] | None = await getattr(
^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1236, in async_forecast_twice_daily
return await self._async_forecast("twice_daily")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1220, in _async_forecast
list[Forecast] | None, getattr(self, f"async_forecast{forecast_type}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/nws/weather.py", line 284, in _async_forecast_twice_daily
return self._forecast(self.nws.forecast, DAYNIGHT)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 450, in forecast
return self._convert_forecast(forecast)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 513, in _convert_forecast
time, weather = parse_icon(forecast_entry["icon"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 181, in parse_icon
time = icon_list[5]
~~~~~~~~~^^^
IndexError: list index out of range

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1058, in async_get_forecasts_service
native_forecast_list = await weather.async_forecast_twice_daily()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1236, in async_forecast_twice_daily
return await self._async_forecast("twice_daily")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/weather/init.py", line 1220, in _async_forecast
list[Forecast] | None, getattr(self, f"async_forecast{forecast_type}")()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/nws/weather.py", line 284, in _async_forecast_twice_daily
return self._forecast(self.nws.forecast, DAYNIGHT)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 450, in forecast
return self._convert_forecast(forecast)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 513, in _convert_forecast
time, weather = parse_icon(forecast_entry["icon"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pynws/simple_nws.py", line 181, in parse_icon
time = icon_list[5]
~~~~~~~~~^^^
IndexError: list index out of range

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

Code owners of nws 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 nws Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


nws documentation
nws source
(message by IssueLinks)

@3of9
Copy link

3of9 commented Jun 21, 2024

This also started happening for me today at 11:42 am Eastern US time.

@SCBionicle
Copy link

I'm having the same issue.

@kevinhaas
Copy link
Author

@MatthewFlamm Is there anyway I can apply the patch for pynws myself?

@iprak
Copy link
Contributor

iprak commented Jun 22, 2024

I was able to get nws component working by bumping the pynws dependency=1.8.2.

@iprak iprak mentioned this issue Jun 22, 2024
20 tasks
@kevinhaas
Copy link
Author

Thanks! All good now.

@iprak
Copy link
Contributor

iprak commented Jun 22, 2024

@MatthewFlamm Is there anyway I can apply the patch for pynws myself?

You can copy nws from core\components into custom_components\nws, edit the manifest to use 1.8.2 and restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants