cadmium_card:
  v3_xs_button:
    - title:
    - icon:
  card:
    type: entities
    style: |
      #states > div:last-child {
        margin: 0 -16px -16px -16px;
      }
    title: "[[title]]"
    icon: "[[icon]]"
    entities:
      - type: custom:hui-vertical-stack-card
        cards:
          - type: horizontal-stack
            cards:
              - type: custom:button-card
                template: v3_xs_button
                entity: switch.cadmium
                name: Power
              - type: custom:button-card
                template: v3_xs_button
                entity: script.cadmium_lock
                name: Lock
                icon: mdi:lock
                tap_action:
                  action: toggle
              - type: custom:button-card
                template: v3_xs_button
                entity: script.cadmium_displays_on
                name: Displ. on
                icon: mdi:monitor-dashboard
                tap_action:
                  action: toggle
              - type: custom:button-card
                template: v3_xs_button
                entity: script.cadmium_displays_off
                name: Displ. off
                icon: mdi:monitor-off
                tap_action:
                  action: toggle
              - type: custom:button-card
                template: v3_xs_button
                entity: script.cadmium_refresh
                name: Refresh
                icon: mdi:refresh
                tap_action:
                  action: toggle

          - type: vertical-stack
            cards:
              - type: entities
                style:
                  "#states div": |
                    mini-graph-card {
                      margin: 0 -15px -15px
                    }

                entities:
                  - sensor.cadmium_uptime
                  - sensor.cadmium_idle_time
                  - type: custom:fold-entity-row
                    head:
                      type: custom:decluttering-card
                      template: percentage_card
                      variables:
                        - name: Memory
                        - entity: sensor.cadmium_memory_used_percent
                        - icon: mdi:memory
                        - orange: 70
                        - red: 85
                    entities:
                      - entity: sensor.cadmium_memory_used
                        name: Memory used
                      - entity: sensor.cadmium_memory_available
                        name: Memory available
                      - entity: sensor.cadmium_memory_total
                        name: Memory total

                  - type: custom:fold-entity-row
                    head:
                      type: custom:decluttering-card
                      template: percentage_card
                      variables:
                        - name: "C: Drive"
                        - entity: sensor.cadmium_c_usage
                        - icon: mdi:harddisk
                        - orange: 70
                        - red: 85
                    entities:
                      - entity: sensor.cadmium_c_used_space
                        name: "C: Drive used"
                      - entity: sensor.cadmium_c_free_space
                        name: "C: Drive available"
                      - entity: sensor.cadmium_c_total_space
                        name: "C: Drive total"
                  - type: custom:mini-graph-card
                    align_state: left
                    entities:
                      - color: var(--accent-color)
                        entity: sensor.cadmium_cpu_usage
                      - color: green
                        entity: sensor.cadmium_memory_used_percent
                    points_per_hour: 1
                    line_width: 3
                    hour24: true
                    hours_to_show: 24
                    group_by: hour
                    show:
                      fill: fade
                      icon: true
                      name: true
                      state: true
                      name_adaptive_color: false
                      labels: hover
                      legend: false
                    tap_action:
                      action: none
