-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyaml-code-dumps.yaml
186 lines (158 loc) · 8.5 KB
/
yaml-code-dumps.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
{{ as_timestamp(states[config.entity].last_changed)|
timestamp_custom('%m/%d %H:%M') + " [" +
state_attr(config.entity, 'mac') + "]"}}
================================================
- type: markdown
content: >-
{% macro display_attributes(entity_id) %} {% set entity =
states[entity_id] %}### {{ entity_id }} {% if entity %} {% for
attr, value in entity.attributes.items() %}
{{ attr }}: {{ value }} {% endfor %} {% else %} Entity {{ entity_id }} not found. {% endif %} {% endmacro %}
{% set entities = ['sensor.darren_s_eight_sleep_side_bed_state',
'sensor.darren_s_eight_sleep_side_heart_rate'] %}
{% for entity_id in entities %}
{{ display_attributes(entity_id) }}
{% endfor %}
==================================================
- type: markdown
content: >-
# Integration List:
{% set devices = states | map(attribute='entity_id') |
map('device_id') | unique | reject('eq',None) | list %}
{%- set ns = namespace(integrations = []) %}
{%- for device in devices if device_attr(device, 'identifiers') %}
{%- set ids = device_attr(device, 'identifiers') | list | first %}
{%- if ids and ids | length == 2 %}
{%- set integration, something_unique = ids %}
{%- if integration not in ns.integrations %}
{%- set ns.integrations = ns.integrations + [ integration ] %}
{%- endif %}
{%- endif %}
{%- endfor %}
{% for integration in ns.integrations %}
{{integration}}: {{integration_entities(integration)|count }}
{% endfor %}
# Sorted Integration List by count:
{% set ns = namespace(items = []) %}
{% for item in states | map(attribute='entity_id')
| map('device_attr', 'identifiers') | reject('none')
| map('first') | select('defined')
| map(attribute='0') | unique %}
{% set entities = integration_entities(item) %}
{% set ns.items = ns.items + [ { 'integration': item, 'count': entities | count} ] %}
{% endfor %}
{{ ns.items | sort(attribute='count', reverse=true) }}
{% for integration in ns.items| sort(attribute='count', reverse=true)
%}
{{integration}}
{% endfor %}
- type: markdown
content: |-
{% set devices = states | map(attribute='entity_id')
| map('device_id') | unique
| reject('eq',None) | list %}
{% for device in devices %}
{{device_attr(device, 'manufacturer')}}
{{device_entities(device)}}
{% endfor %}
====================================================
cards:
- type: custom:mushroom-chips-card
chips:
- platform: template
sensors:
updates_pending:
friendly_name: Updates Pending
value_template: >-
{{ states.update | selectattr('state', 'eq', 'on') | list |
count }}
low_batt_devices:
friendly_name: Low Battery Devices
value_template: |-
{% set low_batt_device = states.sensor
| selectattr("entity_id", "search", ".*battery.*")
| rejectattr("entity_id", "search", ".*voltage.*")
| rejectattr("entity_id", "search", "sensor.body*")
| rejectattr("entity_id", "search", ".*ipad*")
| rejectattr("entity_id", "search", ".*iphone*")
| selectattr("state", 'is_number')
| map(attribute='state')
| sort(attribute='state', reverse=false)
| map('int')
| select("lessthan", 50)
| list %}
{{ low_batt_devices | count }}
- type: conditional
conditions:
- entity: sensor.low_batt_devices
state_not: '0'
chip:
type: template
content: |2
{% if states.sensor.low_batt_devices | int == 0 %}
keine.
{% elif states.sensor.low_batt_devices | int > 0 %}
{{ states.sensor.low_batt_devices | int }}.
{% endif %}
icon_color: red
icon: mdi:battery-alert-variant-outline
tap_action:
action: navigate
navigation_path: /lovelace-details/batteries
- type: conditional
conditions:
- entity: sensor.updates_pending
state_not: '0'
chip:
type: template
content: |-
{% if states.sensor.updates_pending | int == 0 %}
keins.
{% elif states.sensor.updates_pending | int > 0 %}
{{ states.sensor.updates_pending | int }} updates.
{% endif %}
icon: mdi:cellphone-arrow-down
icon_color: red
tap_action:
action: navigate
====================================================
Front: {{
(states.sensor.fordpass_tirePressure.attributes.FRONT_LEFT / 6.89)
| round(0) }} {{
(states.sensor.fordpass_tirePressure.attributes.FRONT_RIGHT /
6.89) | round(0) }}
Back: {{ (states.sensor.fordpass_tirePressure.attributes.REAR_LEFT / 6.89) | round(0) }} {{ (states.sensor.fordpass_tirePressure.attributes.REAR_RIGHT / 6.89) | round(0) }}
====================================================
- type: horizontal-stack
cards:
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.flightradar24_current_in_area
above: 0
card:
type: markdown
content: >-
<Table> {% set data =
state_attr('sensor.flightradar24_current_in_area',
'flights') %} {% for flight in data %}
<TR><TD><ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }}({{ flight.aircraft_registration }}) <br> {{ flight.airline_short }} - {{ flight.aircraft_model }} <br>
{{ flight.airport_origin_city }}{%if flight.airport_origin_city %}<img src="https://flagsapi.com/{{ flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/>{% endif %} -> {{ flight.airport_destination_city }}{%
if flight.airport_destination_country_code %}<img src="https://flagsapi.com/{{ flight.airport_destination_country_code }}/shiny/16.png" title='{{ flight.airport_destination_country_name }}'/>{% endif %}
<br>
{%if flight.time_scheduled_departure %}Departure - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }}; {% endif %}{%if flight.time_scheduled_arrival%}Arrival - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %} <br>
Altitude - {{ flight.altitude }} ft{%if flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}; Gr. speed - {{ flight.ground_speed }} kts{%if flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%}
</TD><TD>
{% if flight.aircraft_photo_small %}
<img src='{{flight.aircraft_photo_small}}'/>
{% endif %}
</TD></TR>
{% endfor %}
</TABLE>
visibility:
- condition: state
entity: sensor.flightradar24_current_in_area
state_not: ''
layout_options:
grid_columns: 6
grid_rows: auto