Advertisement
314ma

Crypto button template

May 1st, 2022
1,428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.42 KB | None | 0 0
  1.  
  2.   crypto_value:
  3.     show_icon: false
  4.     show_state: false
  5.     show_name: false
  6.     styles:
  7.       grid:
  8.         - grid-template-areas: '"title CRYPTO CRYPTO_u" "title USD USD_u" "title PLN PLN_u"'
  9.         - grid-template-columns: 1fr auto auto
  10.       custom_fields:
  11.         title:
  12.           - font-size: 1.5em
  13.           - align-self: middle
  14.           - justify-self: start
  15.           - margin-left: 20px
  16.         CRYPTO:
  17.           - font-size: 1.2em
  18.           - padding: 2px
  19.           - align-self: middle
  20.           - justify-self: end
  21.           - margin-right: 2px
  22.         USD:
  23.           - font-size: 0.8em
  24.           - padding: 1px
  25.           - align-self: middle
  26.           - justify-self: end
  27.           - margin-right: 2px
  28.         PLN:
  29.           - font-size: 0.8em
  30.           - padding: 1px
  31.           - align-self: middle
  32.           - justify-self: end
  33.           - margin-right: 2px
  34.         CRYPTO_u:
  35.           - font-size: 0.9em
  36.           - padding: 2px
  37.           - align-self: end
  38.           - justify-self: start
  39.           - margin-right: 10px
  40.           - color: var(--secondary-text-color)
  41.         USD_u:
  42.           - font-size: 0.6em
  43.           - padding: 1px
  44.           - align-self: end
  45.           - justify-self: start
  46.           - margin-right: 10px
  47.           - color: var(--secondary-text-color)
  48.         PLN_u:
  49.           - font-size: 0.6em
  50.           - padding: 1px
  51.           - align-self: end
  52.           - justify-self: start
  53.           - margin-right: 10px
  54.           - color: var(--secondary-text-color)
  55.     variables:
  56.       icon: mdi:cash
  57.       title: TITLE
  58.       round: 2
  59.       USD_price_entity: sensor.step_price
  60.       PLN_price_entity: sensor.pln_price
  61.       unit_of_measurement: '[[[ return entity.attributes.unit_of_measurement ]]]'
  62.     custom_fields:
  63.       title: >-
  64.         [[[ return `<ha-icon icon="${variables.icon}" style="height: 1.5em;
  65.         color: var(--state-icon-color); "></ha-icon> ${variables.title}` ]]]
  66.      CRYPTO: '[[[ return parseFloat(entity.state).toFixed(variables.round) ]]]'
  67.      USD: >-
  68.        [[[ return parseFloat(entity.state *
  69.        states[variables.USD_price_entity].state).toFixed(2) ]]]
  70.      PLN: >-
  71.        [[[ return parseFloat(entity.state *
  72.        states[variables.USD_price_entity].state *
  73.        states[variables.PLN_price_entity].state).toFixed(2) ]]]
  74.      CRYPTO_u: '[[[ return variables.unit_of_measurement ]]]'
  75.      USD_u: USD
  76.      PLN_u: PLN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement