Skip to content

Instantly share code, notes, and snippets.

@atomicpapa
Last active August 20, 2021 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomicpapa/69003aeb8d547e7c54800ebe9e44f059 to your computer and use it in GitHub Desktop.
Save atomicpapa/69003aeb8d547e7c54800ebe9e44f059 to your computer and use it in GitHub Desktop.
Dwain's Dashboard Crypto More-page
## Created by Glenn Morrison
## More-page add-on: Crypto
## Version: 1.0.0
## This addon requires setting up the crypto tracker detailed here:
## https://community.home-assistant.io/t/how-to-track-crypto-in-home-assistant/316051?u=atomicpapa
## Additionally, the following Lovelace cards must be installed:
## Lovelace Card Mod
## Template Entity Row
## Vertical Card in Stack
## Mini-Graph-Card
## add the following to your more-page.yaml
## addons:
## - name: Crypto
## icon: mdi:bitcoin
## path: "dwains-dashboard/addons/more_page/crypto/page.yaml"
- type: custom:dwains-flexbox-card
items_classes: "col-xs-12 col-sm-6 col-sm-6 col-md-3"
cards:
### BTC
- type: custom:vertical-stack-in-card
cards:
- type: entities
entities:
- type: custom:template-entity-row
entity: sensor.crypto_btc
name: "{{ state_attr(config.entity, 'name') }}"
secondary: "{{ state_attr(config.entity, 'symbol') }}"
image: "{{ state_attr(config.entity, 'logo_url') }}"
state: ${{ state_attr(config.entity, 'price') | round(2) }}
- type: custom:template-entity-row
entity: sensor.crypto_btc
name: High
icon: mdi:currency-usd
state: ${{ state_attr(config.entity, 'high') | round (2)}}
secondary: >-
{{ as_timestamp(state_attr(config.entity, 'high_timestamp')) |
timestamp_custom('%d-%m-%Y %H:%M ') }}
- type: custom:template-entity-row
entity: sensor.crypto_btc
name: Crypto Rank
icon: mdi:chart-line
state: "{{ state_attr(config.entity, 'rank') }}"
secondary: ${{"{:,}".format(state_attr(config.entity, 'market_cap')|int)}}
- type: custom:mini-graph-card
hours_to_show: 3
points_per_hour: 60
show:
icon: false
name: false
entities:
- entity: sensor.crypto_btc
- type: entities
entities:
- entity: sensor.crypto_btc_1_hr
name: 1 Hour
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_btc_1_d
name: 1 Day
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_btc_7_d
name: 7 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_btc_30_d
name: 30 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
#### ETH
- type: custom:vertical-stack-in-card
cards:
- type: entities
entities:
- type: custom:template-entity-row
entity: sensor.crypto_eth
name: "{{ state_attr(config.entity, 'name') }}"
secondary: "{{ state_attr(config.entity, 'symbol') }}"
image: "{{ state_attr(config.entity, 'logo_url') }}"
state: ${{ state_attr(config.entity, 'price') | round(2) }}
- type: custom:template-entity-row
entity: sensor.crypto_eth
name: High
icon: mdi:currency-usd
state: ${{ state_attr(config.entity, 'high') | round (2)}}
secondary: >-
{{ as_timestamp(state_attr(config.entity, 'high_timestamp')) |
timestamp_custom('%d-%m-%Y %H:%M ') }}
- type: custom:template-entity-row
entity: sensor.crypto_eth
name: Crypto Rank
icon: mdi:chart-line
state: "{{ state_attr(config.entity, 'rank') }}"
secondary: ${{"{:,}".format(state_attr(config.entity, 'market_cap')|int)}}
- type: custom:mini-graph-card
hours_to_show: 3
points_per_hour: 60
show:
icon: false
name: false
entities:
- entity: sensor.crypto_eth
- type: entities
entities:
- entity: sensor.crypto_eth_1_hr
name: 1 Hour
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_eth_1_d
name: 1 Day
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_eth_7_d
name: 7 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_eth_30_d
name: 30 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
### LTC
- type: custom:vertical-stack-in-card
cards:
- type: entities
entities:
- type: custom:template-entity-row
entity: sensor.crypto_ltc
name: "{{ state_attr(config.entity, 'name') }}"
secondary: "{{ state_attr(config.entity, 'symbol') }}"
image: "{{ state_attr(config.entity, 'logo_url') }}"
state: ${{ state_attr(config.entity, 'price') | round(2) }}
- type: custom:template-entity-row
entity: sensor.crypto_ltc
name: High
icon: mdi:currency-usd
state: ${{ state_attr(config.entity, 'high') | round (2)}}
secondary: >-
{{ as_timestamp(state_attr(config.entity, 'high_timestamp')) |
timestamp_custom('%d-%m-%Y %H:%M ') }}
- type: custom:template-entity-row
entity: sensor.crypto_ltc
name: Crypto Rank
icon: mdi:chart-line
state: "{{ state_attr(config.entity, 'rank') }}"
secondary: ${{"{:,}".format(state_attr(config.entity, 'market_cap')|int)}}
- type: custom:mini-graph-card
hours_to_show: 3
points_per_hour: 60
show:
icon: false
name: false
entities:
- entity: sensor.crypto_ltc
- type: entities
entities:
- entity: sensor.crypto_ltc_1_hr
name: 1 Hour
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_ltc_1_d
name: 1 Day
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_ltc_7_d
name: 7 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
- entity: sensor.crypto_ltc_30_d
name: 30 Days
type: custom:template-entity-row
state: ${{ states(config.entity) | round(2) }}
secondary: >-
{{ state_attr(config.entity, 'price_change_pct') | multiply(100) |
round(4) }}%
icon: |
{% if states(config.entity) | float > 0 %}
mdi:arrow-up-bold
{% elif states(config.entity) | float < 0 %}
mdi:arrow-down-bold
{% else %}
mdi:arrow-right-bold
{% endif %}
card_mod:
style: |
{% if states(config.entity) | float > 0 %}
:host {
--paper-item-icon-color: green;
color: green
}
{% elif states(config.entity) | float < 0 %}
:host {
--paper-item-icon-color: red;
color: red
}
{% else %}
:host {
--paper-item-icon-color: black;
color: black
}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment