-
Notifications
You must be signed in to change notification settings - Fork 10
/
ultrasync_alarm.yaml
202 lines (186 loc) · 5.13 KB
/
ultrasync_alarm.yaml
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
---
#
# A custom card for UltraSync Alarm
#
# Source: https://github.com/caronc/ha-ultrasync
#
# This card requires that you've pre-installed the resources:
# - layout-card: https://github.com/thomasloven/lovelace-layout-card
# - button-card: https://github.com/custom-cards/button-card
#
#
type: custom:layout-card
# Define a 4x2 grid
layout: grid
gridrows: auto auto
gridcols: auto auto auto auto
cards:
- type: custom:button-card
name: 'Home Alarm'
show_state: true
color_type: icon
# | x | x | x | |
# | x | x | x | |
gridcol: 1 / span 3
gridrow: 1 / span 2
style: |
ha-card {
box-shadow: none;
}
entity: sensor.ultrasync_area1state
tap_action:
action: >
[[[
if (entity.state.startsWith("Armed") || entity.state.includes("Delay") || entity.state.includes("Alarm"))
return "call-service";
else
return "none";
]]]
service: ultrasync.disarm
icon: >
[[[
if (entity.state.includes("Ready"))
return "mdi:shield-home-outline";
else if (entity.state.startsWith("Armed"))
return "mdi:shield-lock";
else if (entity.state.includes("Delay"))
return "mdi:shield-home";
else if (entity.state.includes("Fire"))
return "mdi:fire-alert";
else if (entity.state.includes("Medical"))
return "mdi:ambulance";
else if (entity.state.includes("Alarm"))
return "mdi:shield-alert";
else if (entity.state.includes("Low Battery"))
return "mdi:battery-low";
else if (entity.state.includes("Sensor"))
return "mdi:alert-circle";
else // Unknown
return "mdi:lock-question";
]]]
styles:
state:
- font-weight: bold
- font-size: 1.2em
icon:
- color: >
[[[
if (entity.state == "Ready")
return "#00a30e"; // Green
else if (entity.state.startsWith("Not Ready"))
return "#c7a600"; // Orange
else if (entity.state.startsWith("Armed"))
return "#9e0000"; // Red
else if (entity.state.includes("Delay"))
return "#c7a600"; // Orange
else if (entity.state.includes("Alarm"))
return "#9e0000"; // Red
else if (entity.state.includes("Sensor"))
return "#c7a600"; // Orange
else
return "#005f9e"; // Blue
]]]
card:
- animation: >
[[[
if (entity.state.includes("Delay") || entity.state.includes("Alarm"))
return "blink 2s ease infinite";
else
return undefined;
]]]
- type: custom:button-card
name: 'Stay'
tooltip: 'Set Alarm in Stay/Night mode.'
color_type: icon
# | | | | x |
# | | | | |
gridcol: 4
gridrow: 1
style: |
ha-card {
box-shadow: none;
height: 100%;
}
entity: sensor.ultrasync_area1state
tap_action:
action: >
[[[
if (entity.state == "Ready")
return "call-service";
else
return "none";
]]]
service: ultrasync.stay
icon: >
[[[
if (entity.state.includes("Armed Stay"))
return "mdi:shield-check";
else if (entity.state.includes("Delay"))
return "mdi:shield-lock";
else
return "mdi:shield-half-full";
]]]
styles:
icon:
- color: >
[[[
if (entity.state == "Ready")
return "#005f9e"; // Blue
else
return undefined;
]]]
- filter: >
[[[
if (entity.state != "Ready")
return "grayscale(100%)";
else
return "grayscale(0)";
]]]
- type: custom:button-card
name: 'Away'
tooltip: 'Set Alarm in Away mode.'
color_type: icon
# | | | | |
# | | | | x |
gridcol: 4
gridrow: 2
style: |
ha-card {
box-shadow: none;
height: 100%;
}
entity: sensor.ultrasync_area1state
tap_action:
action: >
[[[
if (entity.state == "Ready")
return "call-service";
else
return "none";
]]]
service: ultrasync.away
icon: >
[[[
if (entity.state.includes("Armed Away"))
return "mdi:shield-check";
else if (entity.state.includes("Delay"))
return "mdi:shield-lock";
else
return "mdi:shield";
]]]
styles:
icon:
- color: >
[[[
if (entity.state == "Ready")
return "#005f9e"; // Blue
else
return undefined;
]]]
- filter: >
[[[
if (entity.state != "Ready")
return "grayscale(100%)";
else
return "grayscale(0)";
]]]