-
Notifications
You must be signed in to change notification settings - Fork 0
/
mushroom light card template
202 lines (202 loc) · 6.02 KB
/
mushroom light card 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
---
button_card_templates:
mushroom_card:
show_state: true
hold_action:
action: more-info
custom_fields:
notification: |
[[[
if (entity.state =="unavailable"){
return `<ha-icon icon="mdi:exclamation" style="width: 12px; height: 12px; color: var(--primary-background-color);"></ha-icon>`
}
]]]
state:
- value: unavailable
id: unavail
styles:
custom_fields:
notification:
- border-radius: 50%
- position: absolute
- left: 24px
- top: '-2px'
- height: 16px
- width: 16px
- border: 2px solid var(--card-background-color)
- font-size: 12px
- line-height: 14px
- background-color: |
[[[
return "rgba(var(--color-red),1)";
]]]
styles:
card:
- padding: 12px
- '--mdc-ripple-press-opacity': 0
grid:
- grid-template-areas: '"i n" "i s"'
- grid-template-columns: min-content 1fr
- grid-template-rows: min-content min-content
img_cell:
- background-color: rgba(var(--rgb-primary-text-color), 0.05)
- border-radius: var(--icon-border-radius)
- border-radius: 50%
- place-self: flex-start
- width: 42px
- height: 42px
- margin-right: 12px
icon:
- color: var(--disabled-text-color)
- width: 20px
- height: 20px
name:
- justify-self: flex-start
- align-self: center
- font-size: 14px
- font-weight: bold
- color: var(--primary-text-color)
state:
- justify-self: flex-start
- align-self: center
- font-weight: bolder
- font-size: 12px
- color: rgb(114,114,114)
mushroom_timer:
template: mushroom_card
variables:
input_datetime_id: ''
styles:
grid:
- grid-template-areas: '"i n time_input" "i s time_input"'
- grid-template-columns: min-content 1fr min-content
- grid-template-rows: min-content min-content
state:
- value: idle
operator: '!='
styles:
img_cell:
- background-color: rgba(139,195,74,0.2)
icon:
- color: rgb(139 195 74)
custom_fields:
time_input:
- display: none
tap_action:
action: call-service
service: '[[[ return (entity.state =="idle") ? "timer.start" : "timer.cancel" ]]]'
service_data: |
[[[
var obj = { entity_id: entity.entity_id };
if (entity.state =='idle')
obj.duration = states[variables.input_datetime_id].state ;
return obj;
]]]
custom_fields:
time_input:
card:
type: entities
entities:
- entity: '[[[ return variables.input_datetime_id ]]]'
card_mod:
style:
.: |
ha-card {
background-color: transparent !important;
box-shadow: none !important;
}
'#states': |
#states { padding:0; }
#states> div { margin:0; }
'#states hui-input-datetime-entity-row':
$:
hui-generic-entity-row:first-of-type:
$: |
state-badge, div.info.pointer.text-content {
display:none;
}
mushroom_button:
variables:
color: var(--primary-text-color)
background_color: rgba(var(--rgb-primary-text-color), 0.05)
styles:
card:
- box-shadow: none
- min-width: 42px
- height: 42px
- padding: 0
- border-radius: 12px
- background-color: '[[[ return variables.background_color ]]]'
- color: '[[[ return variables.color ]]]'
name:
- font-weight: bold
icon:
- width: 20px
- color: '[[[ return variables.color ]]]'
mushroom_light_ctrl:
show_name: false
show_icon: false
tap_action:
action: navigate
styles:
card:
- box-shadow: none
- margin: 12px 0 0 0
- padding: 0
- border-radius: 0
- '--mdc-ripple-press-opacity': 0
grid:
- grid-template-areas: '"btn_less btn_more"'
- grid-template-rows: min-content
custom_fields:
btn_less:
card:
type: custom:button-card
template: mushroom_button
name: '-'
variables:
background_color: >-
[[[ return (entity.state!="heat") ? "rgb(213 235 254)" : "rgb(255,
221, 211)" ]]]
color: >-
[[[ return (entity.state!="heat") ? "rgb(43,154,249)" : "rgb(255,
87, 34)" ]]]
tap_action:
action: call-service
service: light.turn_on
service_data:
entity_id: '[[[ return entity.entity_id ]]]'
brightness_step_pct: -20
btn_more:
card:
type: custom:button-card
template: mushroom_button
name: +
variables:
background_color: >-
[[[ return (entity.state!="heat") ? "rgb(213 235 254)" : "rgb(255,
221, 211)" ]]]
color: >-
[[[ return (entity.state!="heat") ? "rgb(43,154,249)" : "rgb(255,
87, 34)" ]]]
tap_action:
action: call-service
service: light.turn_on
service_data:
entity_id: '[[[ return entity.entity_id ]]]'
brightness_step_pct: 20
mushroom_light:
template: mushroom_card
tap_action:
action: toggle
hold_action:
action: more-info
styles:
grid:
- grid-template-columns: min-content 1fr
custom_fields:
tmp_ctrl:
card:
type: custom:button-card
template: mushroom_light_ctrl
entity: '[[[ return entity.entity_id ]]]'