-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.yaml
175 lines (148 loc) · 8.57 KB
/
sidebar.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
- sensor:
- unique_id: sidebar
state: template
attributes:
time: >
{% set hours = now().strftime('%H') %}
{% set minutes = now().strftime('%M') %}
<span class="time">
{{ hours }}<span class="time-colon">:</span>{{ minutes }}
</span>
date: >
<font color='#6a7377'><b>
{% if strptime(states('sensor.date'), '%Y-%m-%d').day != None %}
{% set days = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'] %}
{% set months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
'Julliet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'] %}
{{ days[now().weekday()] }}
{{ strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
{% endif %}
</b>
</font>
active: >
{% set lights = [
states.switch.lumiere_salle_a_manger,
states.switch.guirlande
] %}
{% set devices = [
states.switch.ampli,
states.media_player.fire_tv_192_168_1_128,
states.media_player.tv_ambilight
] %}
{% set lights_on = lights | selectattr('state','eq','on') | list %}
{% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
{% set devices_on = devices | selectattr('state','search','(on|cool|fan_only|playing)') | list %}
{% set devices_name = devices_on | map(attribute='name') | join(', ') %}
{% if (lights_on | length == 0) and (devices_on | length == 1) %}
{{ devices_name | regex_replace(',([^,]*)$',' et\\1') }} est allumé
{% elif (lights_on | length == 0) and (devices_on | length > 1) %}
{{ devices_name | regex_replace(',([^,]*)$',' et\\1') }} sont allumés
{% elif (lights_on | length == 1) and (devices_on | length == 1) %}
{{ lights_name }} et {{devices_name }} sont allumés
{% elif (lights_on | length == 1) and (devices_on | length > 1) %}
{{ lights_name }}, {{ devices_name | regex_replace(',([^,]*)$',' et\\1') }} sont allumés
{% elif (lights_on | length > 1) and (devices_on | length == 1) %}
{{ lights_on | length }} lumières et {{ devices_name }} sont allumés
{% elif (lights_on | length > 1) and (devices_on | length > 1) %}
{{ lights_on | length }} lumières, {{ devices_name | regex_replace(',([^,]*)$',' et\\1') }} sont allumés
{% elif (lights_on | length == 1) and (devices_on | length == 0) %}
{{ lights_name }} est allumée
{% elif (lights_on | length > 1) and (devices_on | length == 0) %}
{{ lights_on | length }} lumières allumées
{% else %}
<font color='#6a7377'>Tout est éteint</font>
{% endif %}
laundry: |
{% set washing_machine_state = states('input_select.washing_machine_state') %}
{% if (washing_machine_state != 'Eteinte') %}
<ha-icon icon="mdi:washing-machine"></ha-icon> {{states('input_select.washing_machine_state')}}
{% endif %}
vacuum: >
{% set entity_id = 'vacuum.wall_e' %}
{% if is_state(entity_id, 'cleaning') %}
<ha-icon icon="cil:roborock-vacuum"></ha-icon> Wall-E passe l'aspirateur
{% elif is_state(entity_id, 'returning') %}
<ha-icon icon="cil:roborock-vacuum"></ha-icon> Wall-E a terminé
{% endif %}
covers: >
{% set covers = [states.cover.volet_fenetre_cuisine, states.cover.volet_porte_cuisine, states.cover.volet_salon_droite, states.cover.volet_salon_gauche, states.cover.volet_salle_a_manger, states.cover.volet_chambre_parents, states.cover.volet_chambre_d_amis, states.cover.volet_bureau, states.cover.volet_chambre_romain, states.cover.volet_chambre_valentine] %}
{% set covers_open = covers | selectattr('state','eq','open') | list %}
{% set covers_closed = covers | selectattr('state','eq','closed') | list %}
{% set covers_name = covers | selectattr('state','eq','open') | map(attribute='name') | join(', ') %}
{% if (covers_open | length == 0) %}
<ha-icon icon="hass:blinds"></ha-icon> fermés
{% elif (covers_open | length == 1) %}
<ha-icon icon="hass:blinds-open"></ha-icon> {{ covers_name | regex_replace(',([^,]*)$',' et\\1') }} est ouvert
{% elif (covers_open | length > 1) and (covers_open | length <= 9) %}
<ha-icon icon="hass:blinds-open"></ha-icon> {{ covers_open | length }} ouverts
{% elif (covers_open | length == 10) %}
<ha-icon icon="hass:blinds-open"></ha-icon> ouverts
{% endif %}
today: >
{% set time = ' 00:00:00' %}
{% set start = now().date() %}
{% set end = (start + timedelta(days=1)) ~ time %}
{% set start = start ~ time %}
{% set entities = states.calendar
| rejectattr('attributes.start_time', 'undefined')
| selectattr('attributes.start_time', '>=', start)
| rejectattr('attributes.end_time', '>', end) | list %}
{% for sensor in entities %}
{% if sensor.attributes.friendly_name == "Emploi du temps de Romain" -%}
{% else %}
{% if sensor.attributes.friendly_name == "Tri" -%}
<ha-icon icon="mdi:recycle"></ha-icon>
{% elif sensor.attributes.friendly_name == "Poubelles" -%}
<ha-icon icon="mdi:trash-can-outline"></ha-icon>
{% elif sensor.attributes.friendly_name == "Musique" -%}
<ha-icon icon="mdi:music-circle-outline"></ha-icon>
{% elif sensor.attributes.friendly_name == "Anniversaires des contacts" -%}
{% else %}
<ha-icon icon="hass:calendar-today"></ha-icon>
{% endif %}
{% if as_timestamp(sensor.attributes.start_time) | timestamp_custom('%H:%M') == '00:00' %}
{{ sensor.attributes.message }}
{% if (sensor.attributes.friendly_name == "Musique" or sensor.attributes.friendly_name == "Anniversaires des contacts") -%}
<br/>
{% else %}
(toute la journée)<br/>
{% endif %}
{% else %}
{{ as_timestamp(sensor.attributes.start_time) | timestamp_custom('%H:%M') }} {{ sensor.attributes.message }}<br/>
{% endif %}
{% endif %}
{% endfor %}
tomorrow: >
{% set time = ' 00:00:00' %}
{% set start = (now().date() + timedelta(days=1)) %}
{% set end = (start + timedelta(days=1)) ~ time %}
{% set start = start ~ time %}
{% set entities = states.calendar
| rejectattr('attributes.start_time', 'undefined')
| selectattr('attributes.start_time', '>=', start)
| rejectattr('attributes.end_time', '>', end) | list %}
{% if now().strftime('%T') > '17:30:00' %}
<font color='#6a7377'><b>Demain</b></font> <br/>
{% for sensor in entities %}
{% if sensor.attributes.friendly_name == "Tri" -%}
<ha-icon icon="mdi:recycle"></ha-icon> {{ sensor.attributes.message }}<br/>
{% elif sensor.attributes.friendly_name == "Poubelles" -%}
<ha-icon icon="mdi:trash-can-outline"></ha-icon> {{ sensor.attributes.message }}<br/>
{% elif sensor.attributes.friendly_name == "Musique" -%}
<ha-icon icon="mdi:album"></ha-icon> {{ sensor.attributes.message }}<br/>
{% elif sensor.attributes.friendly_name == "Anniversaires des contacts" -%}
{{ sensor.attributes.message }}<br/>
{% elif sensor.attributes.friendly_name == "Emploi du temps de Romain" -%}
{% else %}
{{ sensor.attributes.friendly_name }} : {{ sensor.attributes.message }}<br/>
{%- endif %}
{% endfor %}
{% endif %}
battery: >
{% set entities = states.sensor
| selectattr('entity_id', 'search', 'battery_level$')
| map(attribute = 'entity_id') | list %}
{% for sensor in entities if states(sensor) != 'unknown' and states(sensor) !=
'unavailable' and states(sensor) != 'None' and states(sensor) | int(default=0) <= 15 %}
{{'\u26A0\uFE0F'}} <ha-icon icon="mdi:battery-low"></ha-icon> {{ state_attr(sensor, 'friendly_name') }} {{ states(sensor) }}%<br/>
{% endfor %}