-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdevice_card.yaml
225 lines (218 loc) · 7.16 KB
/
device_card.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
type: custom:button-card
entity: person.person_name
show_icon: false
name: Apple Iphone
styles:
card:
- border-radius: 20px
- border-style: none
- box-shadow: 0px 0px 10px -9px black
custom_fields:
icon_cells:
- justify-self: start
- margin-top: 12px
- margin-left: 15px
devices:
- justify-self: end
- margin-right: 8px
- margin-top: '-17px'
temp:
- justify-self: start
- margin-left: 12px
- margin-top: '-4px'
- padding-bottom: 5%
sec_title:
- justify-self: start
- font-size: 10px
- margin-left: 12px
- margin-top: 2px
- filter: opacity(40%)
icon:
- width: 25px
- color: auto
name:
- font-size: 90%
- font-weight: bold
- justify-self: start
- margin-top: 6px
- margin-left: 12px
grid:
- grid-template-areas: '"icon_cells devices" "n n" "sec_title sec_title" "temp temp"'
- grid-template-columns: 1fr min-content
- grid-template-rows: 1fr min-content min-content
custom_fields:
sec_title: |
[[[
return `<span>Owner Name</span>
`
]]]
icon_cells: |
[[[
return `<ha-icon
icon="ssb:iphone-mobile"
style="width: 25px; height: 25px; color: auto;">
</ha-icon>
`
]]]
devices: |
[[[
var codeBlk = "";
if (states['person.person_name'].state != 'home')
codeBlk = codeBlk + " " + `<ha-icon
icon="ssb:away"
style="width: 13px; height: 13px; color: #CF0A0A;">
</ha-icon>
`;
if (states['sensor.iphone_connection_type'].state != 'Wi-Fi')
codeBlk = codeBlk + " " + `<ha-icon
icon="ssb:signal"
style="width: 13px; height: 13px; color: #BD4291;">
</ha-icon>
`;
else
codeBlk = codeBlk + " " + `<ha-icon
icon="ssb:wifi"
style="width: 13px; height: 13px; color: #BD4291;">
</ha-icon>
`;
var icon_battery = "ssb:battery-v2-slash";
var battery_level = states['sensor.iphone_battery_level'].state;
var charge_state = states['sensor.iphone_battery_state'].state;
if (charge_state != 'Not Charging') icon_battery = "ssb:battery-v2-charging";
else if(battery_level <= 20 ) icon_battery = "ssb:battery-v2-low";
else if(battery_level > 20 && battery_level < 40) icon_battery = "ssb:battery-v2-1";
else if(battery_level > 40 && battery_level < 60) icon_battery = "ssb:battery-v2-2";
else if(battery_level > 60 && battery_level < 80) icon_battery = "ssb:battery-v2-3";
else if(battery_level => 80) icon_battery = "ssb:battery-v2-full";
codeBlk = codeBlk + " " + `<ha-icon
icon=${icon_battery}
style="width: 14px; height: 14px; color: auto;">
</ha-icon><span style="font-size:65%; font-weight: normal; text-align: center;">
${battery_level}%</span>
`;
return codeBlk;
]]]
temp:
card:
type: custom:button-card
styles:
card:
- border-style: none
- background-color: transparent
- padding-right: 10px
- margin-bottom: '-10px'
grid:
- grid-template-areas: '"storage steps distance"'
- grid-template-columns: min-content min-content
- grid-template-rows: 1fr
custom_fields:
icon:
- margin-top: 1px
custom_fields:
storage:
card:
type: custom:button-card
styles:
card:
- border-radius: 7px
- border-style: none
- background-color: var(--secondary-background-color)
- margin-top: 10px
- padding-left: 10px
- padding-right: 10px
- padding-bottom: 5px
grid:
- grid-template-areas: '"icon value"'
- grid-template-columns: min-content min-content
- grid-template-rows: 1fr
custom_fields:
icon:
- margin-top: 0px
value:
- margin-top: '-1px'
custom_fields:
value: |
[[[
return `
<span style="font-size:60%; font-weight: normal; text-align: center;">
${states['sensor.iphone_storage'].state}%</span>`
]]]
icon: |
[[[
return `<ha-icon
icon="ssb:storage"
style="width: 12px; height: 12px; color: auto;">
</ha-icon>`
]]]
steps:
card:
type: custom:button-card
styles:
card:
- border-radius: 7px
- border-style: none
- background-color: var(--secondary-background-color)
- margin-top: 10px
- margin-left: 3px
- padding-left: 10px
- padding-right: 10px
- padding-bottom: 5px
grid:
- grid-template-areas: '"icon value"'
- grid-template-columns: min-content min-content min-content
- grid-template-rows: 1fr
custom_fields:
icon:
- margin-top: 1px
value:
- margin-top: '-0px'
custom_fields:
value: |
[[[
return `
<span style="font-size:60%; font-weight: normal; text-align: center;">
${states['sensor.iphone_steps'].state}</span>`
]]]
icon: |
[[[
return `<ha-icon
icon="ssb:steps"
style="width: 12px; height: 12px; color: auto;">
</ha-icon>`
]]]
distance:
card:
type: custom:button-card
styles:
card:
- border-radius: 7px
- border-style: none
- background-color: var(--secondary-background-color)
- margin-top: 10px
- margin-left: 6px
- padding-left: 10px
- padding-right: 10px
- padding-bottom: 5px
grid:
- grid-template-areas: '"icon value"'
- grid-template-columns: min-content min-content
- grid-template-rows: 1fr
custom_fields:
icon:
- margin-top: 0px
value:
- margin-top: '-2.5px'
custom_fields:
value: |
[[[
return `
<span style="font-size:60%; font-weight: normal; text-align: center;">
${states['sensor.iphone_distance'].state}</span>`
]]]
icon: |
[[[
return `<ha-icon
icon="ssb:distant"
style="width: 12px; height: 12px; color: auto;">
</ha-icon>`
]]]