GuyKh / ims-custom-component

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

Fail to load integration #31

Closed Gugulator closed 1 year ago

Gugulator commented 1 year ago

suddenly integration that was installed and working, fails to load. in ha->settings->integrations I have following error on IMS integration: Retrying setup: 'NoneType' object is not iterable

Here is record from system log: Config entry 'IMS Weather' for ims integration not ready yet: 'NoneType' object is not iterable; Retrying in background

Home Assistant 2023.5.2 Supervisor 2023.04.1 Operating System 10.1 Frontend 20230503.3 - latest

vadimnazaroff commented 1 year ago

Same here. Appeared today only.

GuyKh commented 1 year ago

Looking into that

GuyKh commented 1 year ago

Part of the problem is with the fact that https://ims.gov.il/en/now_analysis returns only a single state

GuyKh commented 1 year ago

Looks like IMS changed their API for current forecast. Working on a fix

GuyKh commented 1 year ago

(I hope it's) Fixed in version 0.1.6

vadimnazaroff commented 1 year ago

New issue after updating: Logger: homeassistant.components.weather Source: custom_components/ims/weather.py:250 Integration: Weather (documentation, issues) First occurred: 14:49:09 (6 occurrences) Last logged: 14:51:06

Error adding entities for domain weather with platform ims Error while setting up ims platform for weather Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 846, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, 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 250, in condition condition = WEATHER_CODE_TO_CONDITION[ KeyError: '0'

GuyKh commented 1 year ago

@vadimnazaroff Fixed in 0.1.7 They screwed up their API (not sending weather_code fields and all) - but in 0.1.7 it works.

vadimnazaroff commented 1 year ago

Thanks, no errors now in system logs. However new issue now - weather card not displayed for created weather entity, probably due to some missing parameters in the created entity?

GuyKh commented 1 year ago

It relates to changes in IMS API (which I can't control) - sometimes they don't list all the data. It feels they're changing they're playing with the API. Let it a day or two and see if it's any better.

vadimnazaroff commented 1 year ago

Ok, Thanks much for quick response, lets follow up in coming days

GuyKh commented 1 year ago

@vadimnazaroff - can you try again with the latest version?

vadimnazaroff commented 1 year ago

Yesterday night after upgrade worked well, this morning again issues started to occur:

Logger: homeassistant.components.weather Source: custom_components/ims/weather.py:248 Integration: Weather (documentation, issues) First occurred: 10:54:49 (2 occurrences) Last logged: 10:54:49

Error adding entities for domain weather with platform ims Error while setting up ims platform for weather Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, 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 248, in condition self._weather_coordinator.data.current_weather.weather_code AttributeError: 'NoneType' object has no attribute 'weather_code'

vadimnazaroff commented 1 year ago

Yesterday night after upgrade worked well, this morning again issues started to occur:

Logger: homeassistant.components.weather Source: custom_components/ims/weather.py:248 Integration: Weather (documentation, issues) First occurred: 10:54:49 (2 occurrences) Last logged: 10:54:49

Error adding entities for domain weather with platform ims Error while setting up ims platform for weather Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, 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 248, in condition self._weather_coordinator.data.current_weather.weather_code AttributeError: 'NoneType' object has no attribute 'weather_code'

And back working again. Seems IMS changing APIs on the fly ...

GuyKh commented 1 year ago

Try again with 0.1.12 - added some protections

GuyKh commented 1 year ago

Closing for inactivity