core icon indicating copy to clipboard operation
core copied to clipboard

HA 2023.1.2 braking ZAMG Wien/Schwechat

Open MattWestb opened this issue 2 years ago • 15 comments

The problem

I have 4 Zamg:s and Wien/Schwechat is not having humidity and it was not problem before. With the last changes HA cant loading it then its have type error.

What version of Home Assistant Core has the issue?

core-2023.1.2

What was the last working version of Home Assistant Core?

core-2023.1.1

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

zamg

Link to integration documentation on our website

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

Diagnostics information

Logger: homeassistant.components.weather
Source: components/zamg/weather.py:120
Integration: Weather (documentation, issues)
First occurred: 09:43:11 (2 occurrences)
Last logged: 09:43:11

Error adding entities for domain weather with platform zamg
Error while setting up zamg platform for weather
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 438, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 709, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 804, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 644, in state_attributes
    if (humidity := self.humidity) is not None:
  File "/usr/src/homeassistant/homeassistant/components/zamg/weather.py", line 120, in humidity
    return float(self.coordinator.data[self.station_id]["RFAM"]["data"])
TypeError: float() argument must be a string or a real number, not 'NoneType'

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

MattWestb avatar Jan 09 '23 09:01 MattWestb

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

Code owner commands

Code owners of zamg can trigger bot actions by commenting:

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

(message by CodeOwnersMention)


zamg documentation zamg source (message by IssueLinks)

home-assistant[bot] avatar Jan 09 '23 09:01 home-assistant[bot]

Looks like the other sensors is reporting OK but the humidity is always zero / none that making the Weather wiglet not loading. Zamg01

MattWestb avatar Jan 09 '23 09:01 MattWestb

Thanks for mentioning this issue. I saw the same behaviour already on another station with the temperature.

I am currently working on this issue.

killer0071234 avatar Jan 10 '23 13:01 killer0071234

Thanks for the attention. Is it also possible changing the ugly "Unknown" in the card to somthing nicer like "available" / "unavailable" ??

Lg

MW

MattWestb avatar Jan 10 '23 13:01 MattWestb

Thanks for the attention. Is it also possible changing the ugly "Unknown" in the card to somthing nicer like "available" / "unavailable" ??

Lg

This ugly Unknown is the result of not having a current weather condition for the station. One thing could be to use sensors precipitation, sun_last_10min, snow etc. to show at least a matching icon see weather integration. This would made the weather indication in the dashboard prettier.

BR

killer0071234 avatar Jan 10 '23 14:01 killer0071234

That sounds very nice only need one logic for selecting the right one then its no sun and no rain and setting default as snow is not so good in the summer ;-)

Thanks for the integration and hope its continuing working well (as the last days the server was responding OK most of the time) and fixing the problems that is showing up !!

MattWestb avatar Jan 10 '23 15:01 MattWestb

That sounds very nice only need one logic for selecting the right one then its no sun and no rain and setting default as snow is not so good in the summer ;-)

Correct, snow icon in summer would look funny ;-). I will have a look on it, at least have a few icons would be nice.

Thanks for the integration and hope its continuing working well (as the last days the server was responding OK most of the time) and fixing the problems that is showing up !!

Yes, currently the API is responding pretty good. I had 'just' 3 unknown responses since 5th of January.

killer0071234 avatar Jan 10 '23 17:01 killer0071234

@MattWestb Did you mean something like that?

grafik grafik grafik

It's read from the values of sunshine duration, rain, snow, wind, day/night. At least a 'cheap' indication is possible...

killer0071234 avatar Jan 10 '23 19:01 killer0071234

The Zamg is not doing one forecast so all is better then finding one matrix with the data they is giving us.

Sheep weather stations is also using the pressure and historic data of it for doing "forecasts" but i think its not in our scope then its no forecast its reported weather we is doing with.

Its looks very nice and i think its the best we can getting and i think most users think the same then getting it on there system !!!

And thanks for the fix its working very well !!!

