Hab dazu auch mal was eigenes erstellt:
image.png
Beispiel für eine Zeile:
Hab decluttering_templates genutzt um den Code kompakter zu halten und später einfacher Werte anpassen zu können.
image.png
Beispiel für eine Zeile:
Code:
- type: custom:stack-in-card
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 70% 10% 10% 10%
grid-template-areas: |
"name card1 card2 light"
cards:
- type: custom:decluttering-card
template: room_template
variables:
- name: Essen und Wohnen
- temperatur_sensor: sensor.eg_wohnzimmer_temperatur
- luftfeuchtigkeit_sensor: sensor.eg_wohnzimmer_abs_luftfeuchtigkeit
- navigation_path: eg
- icon: mdi:sofa
- type: custom:decluttering-card
template: conditional_room_template
- type: custom:decluttering-card
template: window_room_template
variables:
- entity: binary_sensor.eg_essen_und_wohnen_fenster
- type: custom:decluttering-card
template: light_template
variables:
- entity: light.eg_essen_und_wohnen_lichter
- layout: card
Hab decluttering_templates genutzt um den Code kompakter zu halten und später einfacher Werte anpassen zu können.
Code:
decluttering_templates:
light_template:
card:
type: custom:state-switch
entity: template
template: '{{ "row" if "[[layout]]" == "row" else "card" }}'
states:
row:
type: custom:template-entity-row
entity: '[[entity]]'
name: '[[name]]'
icon: >
{% if is_state('[[entity]]', 'on') %} mdi:lightbulb-on {% else %}
mdi:lightbulb {% endif %}
toggle: true
color: |
{% if is_state('[[entity]]', 'on') %} #FFC107 {% endif %}
active: '{{ is_state(''[[entity]]'', ''on'') }}'
card:
type: custom:mushroom-template-card
entity: '[[entity]]'
icon: >
{% if is_state('[[entity]]', 'on') %} mdi:lightbulb-on {% else %}
mdi:lightbulb {% endif %}
icon_color: '{{ ''#FFC107'' if is_state(''[[entity]]'', ''on'') }}'
tap_action: none
card_mod:
style: |
ha-card {
border: none;
height: 35px !important;
}
view_layout:
grid-area: light
room_template:
card:
type: custom:mushroom-template-card
primary: '[[name]]'
secondary: >-
{% set temp = states('[[temperatur_sensor]]') | float(0) %} {% set
humidity = states('[[luftfeuchtigkeit_sensor]]') | float(0) %} {% if
'[[luftfeuchtigkeit_sensor]]' != '' %}
🌡️ {{ temp | round(1) }} °C | 💧 {{ humidity | round(1) }} g/m³
{% elif '[[temperatur_sensor]]' != '' %}
🌡️ {{ temp | round(1) }} °C
{% else %} {% endif %}
icon: '[[icon]]'
icon_color: blue
tap_action:
action: navigate
navigation_path: '[[navigation_path]]'
card_mod:
style: |
ha-card {
border: none;
height: 35px !important;
margin-top: 5px;
}
view_layout:
grid-area: name
window_room_template:
default:
- grid-area: card2
card:
type: custom:mushroom-chips-card
chips:
- type: conditional
conditions:
- entity: '[[entity]]'
state: 'on'
chip:
type: template
icon: mdi:window-open-variant
icon_color: blue
card_mod:
style: |
ha-card {
border: none;
height: 35px !important;
--chip-icon-size: 28px;
}
card_mod:
style: |
ha-card {
height: 35px !important;
}
view_layout:
grid-area: '[[grid-area]]'
conditional_room_template:
card:
type: custom:mushroom-chips-card
chips:
- type: conditional
conditions:
- entity: '[[entity]]'
state: 'on'
chip:
type: template
icon: '[[icon]]'
icon_color: '[[icon_color]]'
card_mod:
style: |
ha-card {
border: none;
--chip-icon-size: 28px;
height: 35px !important;
}
card_mod:
style: |
ha-card {
height: 35px !important;
}
view_layout:
grid-area: card1


Kommentar