diff --git a/.HA_VERSION b/.HA_VERSION index b4bba13..c50e97c 100644 --- a/.HA_VERSION +++ b/.HA_VERSION @@ -1 +1 @@ -2024.12.5 \ No newline at end of file +2025.1.4 \ No newline at end of file diff --git a/automations/automations_light_scenes.yaml b/automations/automations_light_scenes.yaml index 2bc258a..c5bd67c 100644 --- a/automations/automations_light_scenes.yaml +++ b/automations/automations_light_scenes.yaml @@ -1,9 +1,9 @@ -- id: 'lights-tripleclick-scenes' - alias: YAML lights scenes on triple click - description: "Automates lights scenes triggered on switch triple-click" +- id: 'light-tripleclick' + alias: YAML actions on light switch triple click + description: "Automates actions triggered on light switch triple-click" variables: switches: !include ../entities/light_tripleclick_switches.yaml - scenes: !include ../entities/light_tripleclick_scenes.yaml + actions: !include ../entities/light_tripleclick_scenes.yaml # TODO rename to actions trigger: - platform: state entity_id: !include ../entities/light_tripleclick_switches.yaml @@ -18,8 +18,8 @@ continue_on_timeout: false - delay: milliseconds: 500 - - service: scene.turn_on + - action: "{{ actions[switches.index(trigger.entity_id)]['action'] }}" target: - entity_id: "{{ scenes[switches.index(trigger.entity_id)] }}" + entity_id: "{{ actions[switches.index(trigger.entity_id)]['target'] }}" mode: single max_exceeded: silent diff --git a/automations/automations_light_switches.yaml b/automations/automations_light_switches.yaml index 3f236fa..ce5a997 100644 --- a/automations/automations_light_switches.yaml +++ b/automations/automations_light_switches.yaml @@ -11,6 +11,8 @@ condition: - condition: template # automate only if initial light and switch states match value_template: "{{ states(lights[switches.index(trigger.entity_id)]) == trigger.from_state.state }}" + - condition: template # keep only on/off states, drop unavailable and unknown + value_template: "{{ trigger.to_state.state == 'on' or trigger.to_state.state == 'off' }}" action: - service: "{{ 'light.turn_on' if(trigger.to_state.state == 'on') else 'light.turn_off' }}" target: @@ -28,6 +30,8 @@ condition: - condition: template # automate only if initial switch and light states match value_template: "{{ states(switches[lights.index(trigger.entity_id)]) == trigger.from_state.state }}" + - condition: template # keep only on/off states, drop unavailable and unknown + value_template: "{{ trigger.to_state.state == 'on' or trigger.to_state.state == 'off' }}" action: - service: "{{ 'switch.turn_on' if(trigger.to_state.state == 'on') else 'switch.turn_off' }}" target: diff --git a/configuration.yaml b/configuration.yaml index 4ef3527..d65ad90 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -30,11 +30,12 @@ automation manual: !include_dir_merge_list automations/ script: !include scripts.yaml -scene ui: !include scenes.yaml +#scene ui: !include scenes.yaml scene manual: !include_dir_merge_list scenes/ homeassistant: external_url: !secret external_url + customize: !include configuration/customize.yaml http: use_x_forwarded_for: true @@ -68,6 +69,7 @@ input_select: - "Radio FM" - "Network" - "Bluetooth" + - "TV" # pc_power_mode: # name: "PC power mode" # options: diff --git a/configuration/customize.yaml b/configuration/customize.yaml new file mode 100644 index 0000000..4136e52 --- /dev/null +++ b/configuration/customize.yaml @@ -0,0 +1,28 @@ +# Add an entry for each entity that you want to overwrite +light.bedroom_ceiling: + icon: 'mdi:ceiling-light' +light.balcony_bamboo: + icon: 'mdi:lamp' +#light.hall_wardrobe_tmp: +light.living_room_sofa: + icon: 'mdi:ceiling-light' +light.living_room_table: + icon: 'mdi:ceiling-light' +light.kitchen_countertop: + icon: 'mdi:led-strip' +light.bathroom_ceiling: + icon: 'mdi:wall-sconce-flat' +light.bathroom_mirror: + icon: 'mdi:spotlight' +light.balcony_ceiling: + icon: 'mdi:wall-sconce-flat' +light.bedroom_reading_left: + icon: 'mdi:track-light' +light.bedroom_reading_right: + icon: 'mdi:track-light' +light.wardrobe_ceiling: + icon: 'mdi:wall-sconce-flat' +light.wardrobe_clothes: + icon: 'mdi:led-strip' +light.hall_entrance: + icon: 'mdi:wall-sconce-flat' diff --git a/configuration/template.yaml b/configuration/template.yaml index 94b3e53..1666150 100644 --- a/configuration/template.yaml +++ b/configuration/template.yaml @@ -98,7 +98,7 @@ - name: "PC is active" unique_id: "pc_is_active" state: > - {{ states('sensor.pc_cpuload') != 'unavailable' }} + {{ states('sensor.pc_cpuload') != 'unavailable' and (now() - states.sensor.pc_cpuload.last_changed).total_seconds() < 300 }} # {{ states('sensor.pc_kamil_active_ratio') | float(0) > 0 }} # - name: "Shower" # icon: "mdi:shower-head" diff --git a/entities/light_tripleclick_scenes.yaml b/entities/light_tripleclick_scenes.yaml index 95ab895..5e682e9 100644 --- a/entities/light_tripleclick_scenes.yaml +++ b/entities/light_tripleclick_scenes.yaml @@ -1,6 +1,14 @@ -- scene.lights_on -- scene.lights_focus -- scene.lights_cooking -- scene.lights_dinner -- scene.lights_evening -- scene.lights_off +- action: scene.turn_on + target: scene.lights_on +- action: scene.turn_on + target: scene.lights_focus +- action: scene.turn_on + target: scene.lights_cooking +- action: scene.turn_on + target: scene.lights_dinner +- action: scene.turn_on + target: scene.lights_evening +- action: scene.turn_on + target: scene.lights_off +- action: cover.toggle + target: cover.curtains diff --git a/entities/light_tripleclick_switches.yaml b/entities/light_tripleclick_switches.yaml index 8289b65..626df6f 100644 --- a/entities/light_tripleclick_switches.yaml +++ b/entities/light_tripleclick_switches.yaml @@ -4,3 +4,4 @@ - switch.living_room_l4 - switch.living_room_l5 - switch.living_room_l6 +- switch.wardrobe diff --git a/entities/lights.yaml b/entities/lights.yaml index fbe3dd8..6f8a6ff 100644 --- a/entities/lights.yaml +++ b/entities/lights.yaml @@ -1,5 +1,5 @@ - light.hall_rail_entrance -- light.kitchen_spot +- light.kitchen_spots - light.kitchen_countertop - light.living_room_table - light.living_room_sofa diff --git a/scenes/scenes_lights.yaml b/scenes/scenes_lights.yaml index 13643ce..2e09267 100644 --- a/scenes/scenes_lights.yaml +++ b/scenes/scenes_lights.yaml @@ -2,9 +2,9 @@ name: Lights On icon: mdi:lightbulb-multiple entities: - light.hall_rail_entrance: + light.hall_entrance: state: 'on' - light.kitchen_spot: + light.kitchen_spots: state: 'on' switch.outlet_kitchen_hood: state: 'on' @@ -39,7 +39,7 @@ light.kitchen_countertop: state: 'on' brightness: 220 - light.kitchen_spot: + light.kitchen_spots: state: 'on' brightness: 150 color_temp_kelvin: 3500 @@ -69,17 +69,13 @@ light.balcony_bamboo: state: 'on' brightness: 40 - light.balcony_ceiling: - state: 'on' - brightness: 80 - color_temp_kelvin: 3500 switch.outlet_kitchen_hood: state: 'on' - id: 'yaml_lights_cooking' name: Cooking icon: 'mdi:chef-hat' entities: - light.kitchen_spot: + light.kitchen_spots: state: 'on' brightness: 60 color_temp_kelvin: 3000 @@ -104,7 +100,7 @@ name: Dinner icon: 'mdi:silverware' entities: - light.kitchen_spot: + light.kitchen_spots: state: 'on' brightness: 30 color_temp_kelvin: 2500 @@ -143,9 +139,9 @@ name: Evening icon: 'mdi:clock-time-eleven-outline' entities: - light.hall_rail_entrance: + light.hall_entrance: state: 'off' - light.kitchen_spot: + light.kitchen_spots: state: 'on' brightness: 10 color_temp_kelvin: 2000