MattWestb avatar Jan 10 '23 20:01 MattWestb

The Zamg is not doing one forecast so all is better then finding one matrix with the data they is giving us.

Mentioned there 'https://github.com/killer0071234/python-zamg/issues/31#issuecomment-1377499634' it's planned that zamg will get a forecast api! If it's public, we need to dig into it.

Sheep weather stations is also using the pressure and historic data of it for doing "forecasts" but i think its not in our scope then its no forecast its reported weather we is doing with.

Yes, that's right. The screenshots above are returning / showing the (current) condition (not the forecast) and thus are taken from the sensors. The forecast is a different / additional part in HA (forecast are a separate dict).

Its looks very nice and i think its the best we can getting and i think most users think the same then getting it on there system !!!

The condition can also be used in automations (eg. State changed to rainy..).

And thanks for the fix its working very well !!!

No Problem!

killer0071234 avatar Jan 10 '23 20:01 killer0071234

I think the "online sensor status" is enough for the sensor reporting and then the API for forecasts is working i think its better doing one weather forecast integration or if its being good / easy one contaminated one.

Also better making one new well working forecast then hacking the old for doing things it cant do.

So if we is getting little graphic "online" weather status then waiting on the new API us great !!

MattWestb avatar Jan 10 '23 21:01 MattWestb

Maybe my issue is already solved with the fix mentioned above. But please let me outline what I detected: Having a Weather Forecast Card configured with secondary_info_attribute: precipitation, the Card shows NaN mm:

01 Card Configuration 01 Dashboard

The state of the sensor shows 0.0 and the correct unit mm.

01 DevTools State

Edit: In the Set State Dialog I do NOT see the value of the precipitation, only the unit: 04 DevTools Set State

Is this a different or the same story?

Btw: The Data-Hub seems to be a bit more stable in the last days...

oe3arc avatar Feb 06 '23 07:02 oe3arc

Schwechat have stop working in 2023.2

weather.wien_Schweitzer_wien_schwechat
ZAMG Wien/Schwechat
unavailable	restored: true
friendly_name: ZAMG Wien/Schwechat
supported_features: 0

HA log error:

Logger: homeassistant
Source: components/zamg/weather.py:83
First occurred: 08:49:42 (5 occurrences)
Last logged: 09:29:46

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 330, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 135, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 390, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 566, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 650, in state_attributes
    if (humidity := self.humidity) is not None:
  File "/usr/src/homeassistant/homeassistant/components/zamg/weather.py", line 83, in humidity
    return float(self.coordinator.data[self.station_id]["RFAM"]["data"])
TypeError: float() argument must be a string or a real number, not 'NoneType'

And yes datahub looks being mush better upptime and only some missed updates in one day.

Edit: Device card looks being OK updated with all data:

Sensors
Dew Point
-8.8 °C
Dew Point Average
Unknown
Humidity
Unknown
Precipitation
0.0 mm
Pressure
1,016.4 hPa
Pressure at Sea Level
1,040.2 hPa
Snow
0.0 cm
Sun Last 10 Minutes
0.0 s
Temperature
-3.5 °C
Temperature Average
Unknown
Top Wind Bearing
Unknown
Top Wind Speed
5.7 m/s
Wind Bearing
340.0 °
Wind Speed
Unknown
ZAMG Wien/Schwechat
Unavailable

MattWestb avatar Feb 06 '23 08:02 MattWestb

Is this a different or the same story?

Btw: The Data-Hub seems to be a bit more stable in the last days...

It looks for me as it's the same (already solved) issue with the weather entity. the first non existing value (eg. humidy, etc.) for the weather is breaking all of the following readings for the weather entity.

killer0071234 avatar Feb 06 '23 16:02 killer0071234

Thank's for the quick clarification! Then I'll wait for the PR getting merged.

br Andy

oe3arc avatar Feb 06 '23 16:02 oe3arc

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still not fixed in HA 2023.5 but the fix is working and need need added after every update ;-((

MattWestb avatar May 07 '23 18:05 MattWestb