-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbutton_action.yaml
More file actions
181 lines (178 loc) · 4.97 KB
/
Copy pathbutton_action.yaml
File metadata and controls
181 lines (178 loc) · 4.97 KB
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
####{ CreativeBC }####| Action Button |####[ github.com/wfurphy/creative-button-card-templates ]####>
# @ignore Changes v0.3.0 `(mix|max)-(height|width)` style changes
button_action:
template:
- cbcjs
- state_helper
- style_helper
- dynamic_icons
- resizable
- interactive
variables:
off_hide_info: false
icon: mdi:play
icon_on: mdi:stop
name_on: "Cancel"
timer:
name_timer:
min_height: 55px
show_state: true
show_name: true
show_label: true
show_last_changed: true
name: Start
tap_action:
action: >
[[[ return entity?.entity_id.includes('timer.') ? 'call-service' : 'toggle' ]]]
service: >
[[[ return entity?.state == 'active' ? 'timer.cancel' : 'timer.start' ]]]
service_data:
entity_id: >
[[[ return entity?.entity_id ]]]
haptic: success
double_tap_action:
action: call-service
haptic: success
service: timer.cancel
service_data:
entity_id: "[[[ return variables.timer ]]]"
hold_action:
action: more-info
haptic: success
state:
- id: cbc_action_timer
operator: template
value: >
[[[
return entity?.entity_id.includes('timer.') && entity.state == 'active'
]]]
icon: "[[[ return variables.icon_on ]]]"
name: "[[[ return variables.name_on ]]]"
styles:
grid:
- grid-template-areas: '"i s" "i n"'
name:
- font-size: 12px
- justify-self: start
- align-self: start
- text-align: left
- color: var(--accent-color)
state:
- font-size: 16.8px
- justify-self: start
- align-self: end
- opacity: 1
- display: block
icon:
- color: var(--accent-color)
label:
- display: none
custom_fields:
loadicon:
- display: block
- id: cbc_on
name: "[[[ return variables.name_on ]]]"
label: Something
styles:
icon:
- color: var(--accent-color)
name:
- color: var(--accent-color)
label:
- display: "[[[ return variables.timer && states[variables.timer].state == 'active' ? 'none' : 'block' ]]]"
custom_fields:
loadicon:
- display: block
styles:
grid:
- grid-template-areas: >
[[[ return variables.timer && states[variables.timer].state == 'active' ? '"i n" "i timer"' : '"i n" "i l"' ]]]
- grid-template-columns: 50px auto
- grid-template-rows: 1fr 1fr
- justify-items: start
- align-items: center
card:
- padding: 2px
- align-items: center
icon:
- justify-self: center
- align-self: center
- overflow: visible
- width: 30px
- color: var(--paper-item-icon-color)
name:
- justify-self: start
- align-self: end
- text-align: left
label:
- font-size: 12px
- justify-self: start
- align-self: start
- text-align: left
- display: >
[[[ return variables.timer && states[variables.timer].state == 'active' ? 'none' : 'block' ]]]
state:
- font-size: 12px
- justify-self: start
- align-self: start
- text-align: left
- display: none
custom_fields:
loadicon:
- position: absolute
- align-self: center
- justify-self: start
- width: 35px
- margin-left: 9px
- opacity: 0.6
- display: none
timer:
- justify-self: start
- justify-text: left
- display: none
- display: >
[[[ return variables.timer && states[variables.timer].state == 'active' ? 'block' : 'none' ]]]
custom_fields:
loadicon: >
[[[ return html`<ha-icon id="cbc-loading" rotating icon="mdi:loading"></ha-icon>` ]]]
timer:
force_recreate: true
card:
type: custom:button-card
template:
- transparent
- no_actions
entity: "[[[ return variables.timer ]]]"
icon: mdi:timer-outline
label: Double Tap<br>Stop Timer
show_name: false
show_state: true
show_label: true
size: 20px
styles:
card:
- height: 25px
- padding: 0
grid:
- grid-template-areas: '"i s l"'
- grid-template-columns: 20px auto auto
- grid-template-rows: auto
- align-items: start
- justify-items: start
- padding: 0
state:
- justify-self: end
- align-self: center
- justify-text: right
- opacity: 1
- font-size: 16px
- margin-left: 5px
label:
- justify-self: start
- align-self: center
- justify-text: left
- opacity: 1
- color: var(--accent-color)
- font-size: 9px
- margin-left: 10px
#########################################################################/