Skip to content

Power Outlet Card #1

Visualization

Swiss Army Knife Functional Card Power Outlet1 D06 Light Off Swiss Army Knife Functional Card Power Outlet1 D06 Light On
Swiss Army Knife Functional Card Power Outlet1 D06 Dark Off Swiss Army Knife Functional Card Power Outlet1 D06 Dark On

This card uses the Material 3 theme D06, TealBlue

Description Aspect Ratio Target Size
A card that controls the on/off state of a power outlet, but also displays the power value.
Both using a segmented arc and as state.
3/1 Grid with 2 columns
SAK Tool Used for
Circle The half circle, as the left part of the circle is cutoff by the card. Animated, state dependent
Icon Entity Icon. Animated, state dependent
Name Name of Entity
State Secondary Info of entity
Line Vertical line separator
SegArc Half segmented arc showing the sensors state with 4 colors
State Entity State
Switch Switch to indicate and control the state. Animated, state dependent

Interaction

Part Description
Switch Toggles the power switch
Card All tools connected to an entity do show by default the "more-info" dialog once clicked

Usage

1.0.0-rc.3

Replace example entities with your entities!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
- type: 'custom:swiss-army-knife-card'
  entities:
    - entity: sensor.washingmachine_energy_power
      name: 'PwrOutl #1'
    - entity: sensor.washingmachine_energy_power
      secondary_info: last_changed
      format: relative
    - entity: switch.washingmachine_energy
      name: 'Air'
  layout:
    template:
      name: sak_layout_fce_power_outlet1
      variables:
        - sak_layout_power_outlet_segarc_scale_max_watt: 200
Data Default Required Description
entities The single entity on the card
sak_layout_power_outlet_segarc_scale_max_watt 200 The max value of the scale

YAML Template Definition

1.0.0-rc.3

Full definition of layout template
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  sak_layout_fce_power_outlet1:
  template:
    type: layout
    defaults: 
      - sak_layout_power_outlet_segarc_scale_max_watt: 200
  layout:
    aspectratio: 3/1
    toolsets:
      # ================================================================
      - toolset: half-circle
        position:
          cx: 0                             # Center on cards border 
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: circle
            position:
              cx: 50
              cy: 50
              radius: 48
            styles:
              circle:
                fill: none
                stroke: var(--theme-sys-color-secondary)
                stroke-width: 3em
                opacity: 0.5

      # ================================================================
      - toolset: column-icon
        position:
          cx: 25
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: icon
            position:
              cx: 50
              cy: 50
              align: center
              icon_size: 30
            entity_index: 0
            styles:
              icon:
                fill: var(--theme-sys-color-secondary)

      # ================================================================
      - toolset: column-name
        position:
          cx: 120
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: name
            position:
              cx: 50
              cy: 50
            entity_index: 0
            styles:
              name:
                text-anchor: middle
                font-size: 25em
                font-weight: 700
                opacity: 1
          # ------------------------------------------------------------
          - type: state
            position:
              cx: 50
              cy: 80
            entity_index: 1
            show:
              uom: none
            styles:
              state:
                text-anchor: middle
                font-size: 14em
                font-weight: 500
                opacity: 0.7

      # ================================================================
      - toolset: line1
        position:
          cx: 200                           # On 1/3 of card width
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: line
            position:
              cx: 50
              cy: 50
              orientation: vertical
              length: 50
            styles:
              line:
                fill: var(--primary-text-color)
                opacity: 0.5

      # ================================================================
      - toolset: column-power
        position:
          cx: 250
          cy: 50
        tools:
          # ------------------------------------------------------------------------
          - type: state
            position:
              cx: 50
              cy: 50
            entity_index: 0
            styles:
              state:
                text-anchor: middle
                font-size: 20em
                font-weight: 700
                fill: var(--primary-text-color)
              uom:
                fill: var(--primary-text-color)
                font-weight: 700

          # ------------------------------------------------------------------------
          - type: 'segarc'
            position:
              cx: 50
              cy: 50
              start_angle: -90                            # Arc clockwise from
              end_angle: 90                               # -90 to 90 degrees
              width: 6
              radius: 40                                # Radius on 100x100 grid
            entity_index: 0
            scale:
              min: 0
              max: '[[sak_layout_power_outlet_segarc_scale_max_watt]]'
              width: 6
              offset: 12
            show:
              scale: false                              # Disable scale of segarc
              style: 'colorlist'
            segments:
              colorlist:
                gap: 1                                  # Gap between segments
                colors:
                  - var(--theme-sys-palette-primary50)  # Use 4 system palette
                  - var(--theme-sys-palette-primary45)  # colors that adhere
                  - var(--theme-sys-palette-primary40)  # to light and dark
                  - var(--theme-sys-palette-primary35)  # theme modes!
            styles:
              foreground:
                fill: darkgrey
              background:
                fill: var(--theme-sys-elevation-surface-neutral4)
                opacity: 1

      # ================================================================
      - toolset: switch
        position:
          cx: 250                           # On 1/3 of card width
          cy: 80
          scale: 3
        tools:
          # ------------------------------------------------------------
          - type: switch
            position:
              cx: 50
              cy: 50
            entity_index: 2
            user_actions:
              tap_action:
                haptic: light
                actions:
                  - action: call-service
                    service: switch.toggle
Back to top