t0mer / ims-custom-component

The Israel Meteorological Service (IMS) integration component for home assistant
MIT License
35 stars 8 forks source link

AttributeError: 'NoneType' object has no attribute 'json' #44

Closed sagilo closed 1 year ago

sagilo commented 1 year ago

The state of the weather sensor is "unknown" and I find the following error in logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 341, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 142, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 568, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 632, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 783, in state
    return self.condition
  File "/config/custom_components/ims/weather.py", line 247, in condition
    self._weather_coordinator.data.current_weather.json["weather_code"]
AttributeError: 'NoneType' object has no attribute 'json'

Configuration:

image

Running the latest version (HA on docker, installed via HACS)

GuyKh commented 1 year ago

@sagilo fixed?

sagilo commented 1 year ago

@sagilo fixed?

looks like it