-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsidebar.yaml
140 lines (127 loc) · 6.86 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
- 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 != null %}
{%- 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()] }}<br>
{{- strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
{%- endif -%}
</b></font>
greet: |
<b>
{%- set time = now().hour %}
{%- if time <= 1 -%} Bonne nuit {{'\U0001F611'}}
{%- elif time <= 3 -%} Bonne nuit {{'\U0001F62A'}}
{%- elif time <= 5 -%} Bonne nuit {{'\U0001F634'}}
{%- elif time <= 7 -%} Bonjour {{'\U0001F4A9'}}
{%- elif time <= 9 -%} Bonjour {{'\u2615\uFE0F'}}
{%- elif time <= 10 -%} Bonjour {{'\U0001F642'}}
{%- elif time <= 13 -%} Bonne journée {{'\U0001F60A'}}
{%- elif time <= 15 -%} Bonne journée {{'\U0001F60E'}}
{%- elif time <= 17 -%} Bonne journée {{'\U0001F44B\U0001F3FB'}}
{%- elif time <= 19 -%} Bonne soirée {{'\U0001F44B\U0001F3FB'}}
{%- elif time <= 22 -%} Bonne soirée {{'\U0001F60C'}}
{%- elif time <= 23 -%} Bonne soirée {{'\U0001F974'}}
{%- else %} Bonne soirée {{'\U0001F974'}}
{%- endif -%}
</b>
weather: |
{% if not state_attr('weather.villeneuve_d_ascq', 'temperature') == 'unavailable' %}
{% set temperature = state_attr('weather.villeneuve_d_ascq', 'temperature') %}
{% set precip = states('sensor.villeneuve_d_ascq_rain_chance') %}
{% set snow = states('sensor.villeneuve_d_ascq_snow_chance') %}
{% set weather_state = states('weather.villeneuve_d_ascq')
| replace('rainy', 'Pluvieux')
| replace('partlycloudy', 'Partiellement nuageux')
| replace('cloudy', 'Nuageux')
| replace('clear-night', 'Nuit claire')
| replace('fog', 'Brumeux')
| replace('hail', 'Grêleux')
| replace('lightning-rainy', 'Orageux')
| replace('lightning', 'Orageux')
| replace('pourring', 'Pluie intense')
| replace('snowy-rainy', 'Neigeux')
| replace('snowy', 'Neigeux')
| replace('sunny', 'Ensoleillé')
| replace('windy-variant', 'Variblement venteux')
| replace('windy', 'Venteux')
| replace('exceptional', 'Exceptionel') %}
{% if not state_attr('weather.villeneuve_d_ascq', 'temperature') == 'unknown' %}
{% if temperature | float <= 0.0 %}
{{ weather_state }}, il fait {{ temperature }}° avec {{ snow }}% de risque de neige. {{'\u2744\uFE0F' if precip | round > 30 }}
{% if not states('sensor.average_temperature') == 'unavailable' %}
Il fait {{ states('sensor.average_temperature') | round}}°C dans la maison.
{% endif %}
{% elif temperature | float > 0.0 %}
{{ weather_state }}, il fait {{ temperature }}° avec {{ precip | round }}% de risque de pluie. {{ '\u2614\uFE0F' if precip | round > 30 }}
{% if not states('sensor.average_temperature') == 'unavailable' %}
Il fait {{ states('sensor.average_temperature') | round}}°C dans la maison.
{% endif %}
{% endif %}
{% else %}
Pas d'information métérologique...
{% endif %}
{% endif %}
active: |
{%- set lights = [
states.light.salon_1,
states.light.salon_2,
states.light.plafond_1,
states.light.plafond_2,
states.light.yeelight_stripe,
states.light.lampe_japonaise,
] %}
{%- set switches = [
states.switch.computer_papa,
states.switch.computer_rig_kaoru,
] %}
{%- set lights_on = lights | selectattr('state','eq','on') | list %}
{%- set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
{%- set switches_on = switches | selectattr('state','eq','on') | list %}
{%- set switches_name = switches | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
{%- if (lights_on | length == 0) and (switches_on | length > 1) -%}
{{ switches_name | regex_replace(',([^,]*)$',' et\\1') }} allumés
{%- elif (lights_on | length == 0) and (switches_on | length == 1) -%}
{{ switches_name | regex_replace(',([^,]*)$',' et\\1') }} allumé
{%- elif (lights_on | length == 1) and (switches_on | length > 1) -%}
{{ lights_name }} et {{switches_name }} allumés
{%- elif (lights_on | length == 1) and (switches_on | length > 1) -%}
{{ lights_name }}, {{ switches_name | regex_replace(',([^,]*)$',' et\\1') }} allumés
{%- elif (lights_on | length > 1) and (switches_on | length == 1) -%}
{{ lights_on | length }} lampes et {{ switches_name }} sont allumés
{%- elif (lights_on | length > 1) and (switches_on | length > 1) -%}
{{ lights_on | length }} lampes, {{ switches_name | regex_replace(',([^,]*)$',' et\\1') }} allumés
{%- elif (lights_on | length == 1) and (switches_on | length == 0) -%}
{{ lights_name }} est allumée
{%- elif (lights_on | length > 1) and (switches_on | length == 0) -%}
{{ lights_on | length }} sont allumées
{%- else %}
<font color='#6a7377'>Tout est éteint</font>
{%- endif -%}
battery: |
{% set entities = [
'sensor.battery_chambre_papa',
'sensor.battery_thermometre_cuisine',
'sensor.battery_chambre_william',
'sensor.battery_thermometre_salon',
'sensor.battery_salle_de_bain',
'sensor.battery_switch_1',
'sensor.battery_switch_2',
'sensor.battery_switch_3' ] %}
{%- for sensor in entities if states(sensor) != 'unknown' and states(sensor) | float <= 5 %}
{%- if loop.first %} {{-'\u26A0\uFE0F'}} Batterie {{-' \u26A0\uFE0F'}} {% else %}, {% endif -%}
{{ state_attr(sensor, 'friendly_name') + ': ' + states(sensor) + '%' }}
{%- endfor %}
google_home_timer: |
{{ states("sensor.next_timer_human") }}