I tried to change to verticla-stack as matt did. But something wierd is happening.
The sidebar has no styles, the buttons appear not on the bottom and the cards from “wohnzimmer” are gone.
ui-lovelace.yaml
- type: vertical-stack
view_layout:
grid-area: sidebar
cards:
- type: custom:button-card
entity: sensor.template_sidebar
template: sidebar_template
- type: grid
cards:
- type: button
icon: mdi:lightning-bolt
tap_action: !include popup/sidebar_batterie.yaml
hold_action:
action: none
- type: button
icon: mdi:information-outline
tap_action: !include popup/sidebar_information.yaml
hold_action:
action: none
- type: button
icon: mdi:arrow-up-bold-circle-outline
tap_action: !include popup/sidebar_update.yaml
hold_action:
action: none
template.yaml
template:
####################################################
# #
# TEMPLATE #
# #
####################################################
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 = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'] %}
{%- set months = ['Januar', 'Februar', '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 -%}
</b></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 <= 7 %} Guten Morgen {{'\U0001F4A9'}}
{% elif time <= 9 %} Guten Morgen {{'\u2615\uFE0F'}}
{% elif time <= 10 %} Guten Morgen {{'\U0001F642'}}
{% elif time <= 13 %} Guten Tag {{'\U0001F60A'}}
{% elif time <= 15 %} Guten Tag {{'\U0001F60E'}}
{% elif time <= 17 %} Guten Tag {{'\U0001F44B\U0001F3FB'}}
{% 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>
active: |
<b>
{% set lights = [
states.light.wohnzimmer_licht,
states.light.kueche_licht,
states.light.kueche_licht_speis,
states.light.kueche_licht_spuele,
states.light.schlafzimmer_licht,
states.light.wohnzimmer_licht_tv,
states.switch.garage_licht
] %}
{% set switches = [
states.switch.werkstatt_makitaladegeraet,
states.switch.kueche_licht,
states.media_player.wohnzimmer_tv
] %}
{% 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 > 0) %}
{{ switches_name | regex_replace(',([^,]*)
button-card-templates.yaml
sidebar_template:
show_state: false
show_icon: false
tap_action:
action: none
name: |
[[[
if (entity) {
let attributes = '';
for (const [key, value] of Object.entries(entity.attributes)) {
value != false ? attributes += `<p>${value}</p>` : null;
}
return attributes;
}
]]]
extra_styles: |
#card {
padding: 0;
}
#container {
display: flex !important;
}
#name {
padding: 1.8vw 2.5vw 0 var(--custom-layout-card-padding);
white-space: normal;
text-align: left;
}
.time {
font-family: SF Text;
font-size: var(--sidebar-time-font-size);
font-weight: 200;
line-height: var(--sidebar-time-line-height);
letter-spacing: -0.05vw;
margin-left: -0.3vw;
color: rgba(255, 255, 255, 0.8);
}
.time-colon {
position: relative;
top: -.09em;
}
p {
font-family: SF Display;
font-size: var(--sidebar-font-size);
line-height: var(--sidebar-line-height);
font-weight: 300;
letter-spacing: 0.06vw;
color: #6a7377;
}
p > b {
color: rgba(255, 255, 255, 0.8);
}
/* portrait */
@media screen and (max-width: 1200px) {
.time {
font-size: calc(var(--sidebar-time-font-size) * 1.4 );
line-height: calc(var(--sidebar-time-line-height) * 1.4 );
}
p {
font-size: calc(var(--sidebar-font-size) * 1.4 );
line-height: calc(var(--sidebar-line-height) * 1.4 );
}
}
/* phone */
@media screen and (max-width: 800px) {
.time {
font-size: calc(var(--sidebar-time-font-size) * 2.6 );
}
p {
font-size: calc(var(--sidebar-font-size) * 2.6 );
line-height: calc(var(--sidebar-line-height) * 2.6 );
letter-spacing: 0.16vw;
}
#name {
padding: 0 0 0 1vw;
}
}