heyajohnny / cryptoinfo

Provides Home Assistant sensors for all cryptocurrencies supported by CoinGecko
GNU General Public License v3.0
46 stars 13 forks source link

Failing for some currencies #6

Closed pkpio closed 3 years ago

pkpio commented 3 years ago

It's working fine for BTC and ETH but failing for some other currencies. See logs

Logger: homeassistant.helpers.entity Source: custom_components/cryptoinfo/sensor.py:87 First occurred: 4:52:17 PM (45 occurrences) Last logged: 4:56:21 PM

Update for sensor.cryptoinfo_cel_usd fails Update for sensor.cryptoinfo_xrp_usd fails Update for sensor.cryptoinfo_dot_usd fails Update for sensor.cryptoinfo_yfi_usd fails Update for sensor.cryptoinfo_matic_usd fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update await self.hass.async_add_executor_job(self.update) # type: ignore File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/usr/src/homeassistant/homeassistant/util/init.py", line 239, in wrapper result = method(*args, *kwargs) File "/config/custom_components/cryptoinfo/sensor.py", line 129, in _update self.data.update() File "/usr/src/homeassistant/homeassistant/util/init.py", line 239, in wrapper result = method(args, kwargs) File "/config/custom_components/cryptoinfo/sensor.py", line 87, in _update value = r.json()[self.cryptocurrency_name][self.currency_name] KeyError: 'cel'

heyajohnny commented 3 years ago

You are probably using the "symbol" value as "cryptocurrency_name". You need to use the "id" value for "cryptocurrency_name".

Try these values for "cryptocurrency_name":

And please let me know if it solves your issue ;)

pkpio commented 3 years ago

That worked! Thanks @heyajohnny 🥇

HGabet commented 2 years ago

Thanks a lot !