Skip to content

Provides Home Assistant sensors for all cryptocurrencies supported by CoinGecko

License

Notifications You must be signed in to change notification settings

heyajohnny/cryptoinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Assistant sensor component for cryptocurrencies

hacs_badge

icon_mini

Powered by CoinGecko API

Provides Home Assistant sensors for all cryptocurrencies supported by CoinGecko

Breaking changes for upgrading from v0.x.x to v1.x.x

If you've just updated from v0.x.x to v1.x.x please remove the cryptoinfo sensor from your configuration.yaml and follow Installation step 2

If you like my work, please buy me a coffee or donate some crypto currencies. This will keep me awake, asleep, or whatever 😉

Crypto currency addresses xmr btc ada

If you need more advanced features than this project offers, see Cryptoinfo Advanced

Installation step 1:

There are 2 ways to install cryptoinfo:

  1. Download 'cryptoinfo' from the HACS store
  2. Copy the files in the /custom_components/cryptoinfo/ folder to: [homeassistant]/config/custom_components/cryptoinfo/

Installation step 2

The next step is to add cryptoinfo sensors to your Home Assistant:

  1. Browse to your Home Assistant config page
  2. Press Settings --> Devices & Services

image

  1. Press 'Add Integration' and search for 'cryptoinfo' and select the 'cryptoinfo' integration

image

  1. Fill in the 'add new sensor' form

image

Properties

- Identifier                                Unique name for the sensor
- Cryptocurrency id's                       One or more of the 'id' values (seperated by a , character) that you can find on this <a href='https://api.coingecko.com/api/v3/coins/list' target='_blank'>page</a>
- Multipliers                               The number of coins/tokens (seperated by a , character). The number of Multipliers must match the number of Cryptocurrency id's
- Currency name                             One of the currency names that you can find on this <a href='https://api.coingecko.com/api/v3/simple/supported_vs_currencies' target='_blank'>page</a>
- Unit of measurement                       You can use a currency symbol or you can make it empty. You can find some symbols on this <a href='https://en.wikipedia.org/wiki/Currency_symbol#List_of_currency_symbols_currently_in_use' target='_blank'>page</a>
- Update frequency (minutes)                How often should the value be refreshed? Beware of the <a href='https://support.coingecko.com/hc/en-us/articles/4538771776153-What-is-the-rate-limit-for-CoinGecko-API-public-plan' target='_blank'>CoinGecko rate limit</a> when using multiple sensors
- Minimum time between requests (minutes)   The minimum time between the other sensors and this sensor to make a data request to the API. (This property is shared and the same for every sensor). You can set this value to 0 if you only use 1 sensor

Attributes

The entities have some important attributes:

- last_update           This will return the date and time of the last update
- cryptocurrency_id     This will return the cryptocurrency id
- cryptocurrency_name   This will return the cryptocurrency name
- cryptocurrency_symbol This will return the cryptocurrency symbol
- currency_name         This will return the currency name
- base_price            This will return the price of 1 coin / token in 'currency_name'(default = "usd") of the 'cryptocurrency_id'
- multiplier            This will return the number of coins / tokens
- 24h_volume            This will return the 24 hour volume in 'currency_name'(default = "usd") of the 'cryptocurrency_id'(default = "bitcoin")
- 1h_change             This will return the 1 hour change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
- 24h_change            This will return the 24 hour change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
- 7d_change             This will return the 7 day change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
- 30d_change            This will return the 30 day change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
- market_cap            This will return the total market cap of the 'cryptocurrency_id'(default = "bitcoin") displayed in 'currency_name'(default = "usd")
- circulating_supply    This will return the circulating supply of the 'cryptocurrency_id'(default = "bitcoin")
- total_supply          This will return the total supply of the 'cryptocurrency_id'(default = "bitcoin")

Template example for usage of attributes. This example creates a new sensor with the attribute value '24h_volume' of the sensor 'sensor.cryptoinfo_main_wallet_ethereum_eur':

  - platform: template
    sensors:
      cryptoinfo_main_wallet_ethereum_eur_24h_volume:
        value_template: "{{ state_attr('sensor.cryptoinfo_main_wallet_ethereum_eur', '24h_volume') | float(0) | round(0) }}"
        unit_of_measurement: ""

If you want to know the total value of your cryptocurrencies, you could use this template as an example. This example combines the total value of all your sensors into this 1 template sensor:

  - platform: template
    sensors:
      crypto_total:
        value_template: >
          {{ integration_entities('cryptoinfo')
              | map('states')
              | map('float', 0)
              | sum | round(2) }}
        unit_of_measurement: >
          {{ expand(integration_entities('cryptoinfo'))
              | map(attribute='attributes.unit_of_measurement')
              | list | default(['$'], true)
              | first }}
        friendly_name: Total value of all my cryptocurrencies

API limit

CoinGecko’s Public API has a rate limit of 5 to 15 calls per minute, depending on usage conditions worldwide.

Issues and new functionality

If there are any problems, please create an issue in https://github.com/heyajohnny/cryptoinfo/issues If you want new functionality added, please create an issue with a description of the new functionality that you want in: https://github.com/heyajohnny/cryptoinfo/issues