Skip to content

Airvisual Card #1

Visualization

Swiss Army Knife Functional AirVisual D06 Light
Swiss Army Knife Functional AirVisual D06 Dark

This card uses the Material 3 theme D06, TealBlue

Description Aspect Ratio Target Size
A card that displays data from AirVisual.
Both the current data, as a 24 hour history is shown
6/1 Grid with 1 column
SAK Tool Used for
Circle The half circle, as the left part of the circle is cutoff by the card. Circle is animated, state dependent
Icon Entity Icon.
Name Name of Entity
State Secondary Info of Entity
Line Vertical line as separator
Icon AirVisual state Icon. Animated, state dependent
State AirVisual state value
SegArc Segmented Arc showing the AirVisual state. The arc is configured as a very, very, very flat ellipse and using a tiny part of the ellipse to look like a line
Line Vertical line as separator
Text The "Last 24 hours" text
Bar The 24 hour history

Integrations

You need the AirVisual integration:

Interaction

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

Usage

1.0.0-rc.3

The entities should be the same for every installation, so you can re-use the example below!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
- type: 'custom:swiss-army-knife-card'
  entities:
    - entity: sensor.u_s_air_quality_index
      name: 'AirVisual #1'
    - entity: sensor.u_s_air_pollution_level
    - entity: sensor.u_s_air_quality_index
      secondary_info: last_changed
      format: relative
  layout:
    template:
      name: sak_layout_fce_airvisual1
Data Default Required Description
entities List of three entities

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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
sak_layout_fce_airvisual1:
  template:
    type: layout
    defaults: 
      - var_entity_index: 0
  layout:
    aspectratio: 6/1                          # Card is 600x100 grid
    styles:
      card:
    toolsets:
      # ================================================================
      - toolset: line1
        position:
          cx: 200
          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: line2
        position:
          cx: 400
          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: 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: 20em
                font-weight: 700
          # ------------------------------------------------------------
          - type: state
            position:
              cx: 50
              cy: 80
            entity_index: 2
            show:
              uom: none
            styles:
              state:
                text-anchor: middle
                font-size: 14em
                font-weight: 500
                opacity: 0.7

      - toolset: column-state
        position:
          cx: 300
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: icon
            position:
              cx: 25
              cy: 25
              align: end
              icon_size: 30
            entity_index: 1
            styles:
              icon:
                fill: var(--theme-sys-color-secondary)
          # ------------------------------------------------------------
          - type: state
            position:
              cx: 50
              cy: 25
            entity_index: 0
            styles:
              state:
                text-anchor: start
                font-size: 25em
                font-weight: 700
                fill: var(--primary-text-color)
              uom:
                fill: var(--primary-text-color)
                font-weight: 700

          # ------------------------------------------------------------ 
          - type: 'segarc'
            id: 0
            position:
              cx: 50
              cy: 70
              start_angle: 190
              end_angle: 170
              width: 8
              radius_x: 405         # 20 degrees = 1/9 = 45*9 = 405
              radius_y: 1
            entity_index: 0
            scale:
              min: 0
              max: 300
              width: 6
              offset: 12
            show:
              scale: true
              style: 'colorstops'
            segments:
              colorstops:
                gap: 0.1
                colors:
                  0: '#A8E05F'
                  51: '#FDD74B'
                  101: '#FE9B57'
                  151: '#FE6A69'
                  201: '#A97ABC'
                  301: '#A87383'
            styles:
              foreground:
                fill: darkgrey
              background:
                fill: var(--theme-sys-elevation-surface-neutral5)

      - toolset: column-history
        position:
          cx: 500
          cy: 50
        tools:
          # ------------------------------------------------------------
          - type: text
            position:
              orientation: vertical
              cx: 50
              cy: 20
            text: "Last 24 hours"
            styles:
              text:
                text-anchor: middle
                font-size: 15em
                font-weight: 700

          # ------------------------------------------------------------
          - type: bar
            id: 1
            entity_index: 0
            position:
              orientation: vertical
              cx: 50
              cy: 60
              width: 150
              height: 40
              margin: 1
            hours: 24
            barhours: 1
            show:
              style: 'colorstops'
            colorstops:
              fill: true
              colors:
                0: '#A8E05F'
                51: '#FDD74B'
                101: '#FE9B57'
                151: '#FE6A69'
                201: '#A97ABC'
                301: '#A87383'
            styles:
              bar:
                stroke-linecap: square