Here you go;
- 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 = ['Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag'] %}
{% set months = ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni',
'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'] %}
{{ 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 %} Welteruste {{'\U0001F611'}}
{% elif time <= 3 %} Welteruste {{'\U0001F62A'}}
{% elif time <= 5 %} Welteruste {{'\U0001F634'}}
{% elif time <= 7 %} Goeie merge {{'\U0001F4A9'}}
{% elif time <= 9 %} Goeie merge {{'\u2615\uFE0F'}}
{% elif time <= 10 %} Goeie merge {{'\U0001F642'}}
{% elif time <= 13 %} Goeiendag {{'\U0001F60A'}}
{% elif time <= 15 %} Goeiendag {{'\U0001F60E'}}
{% elif time <= 17 %} Goeiendag {{'\U0001F44B\U0001F3FB'}}
{% elif time <= 19 %} Goeie navond {{'\U0001F44B\U0001F3FB'}}
{% elif time <= 22 %} Goeie navond {{'\U0001F60C'}}
{% elif time <= 23 %} Goeie navond {{'\U0001F974'}}
{% else %} Goeie navond {{'\U0001F974'}}
{% endif %}
</b>
weather: >
<b>
{% set entity = 'weather.slingerwood' %}
{% if not is_state(entity, 'unknown') %}
{% set temp = state_attr(entity, 'temperature') | round %}
{% set precip = state_attr(entity, 'forecast')[0]['precipitation'] | round %}
Voelt als {{ temp }}°, {{ 'geen kans op regen' if precip == 0
else precip | string + 'mm regen \u2614\uFE0F' }}
{% else %}
Kan het weer niet laden...
{% endif %}
</b>
active: >
{% set lights = [
states.light.kitchen_lights,
states.light.wall_light_1,
states.light.wall_light_2,
states.light.bathroom_lights,
states.light.lights_hallway_downstairs,
states.light.lights_hallway_upstairs_1,
states.light.lights_hallway_upstairs_2,
states.light.outside_lights_front,
states.light.outside_lights_back,
states.light.outside_lights_path,
states.light.outside_lights_driveway,
] %}
{% set devices = [
states.switch.ps5_542_power,
states.switch.vaatwasser_power,
states.media_player.cc_ut_rooie_kontgat,
states.media_player.sony_tv_3,
] %}
{% 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 > 0) %}
{{ devices_name | regex_replace(',([^,]*)$',' en\\1') }} staan aan
{% elif (lights_on | length == 1) and (devices_on | length == 1) %}
{{ lights_name }} en {{devices_name }} staan aan
{% elif (lights_on | length == 1) and (devices_on | length > 1) %}
{{ lights_name }}, {{ devices_name | regex_replace(',([^,]*)$',' och\\1') }} staan aan
{% elif (lights_on | length > 1) and (devices_on | length == 1) %}
{{ lights_on | length }} lampen en {{ devices_name }} staan aan
{% elif (lights_on | length > 1) and (devices_on | length > 1) %}
{{ lights_on | length }} lampen, {{ devices_name | regex_replace(',([^,]*)$',' en\\1') }} staan aan
{% elif (lights_on | length == 1) and (devices_on | length == 0) %}
{{ lights_name }} staan aan
{% elif (lights_on | length > 1) and (devices_on | length == 0) %}
{{ lights_on | length }} lampen staan aan
{% else %}
<font color='#6a7377'>Alles is uitgeschakeld</font>
{% endif %}
calendar: >
{{state_attr('calendar.gezin', 'start_time')}}
{{state_attr('calendar.gezin', 'message')}}