@@ -3,6 +3,7 @@ title: Afvalophaling Custom-card
3
3
hide :
4
4
- toc
5
5
---
6
+
6
7
<!-- markdownlint-disable MD046 -->
7
8
8
9
# Custom-card "Afvalophaling"
@@ -29,16 +30,16 @@ Initial release
29
30
## Usage
30
31
31
32
``` yaml
32
- - type : ' custom:button-card'
33
- template :
34
- - card_afvalophaling
35
- variables :
36
- ulm_card_ophaling_vandaag : ' sensor.limburg_net_afvalophaling_vandaag'
37
- ulm_card_ophaling_morgen : " sensor.limburg_net_afvalophaling_morgen"
38
- ulm_card_datum_gft : " sensor.limburg_net_afvalophaling_gft"
39
- ulm_card_datum_pmd : " sensor.limburg_net_afvalophaling_pmd"
40
- ulm_card_datum_rest : " sensor.limburg_net_afvalophaling_restafval"
41
- ulm_card_datum_papier : " sensor.limburg_net_afvalophaling_papier"
33
+ - type : " custom:button-card"
34
+ template :
35
+ - card_afvalophaling
36
+ variables :
37
+ ulm_card_ophaling_vandaag : " sensor.limburg_net_afvalophaling_vandaag"
38
+ ulm_card_ophaling_morgen : " sensor.limburg_net_afvalophaling_morgen"
39
+ ulm_card_datum_gft : " sensor.limburg_net_afvalophaling_gft"
40
+ ulm_card_datum_pmd : " sensor.limburg_net_afvalophaling_pmd"
41
+ ulm_card_datum_rest : " sensor.limburg_net_afvalophaling_restafval"
42
+ ulm_card_datum_papier : " sensor.limburg_net_afvalophaling_papier"
42
43
` ` `
43
44
44
45
## Requirements
@@ -92,151 +93,8 @@ Integration from HACS: "Home-Assistant-Sensor-Afvalbeheer" from pippyn
92
93
</tr>
93
94
</table>
94
95
95
- ## Template code
96
+ ??? note " Template Code"
96
97
97
- ` ` ` yaml
98
- ---
99
- card_afvalophaling :
100
- template :
101
- - " ulm_language_variables"
102
- - " icon_info_afvalophaling"
103
- - " custom_colors"
104
- triggers_update : " all"
105
- icon : " mdi:delete"
106
- name : >
107
- [[[
108
- if(states[variables.ulm_card_ophaling_vandaag].state !=='Geen' || states[variables.ulm_card_ophaling_morgen].state !=='Geen'){
109
- return variables.ulm_ophaling
110
- } else {
111
- return variables.ulm_volgende_ophaling
112
- }
113
- ]]]
114
- label : |
115
- [[[
116
- var glas = ''
117
- if(variables.ulm_card_datum_glas){
118
- var glas = "Glas " + ' • ' + states[variables.ulm_card_datum_glas].state + '<br>'
119
- }
120
- var pmd = ''
121
- if(variables.ulm_card_datum_pmd){
122
- var pmd = "PMD " + ' • ' + states[variables.ulm_card_datum_pmd].state + '<br>'
123
- }
124
- var gft = ''
125
- if(variables.ulm_card_datum_gft){
126
- var gft = "GFT " + ' • ' + states[variables.ulm_card_datum_gft].state + '<br>'
127
- }
128
- var rest = ''
129
- if(variables.ulm_card_datum_rest){
130
- var rest = "Restafval " + ' • ' + states[variables.ulm_card_datum_rest].state + '<br>'
131
- }
132
- var papier = ''
133
- if(variables.ulm_card_datum_papier){
134
- var papier = "Papier " + ' • ' + states[variables.ulm_card_datum_papier].state + '<br>'
135
- }
136
- if(states[variables.ulm_card_ophaling_vandaag].state !=='Geen'){
137
- return states[variables.ulm_card_ophaling_vandaag].state
138
- }
139
- if(states[variables.ulm_card_ophaling_morgen].state !=='Geen'){
140
- return states[variables.ulm_card_ophaling_morgen].state
141
- } else {
142
- return rest + papier + pmd + gft + glas
143
- }
144
- ]]]
145
- custom_colors :
146
- state :
147
- - styles :
148
- icon :
149
- - color : " rgba(var(--color-green),1)"
150
- img_cell :
151
- - background-color : " rgba(var(--color-green), 0.2)"
152
- value : >
153
- [[[
154
- return states[variables.ulm_card_ophaling_vandaag].state !== "Geen" || states[variables.ulm_card_ophaling_morgen].state !== "Geen"
155
- ]]]
156
- icon : " mdi:recycle"
157
- operator : " template"
158
- - styles :
159
- icon :
160
- - color : " rgba(var(--color-blue),1)"
161
- img_cell :
162
- - background-color : " rgba(var(--color-blue), 0.2)"
163
- value : >
164
- [[[
165
- return states[variables.ulm_card_ophaling_vandaag].state === "glas" || states[variables.ulm_card_ophaling_morgen].state === "glas"
166
- ]]]
167
- icon : " mdi:bottle-wine-outline"
168
- operator : " template"
169
- icon_info_afvalophaling :
170
- color : " var(--google-grey)"
171
- show_icon : " true"
172
- show_label : " true"
173
- show_name : " true"
174
- state :
175
- - value : " unavailable"
176
- styles :
177
- icon :
178
- - color : " rgba(var(--color-red),1)"
179
- img_cell :
180
- - background-color : " rgba(var(--color-red), 0.2)"
181
- custom_fields :
182
- notification :
183
- - border-radius : " 50%"
184
- - position : " absolute"
185
- - left : " 42px"
186
- - top : " 10px"
187
- - height : " 16px"
188
- - width : " 16px"
189
- - font-size : " 12px"
190
- - line-height : " 14px"
191
- - background-color : >
192
- [[[
193
- return "rgba(var(--color-red),1)";
194
- ]]]
195
- styles :
196
- icon :
197
- - color : " rgba(var(--color-theme),0.2)"
198
- label :
199
- - justify-self : " start"
200
- - align-self : " start"
201
- - font-weight : " bold"
202
- - font-size : " 12px"
203
- - filter : " opacity(40%)"
204
- - margin-left : " 12px"
205
- - text-align : " start"
206
- name :
207
- - align-self : " end"
208
- - justify-self : " start"
209
- - font-weight : " bold"
210
- - font-size : " 14px"
211
- - margin-left : " 12px"
212
- - margin-bottom : " 4px"
213
- state :
214
- - justify-self : " start"
215
- - align-self : " start"
216
- - font-weight : " bold"
217
- - font-size : " 12px"
218
- - filter : " opacity(40%)"
219
- - margin-left : " 12px"
220
- img_cell :
221
- - background-color : " rgba(var(--color-theme),0.05)"
222
- - border-radius : " 50%"
223
- - place-self : " center"
224
- - width : " 42px"
225
- - height : " 42px"
226
- grid :
227
- - grid-template-areas : " 'i n' 'i l'"
228
- - grid-template-columns : " min-content auto"
229
- - grid-template-rows : " min-content min-content"
230
- card :
231
- - border-radius : " var(--border-radius)"
232
- - box-shadow : " var(--box-shadow)"
233
- - padding : " 12px"
234
- custom_fields :
235
- notification : >
236
- [[[
237
- if (states[variables.ulm_card_ophaling_vandaag].state =='unavailable' || states[variables.ulm_card_ophaling_morgen].state =='unavailable'){
238
- return `<ha-icon icon="mdi:help" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon>`
239
- }
240
- ]]]
241
- size : " 20px"
242
- ` ` `
98
+ ` ` ` yaml title="card_afvalophaling.yaml"
99
+ --8<-- "custom_cards/custom_card_afvalophaling/card_afvalophaling.yaml"
100
+ ```
0 commit comments