Hi,
here the code but I’m still on testing or better playing.
The states are for a quickview …
- sensor:
- unique_id: sidebar_time
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'>
{% if strptime(states('sensor.date'), '%Y-%m-%d').day != None %}
{% set days = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'] %}
{% set months = ['Januar', 'Feber', 'März', 'April', 'Mai', 'Juni',
'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'] %}
{{ days[now().weekday()] }}<br>
{{ strptime(states('sensor.date'), '%Y-%m-%d').day }} {{ months[now().month-1] }}
{% endif %}
</font>
greet: >
<b>
{% set time = now().hour %}
{% if time <= 1 %} Gute Nacht {{'\U0001F611'}}
{% elif time <= 3 %} Gute Nacht {{'\U0001F62A'}}
{% elif time <= 5 %} Gute Nacht {{'\U0001F634'}}
{% elif time <= 9 %} Guten Morgen {{'\U0001F642'}}
{% elif time <= 11 %} Guten Tag {{'\U0001F60E'}}
{% elif time <= 13 %} Mahlzeit {{'\U0001F60A'}}
{% elif time <= 18 %} Guten Tag {{'\U0001F60E'}}
{% elif time <= 19 %} Guten Abend {{'\U0001F44B\U0001F3FB'}}
{% elif time <= 22 %} Guten Abend {{'\U0001F60C'}}
{% elif time <= 23 %} Guten Abend {{'\U0001F974'}}
{% else %} Guten Abend {{'\U0001F974'}}
{% endif %}
</b>
weather: >
{% set temperature = states('sensor.openweathermap_feels_like_temperature') %}
{% set temperaturemax = states('sensor.openweathermap_forecast_temperature') %}
{% set temperaturecondition = states('weather.openweathermap') %}
{% set apparent = states('sensor.openweathermap_feels_like_temperature') | round %}
{% set precip = states('sensor.openweathermap_forecast_precipitation') | round %}
{% if not is_state('sensor.openweathermap_temperature', 'unknown') %}
{% if temperature | float(default=0) <= 0.0 %}
{{ apparent }}° / {{ (temperaturemax) | round }}° {% if precip | float(default=0) != 0 %} {{ precip }}% {{'\u2744\uFE0F'}} {% endif %}<br />{{ temperaturecondition }}
{% elif temperature | float(default=0) > 0.0 %}
{{ apparent}}° / {{ (temperaturemax) | round }}° {% if precip | float(default=0) != 0 %}{{ precip }}% {{ '\u2614\uFE0F' if precip == 0 }}{% endif %}<br />{{ temperaturecondition }}
{% endif %}
{% else %}
Kann die Wetterinformationen nicht lesen...
{% endif %}
- unique_id: sidebar
state: template
attributes:
transport: >
<br style="clear:both; height: 5px;">
Work: {{ states('sensor.work') }}<br>
VS Markt: {{ states('sensor.vsmarkt') }}<br>
IT: {{ states('sensor.milano') }}<br>
IRR: {{ states('sensor.irr') }}
couldtakethebike: >
{% set rain = states('sensor.openweathermap_forecast_precipitation') | round %}
{% if rain <= 20 %}
<div style='background:#333; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:bike"></ha-icon></div>
{% else %}
<div style='background:rgb(139, 51, 51); color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 30px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:bicycle"></ha-icon></div>
<div style='display:none;background:rgb(139, 51, 51); color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:bike-fast"></ha-icon></div>
{% endif %}
waste_collection: |
<br style="clear:both;"><br>
{%- set start_time = state_attr('calendar.ics', 'start_time') %}
{%- set end_time = state_attr('calendar.ics', 'end_time') %}
{%- set abfall = state_attr('calendar.ics', 'message') %}
{%- if start_time != None %}
{%- set time = as_timestamp(start_time) | timestamp_custom('%H:%M') %}
{%- set time_end = as_timestamp(end_time) | timestamp_custom('%H:%M') %}
{%- set hours = as_timestamp(start_time) | timestamp_custom('%H') | int(default=0) / 24 %}
{%- set count = (as_timestamp(start_time) - as_timestamp(now())) / 86400 - hours %}
<ha-icon icon="mdi:delete-empty" style="width:24px;"></ha-icon>
{%- if count <= 0.0 %}
<b>Heute ist {{ abfall | replace('Abfuhr: ', '') }}.</b>
{% elif count <= 1.0 %}
Morgen ist {{ abfall | replace('Abfuhr: ', '') }}.
{%- else %}
In {{ (count + hours) | round }} Tagen ist {{ abfall | replace('Abfuhr: ', '') }}.
{%- endif %}
{%- endif %}
active: >
{% set lights = [
states.switch.shelly_shsw_l_84cca8a76843,
states.switch.shelly_shsw_25_c45bbe75a525_1,
states.switch.shelly_shsw_l_e8db84ab0fbf,
states.switch.shelly_shsw_l_84cca8ae345e,
states.switch.shelly_shsw_l_84cca8ad1f3d,
states.switch.shelly_shsw_l_84cca8accb43,
states.switch.shelly_shsw_25_c45bbe756dca_1,
states.switch.shelly_shsw_l_8caab56187b6,
states.light['0008da498fd781'],
states.switch['00089be9a169b4']
] %}
{% set lights_on = lights | selectattr('state','eq','on') | list %}
{% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
{% if (lights_on | length >= 1) %}
<div style='background:#C7983E; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:lightbulb"></ha-icon></div>
{% else %}
<font color='#6a7377'></font>
{% endif %}
active2: >
{% set devices = [
states.switch.imac,
states.media_player.the_frame,
states.media_player.beam,
states.media_player.terrasse,
states.media_player.kinderzimmer,
states.media_player.buro_2,
states.media_player.buro,
states.media_player.enigma,
states.media_player.spotify
] %}
{% set devices_on = devices | selectattr('state','search','(on|cool|fan_only|playing)') | list %}
{% set devices_name = devices_on | map(attribute='name') | join(', ') %}
{% if (devices_on | length >= 1) %}
<div style='background:#333; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:speaker"></ha-icon></div>
{% else %}
<font color='#6a7377'></font>
{% endif %}
window: >
{% set window = [
states.binary_sensor['burofenster_access_control_window_door_is_open'],
states.binary_sensor['schlafzimmerre_access_control_window_door_is_open'],
states.binary_sensor['schlafzimmerfensterli_access_control_window_door_is_open'],
states.binary_sensor['kinderzimmerfenster_access_control_window_door_is_open_2'],
states.binary_sensor['wcfenster_access_control_window_door_is_open'],
states.binary_sensor['0000dd89b24e98_state'],
states.binary_sensor['0000dd89b23193_state'],
states.binary_sensor['0000dd89b24284_state']
] %}
{% set window_on = window | selectattr('state','search','(on)') | list %}
{% set window_name = window_on | map(attribute='name') | join(', ') %}
{% if (window_on | length == 0) %}
{{ window_name | regex_replace(',([^,]*)$',' och\\1') }}
{% elif (window_on | length >= 1) %}
<div style='background:rgb(139, 51, 51); color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:door-open"></ha-icon></div>
<p style="display:none">{{ window_name }}</p>
{% else %}
<font color='#6a7377'>Alles zu</font>
{% endif %}
switch: >
{% set switch = [
states.switch.shelly_shsw_25_c45bbe756dca_2,
states.binary_sensor['meine_waschmaschine'],
states.sensor['geschirrspuler_status'],
states.fan.pure_cool_link,
states.binary_sensor['meq1007743_1'],
states.switch.ikea_of_sweden_tradfri_control_outlet_27804cfe_on_off
] %}
{% set switches_on = switch | selectattr('state','search','(on|In Betrieb|cool|fan_only|playing)') | list %}
{% set switches_name = switches_on | map(attribute='name') | join(', ') %}
{% if (switches_on | length == 0) %}
<div style='display:none;background:olive; color: #fff; padding: 10px; width: 100px;text-align:center; border-radius: 10px;'>Aus</div>
{{ switches_name | regex_replace(',([^,]*)$',' och\\1') }}
{% elif (switches_on | length >= 1) %}
<div style='background:#666; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:power-plug"></ha-icon></div>
<p style="display:none">{{ switches_name }}</p>
{% else %}
<font color='#6a7377'>Alles aus</font>
{% endif %}
persons: >
{% set persons = [
states.person.caroline,
states.person.sascha
] %}
{% set persons_on = persons | selectattr('state','search','(on|home)') | list %}
{% set persons_name = persons_on | map(attribute='name') | join(', ') %}
{% if (persons_on | length == 1) %}
<div style='background:olive; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:account"></ha-icon></div>
{% elif (persons_on | length == 2) %}
<div style='background:olive; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:account-multiple"></ha-icon></div>
{% elif (persons_on | length >= 3) %}
<div style='background:olive; color: #fff;padding:7px;width:25px;height:25px;margin:0 5px 5px 0;text-align:center; border-radius: 50%;float:left;'><ha-icon icon="mdi:account-group"></ha-icon></div>
{% else %}
{% endif %}