Advertisement
elradix

System button card

Jul 5th, 2019
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.07 KB | None | 0 0
  1. cards:
  2.   - cards:
  3.       - type: 'custom:button-card'
  4.         entity: sensor.cpu_temp
  5.         icon: 'mdi:raspberry-pi'
  6.         label_template: |
  7.          return '<div align="left">' +
  8.                   '<div>' +
  9.                     '<ha-icon icon="mdi:thermometer" style="width: 12px; color: #f4e842; padding-bottom: 0px;"></ha-icon> ' +
  10.                     entity.state + '°C' +
  11.                   '</div>' +
  12.                 '</div>';
  13.         name_template: |
  14.           return '<div align="left" style="padding-top: 0px;">' +
  15.                  '<div style="font-weight: bold;font-size: 13px;">' + "RPI" + '</div>' +
  16.                  '<div style="margin-top: -5px;">' +
  17.                    '<ha-icon icon="mdi:server" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  18.                     "CPU: " + states['sensor.processor_use'].state + '%' +
  19.                  '</div>' +
  20.                  '<div style="margin-top: -10px;">' +
  21.                    '<ha-icon icon="mdi:memory" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  22.                     "RAM: " + Math.round(states['sensor.memory_use'].state) + " MB" +
  23.                  '</div>' +
  24.                  '<div style="margin-top: -10px;">' +
  25.                    '<ha-icon icon="mdi:harddisk" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  26.                     "SD: " + states['sensor.disk_free_home'].state + " GB" +
  27.                  '</div>' +
  28.                '</div>';
  29.        state:
  30.          - color: lime
  31.            operator: template
  32.            value: |
  33.              return entity.state < '60'
  34.          - color: orange
  35.            operator: template
  36.            value: |
  37.              return entity.state < '80'
  38.          - color: red
  39.            operator: template
  40.            value: |
  41.              return entity.state > '80'
  42.        aspect_ratio: 1/1
  43.        color: auto
  44.        layout: icon_label
  45.        show_label: true
  46.        show_state: false
  47.      - type: 'custom:button-card'
  48.        entity: sensor.cpu_temp
  49.        icon: 'mdi:raspberry-pi'
  50.        label_template: |
  51.          return '<div align="left">' +
  52.                  '<div>' +
  53.                    '<ha-icon icon="mdi:thermometer" style="width: 12px; color: #f4e842; padding-bottom: 0px;"></ha-icon> ' +
  54.                     entity.state + '°C' +
  55.                   '</div>' +
  56.                 '</div>';
  57.         name_template: |
  58.           return '<div align="left" style="padding-top: 0px;">' +
  59.                  '<div style="font-weight: bold;font-size: 13px;">' + "RPI" + '</div>' +
  60.                  '<div style="margin-top: -5px;">' +
  61.                    '<ha-icon icon="mdi:server" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  62.                     "CPU: " + states['sensor.processor_use'].state + '%' +
  63.                  '</div>' +
  64.                  '<div style="margin-top: -10px;">' +
  65.                    '<ha-icon icon="mdi:memory" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  66.                     "RAM: " + Math.round(states['sensor.memory_use'].state) + " MB" +
  67.                  '</div>' +
  68.                  '<div style="margin-top: -10px;">' +
  69.                    '<ha-icon icon="mdi:harddisk" style="width: 12px; color: #03a9f4; padding-bottom: 2px;"></ha-icon> ' +
  70.                     "SD: " + states['sensor.disk_free_home'].state + " GB" +
  71.                  '</div>' +
  72.                '</div>';
  73.        state:
  74.          - color: lime
  75.            operator: template
  76.            value: |
  77.              return entity.state < '60'
  78.          - color: orange
  79.            operator: template
  80.            value: |
  81.              return entity.state < '80'
  82.          - color: red
  83.            operator: template
  84.            value: |
  85.              return entity.state > '80'
  86.        aspect_ratio: 1/1
  87.        color: auto
  88.        layout: icon_label
  89.        show_label: true
  90.        show_state: false
  91.      - color_type: blank-card
  92.        type: 'custom:button-card'
  93.    type: horizontal-stack
  94. type: vertical-stack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement