Sensor:
Ilość zapalonych świateł w danym pomieszczeniu
sensors:
kuchnia_lights_on:
friendly_name: "Kuchnia Lights On"
value_template: >
{% set lights = [
states.light.tx_ultimate_tx_ultimate_l1,
states.light.kuchnia_rgbw,
states.light.tx_ultimate_tx_ultimate_l2,
states.light.tx_ultimate_tx_ultimate_l3,
states.light.okap_lights,
states.light.test_light,
states.light.szafki,
states.light.pir_lights,
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
Inny sensor
platform: template
sensors:
aktywne_oswietlenie:
value_template: >-
{% set lights = [states.light.downlight_z_komputer, states.switch.sw_kuchnia, states.light.led_board_4_1, states.switch.gniazdko_z_korytarz_left,
states.switch.psw2, states.light.led_board_3, states.light.kuchnia_rgbw, states.switch.psw3, states.switch.psw1, states.light.downlight_z_lazienka] %}
{% 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)%}
{{ lights_name }} jest włączone
{% elif (lights_on | length >1 )%}
{{ lights_on | length}} lights are on
{% else %}
Wszystko Wyłączone
{% endif %}
Tu masz kilka przykładów jak utrzymać porządek w pliku confirguration.yaml
https://forum.arturhome.pl/t/porzadki-w-configuration-yaml/6306
Zastosowanie Packages
https://forum.arturhome.pl/t/package-w-home-assistant/707
Przykład:
######## INCLUDES ########
group: !include groups.yaml
automation: !include automations.yaml
#automation yaml: !include_dir_merge_list automations
sensor: !include_dir_merge_list sensors/
script: !include scripts.yaml
script yaml: !include_dir_merge_named scripts
input_select: !include input_select.yaml
#input_boolean: !include_dir_named input_boolean/
input_boolean: !include input_boolean.yaml
#input_number: !include_dir_named input_number/
input_number: !include input_number.yaml
scene: !include scenes.yaml
template: !include_dir_merge_list templates
shell_command: !include_dir_named shell/
#rest_command: !include rest_command.yaml
#zakres logów
system_log: !include system_log.yaml
#logbook: !include logging/logbook.yaml
logger: !include logging/logger.yaml
recorder: !include logging/recorder.yaml
mqtt: !include mqtt_include.yaml