BigNocciolino / CryptoTracker

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

Update for sensor.x fails #19

Closed BigNocciolino closed 2 years ago

BigNocciolino commented 2 years ago

Since the req object (that contain the request object) it's initialized as a string, sometimes when the sensor refuses to update, the req object remains a string.

Full log trace:


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 512, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 716, in async_device_update
    raise exc
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/cryptostate/sensor.py", line 146, in _update
    data = get_data(self._compare)
  File "/config/custom_components/cryptostate/sensor.py", line 61, in get_data
    if (req.status_code == 200):
AttributeError: 'str' object has no attribute 'status_code
smarthomejunkie commented 2 years ago

+1

kevincaradant commented 2 years ago

+1 , HA don't start anymore because of this issue :(

image

Edit: Finally, it started 10 minutes later. (I don't know if it's the only reason of this delay). But I think it wait the request timeout of each crypto that it try to load If you have like me 10 or 15 crypto, it's pretty long to start :D

BigNocciolino commented 2 years ago

Hi I'm closing all the old issues, if there are problems with the new version, please open a new issue