BigNocciolino / CryptoTracker

Integration for Home Assistant to implement a crypto tracking system
23 stars 4 forks source link

Error logs sometimes #32

Closed kevincaradant closed 6 months ago

kevincaradant commented 1 year ago

Hi

i got these errors some days:

2023-03-13 23:02:10.223 ERROR (MainThread) [custom_components.cryptostate] Timeout error fetching information from https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/egld/usd.json -
2023-03-13 23:02:10.241 ERROR (MainThread) [homeassistant] 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 559, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 565, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 470, in state
value = self.native_value
File "/config/custom_components/cryptostate/sensor.py", line 33, in native_value
return self.coordinator.data.get(self._base)
AttributeError: 'NoneType' object has no attribute 'get'

I don't know if it's possible to avoid them. I thik it's when the endpoint is not responsive ? Could you skip it or mentioned it as a warn only ?

Thanks :)

BigNocciolino commented 1 year ago

Probably this can be avoided with more checks, tomorrow i will try to fix

BigNocciolino commented 1 year ago

Sorry but i've been busy these days, I ended up rewriting all the api wrapper, those days i'll test the new changes and publish a new release

kevincaradant commented 1 year ago

Yeah no problem, don't worry. I will check it when it will be ready :)

kevincaradant commented 6 months ago

I didn't have any issue since a long time, I close this one ;)