heyajohnny / cryptoinfo

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

feature request: total ERC20 holdings #13

Closed R5fan closed 3 years ago

R5fan commented 3 years ago

Heya Johnny,

Love your addon. But what I would love even more is having a HA sensor that contains the USD (or EUR) value of all my ethereum + erc20 tokens. For instance: https://etherscan.io/tokenholdings?a=0x281055afc982d96fab65b3a49cac8b878184cb16 (no, not my address :) ).

I cant find an API that does this, even etherscan API as far as I can tell does not support this, weirdly, which probably only leaves scraping the website?

heyajohnny commented 3 years ago

You could use a template like this. Just add a sensor to it, for every cryptocurrency you have in 'cryptoinfo'.

This example combines the total value of 3 sensors into this 1 template sensor:

  - platform: template
    sensors:
      crypto_total:
        value_template: "{{
          ( states('sensor.cryptoinfo_main_wallet_ethereum_eur') | float | round(2)) +
          ( states('sensor.cryptoinfo_bitcoin_eur') | float | round(2)) +
          ( states('sensor.cryptoinfo_cardano_eur') | float | round(2))
          }}"
        unit_of_measurement: '€'
        friendly_name: Total value of all my cryptocurrencies

Reading an Etherscan address with it's values is not a part of the Coingecko API, so I won't be adding it to this project. So the only solution I see is the one up here :point_up:

sibbl commented 3 years ago

@R5fan what you're probably looking for, is the etherscan integration: https://www.home-assistant.io/integrations/etherscan/

heyajohnny commented 3 years ago

@sibbl That's a nice one! Didn't knew it exists. I'm closing the issue, since there isn't anything to fix and there are now 2 solutions for this issue