From 060a8f28fa1fc648bdf66afb31a5d1efac868837 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jul 2023 22:24:15 +0200 Subject: makefu: move out to own repo, add vacation-note --- makefu/2configs/home/ham/light/arbeitszimmer.nix | 33 --- makefu/2configs/home/ham/light/schlafzimmer.nix | 14 - .../2configs/home/ham/light/tint_arbeitszimmer.nix | 281 ------------------- makefu/2configs/home/ham/light/tint_wohnzimmer.nix | 300 --------------------- makefu/2configs/home/ham/light/wohnzimmer.nix | 56 ---- 5 files changed, 684 deletions(-) delete mode 100644 makefu/2configs/home/ham/light/arbeitszimmer.nix delete mode 100644 makefu/2configs/home/ham/light/schlafzimmer.nix delete mode 100644 makefu/2configs/home/ham/light/tint_arbeitszimmer.nix delete mode 100644 makefu/2configs/home/ham/light/tint_wohnzimmer.nix delete mode 100644 makefu/2configs/home/ham/light/wohnzimmer.nix (limited to 'makefu/2configs/home/ham/light') diff --git a/makefu/2configs/home/ham/light/arbeitszimmer.nix b/makefu/2configs/home/ham/light/arbeitszimmer.nix deleted file mode 100644 index 6e572c76..00000000 --- a/makefu/2configs/home/ham/light/arbeitszimmer.nix +++ /dev/null @@ -1,33 +0,0 @@ -let - arbeitszimmer_deko = [ - "light.led_wand" - "light.box_led_status" - "light.arbeitszimmer_led1_led_strip" # LED-Kreis in cube - ]; - arbeitszimmerbeleuchtung = [ - "light.arbeitszimmer_schrank_dimmer" - "light.arbeitszimmer_kerze" - "light.arbeitszimmer_pflanzenlicht" - ]; -in { - imports = [ ./tint_arbeitszimmer.nix ]; - - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Arbeitszimmerbeleuchtung"; - entities = arbeitszimmerbeleuchtung; - } - { - platform = "group"; - name = "Arbeitszimmer Deko"; - entities = arbeitszimmer_deko; - } - { platform = "switch"; - name = "Arbeitszimmer Pflanzenlicht"; - entity_id = "switch.arbeitszimmer_stecker1"; - } - ]; - services.home-assistant.config.automation = [ - ]; -} diff --git a/makefu/2configs/home/ham/light/schlafzimmer.nix b/makefu/2configs/home/ham/light/schlafzimmer.nix deleted file mode 100644 index e5370e3f..00000000 --- a/makefu/2configs/home/ham/light/schlafzimmer.nix +++ /dev/null @@ -1,14 +0,0 @@ -let - schlafzimmer_licht = [ - "light.schlafzimmer_komode_osram" - # "light.schlafzimmer_schrank_osram" - ]; -in { - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Schlafzimmerbeleuchtung"; - entities = schlafzimmer_licht; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix b/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix deleted file mode 100644 index 4ae91ac5..00000000 --- a/makefu/2configs/home/ham/light/tint_arbeitszimmer.nix +++ /dev/null @@ -1,281 +0,0 @@ -{ lib, ...}: - -let - # effect - color - # Solid Pattern - Hult - group_id_1 = 16388; - group_id_2 = 16389; - group_id_3 = 16390; - remote = "sensor.arbeitszimmer_remote1_action"; - main_light_1 = "light.wled_4"; - default_scene_1 = "Solid"; - default_color_1 = "Default"; - main_color_select_1 = "select.wled_color_palette_4"; - light_group_1.entity_id = [ - main_light_1 - ]; - - # contains only the actually changeable lights - light_group_2.entity_id = [ - "light.arbeitszimmer_schrank_dimmer" - ]; - light_group_3.entity_id = [ - "light.arbeitszimmer_pflanzenlicht" - ]; - - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; -in { - services.home-assistant.config.automation = [ - { - alias = "Perform Actions with ${remote}"; - mode = "queued"; - max = 5; - max_exceeded = "silent"; - trigger = { - platform = "state"; - entity_id = remote; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "template"; - value_template = "{{ trigger.from_state.state != trigger.to_state.state }}"; - } - ( statecond [ "off" "on" "color_wheel" - "brightness_up_click" "brightness_down_click" - "color_temp" "color_temperature_move" - "brightness_step_down" "brightness_step_up" "brightness_down_hold" "brightness_down_release" "brightness_up_hold" "brightness_up_release" - "scene_3" "scene_1" "scene_2" # working sunset party - "scene_6" "scene_4" "scene_5" # night campfire romantic - ]) - ]; - }; - action = [ - { service = "system_log.write"; - data = { - level = "info"; - message = "Tint Button pressed: {{ trigger.to_state.state }} Group: {{ trigger.to_state.attributes.action_group }} Length {{ input_working_scene_1 | length }}"; - }; - } - { - choose = [ - { # light group 1 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_1} }}"; - }; - sequence = [ - { - choose = [ - { - conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_1; - } - ]; - } - { - conditions = statecond [ - "scene_3" # working => previous scene - "scene_1" # sunset => default scene (solid) - "scene_2" # party => next scene - - ]; - sequence = [ - { - data.effect = '' - {% set options = state_attr("${main_light_1}","effect_list") -%} - {% set selection = options.index(state_attr("${main_light_1}","effect")) -%} - {% if trigger.to_state.attributes.action == "scene_2" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_1" -%} - ${default_scene_1} - {% elif trigger.to_state.attributes.action == "scene_3" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "light.turn_on"; - target.entity_id = main_light_1; - } - ]; - } - { - conditions = statecond [ - "scene_6" # night => previous color - "scene_4" # campfire => default Color (Default) - "scene_5" # romance => next color - - ]; - sequence = [ - { - data.option = '' - {% set options = state_attr("${main_color_select_1}","options") -%} - {% set selection = options.index(states("${main_color_select_1}")) -%} - {% if trigger.to_state.attributes.action == "scene_5" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_4" -%} - ${default_color_1} - {% elif trigger.to_state.attributes.action == "scene_6" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "select.select_option"; - target.entity_id = main_color_select_1; - } - ]; - } - ]; - } - ]; - } - { # light group 2 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_2} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_2; - } - ]; - } - ]; - } - ]; - } - { # light group 3 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_3} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_temperature_move" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_3; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix deleted file mode 100644 index 24324381..00000000 --- a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix +++ /dev/null @@ -1,300 +0,0 @@ -{ lib, ...}: -# cycle through scenes - -# cycle through color palettes -# {% set options = state_attr('select.wled_color_palette','options') -%} -# {% set selection = options.index(states('select.wled_color_palette')) -%} -# {% if false -%} -# {% if (selection + 1) >= options | length -%} -# {{ options[0] }} -# {% else -%} -# {{ options[selection + 1] }} -# {% endif %} -# {% elif true -%} -# {{ options[selection -1] }} -# {% endif -%} - -let - # Solid Pattern - # Hult - group_id_1 = 16388; - group_id_2 = 16389; - group_id_3 = 16390; - remote = "sensor.schlafzimmer_remote1_action"; - main_light_1 = "light.wled"; # fernseher - main_light_2 = "light.wled_2"; #fernsehwand - - default_scene_1 = "Solid"; - default_color_1 = "Default"; - main_color_select_1 = "select.wled_color_palette"; - light_group_1.entity_id = [ - main_light_1 - main_light_2 - ]; - - # contains only the actually changeable lights - light_group_2.entity_id = [ - "light.wohnzimmer_komode_osram" - "light.wohnzimmer_schrank_osram" - "light.wohnzimmer_fenster_lichterkette_licht" - ]; - light_group_3.entity_id = [ - "light.wohnzimmer_stehlampe_osram" - ]; - - statecond = cond: { # cond must be a list - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action in ( " + - (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; - }; -in { - services.home-assistant.config.automation = [ - { - alias = "Perform Actions with ${remote}"; - mode = "queued"; - max = 5; - max_exceeded = "silent"; - trigger = { - platform = "state"; - entity_id = remote; - }; - condition = { - condition = "and"; - conditions = [ - { - condition = "template"; - value_template = "{{ trigger.from_state.state != trigger.to_state.state }}"; - } - ( statecond [ "off" "on" "color_wheel" - "brightness_up_click" "brightness_down_click" - "color_temp" "color_temperature_move" - "brightness_step_down" "brightness_step_up" "brightness_down_hold" "brightness_down_release" "brightness_up_hold" "brightness_up_release" - "scene_3" "scene_1" "scene_2" # working sunset party - "scene_6" "scene_4" "scene_5" # night campfire romantic - ]) - ]; - }; - action = [ - { service = "system_log.write"; - data = { - level = "info"; - message = "Tint Button pressed: {{ trigger.to_state.state }} Group: {{ trigger.to_state.attributes.action_group }} Length {{ input_working_scene_1 | length }}"; - }; - } - { - choose = [ - { # light group 1 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_1} }}"; - }; - sequence = [ - { - choose = [ - { - conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_1; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_1; - } - ]; - } - { - conditions = statecond [ - "scene_3" # working => previous scene - "scene_1" # sunset => default scene (solid) - "scene_2" # party => next scene - - ]; - sequence = [ - { - data.effect = '' - {% set options = state_attr("${main_light_1}","effect_list") -%} - {% set selection = options.index(state_attr("${main_light_1}","effect")) -%} - {% if trigger.to_state.attributes.action == "scene_2" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_1" -%} - ${default_scene_1} - {% elif trigger.to_state.attributes.action == "scene_3" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "light.turn_on"; - target.entity_id = main_light_1; - } - ]; - } - { - conditions = statecond [ - "scene_6" # night => previous color - "scene_4" # campfire => default Color (Default) - "scene_5" # romance => next color - - ]; - sequence = [ - { - data.option = '' - {% set options = state_attr("${main_color_select_1}","options") -%} - {% set selection = options.index(states("${main_color_select_1}")) -%} - {% if trigger.to_state.attributes.action == "scene_5" -%} - {% if (selection + 1) >= options | length -%} - {{ options[0] }} - {% else -%} - {{ options[selection + 1] }} - {% endif %} - {% elif trigger.to_state.attributes.action == "scene_4" -%} - ${default_color_1} - {% elif trigger.to_state.attributes.action == "scene_6" -%} - {{ options[selection - 1] }} - {% endif -%} - ''; - service = "select.select_option"; - target.entity_id = main_color_select_1; - } - ]; - } - ]; - } - ]; - } - { # light group 2 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_2} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "color_temp" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_2; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_2; - } - ]; - } - ]; - } - ]; - } - { # light group 3 - conditions = { - condition = "template"; - value_template = "{{ trigger.to_state.attributes.action_group == ${toString group_id_3} }}"; - }; - sequence = [ - { - choose = [ - { conditions = statecond [ "on" "off" ]; - sequence = { - service = "light.turn_{{ trigger.to_state.state }}"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_wheel" ]; - sequence = { - data.xy_color = [ - "{{ trigger.to_state.attributes.action_color.x | float }}" - "{{ trigger.to_state.attributes.action_color.y | float }}" - ]; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "color_temperature_move" ]; - sequence = { - data.color_temp = "{{ trigger.to_state.attributes.action_color_temperature | float }}"; - service = "light.turn_on"; - target = light_group_3; - }; - } - { - conditions = statecond [ "brightness_up_click" "brightness_down_click" ]; - sequence = [ - { - variables.factor = ''{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}''; - } - { - data.brightness_step_pct = "{{ factor | int }}"; - service = "light.turn_on"; - target = light_group_3; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; - } - ]; -} diff --git a/makefu/2configs/home/ham/light/wohnzimmer.nix b/makefu/2configs/home/ham/light/wohnzimmer.nix deleted file mode 100644 index 7fc7af03..00000000 --- a/makefu/2configs/home/ham/light/wohnzimmer.nix +++ /dev/null @@ -1,56 +0,0 @@ -let - wohnzimmerbeleuchtung = [ - "light.wohnzimmer_komode_osram_light" - "light.wohnzimmer_schrank_osram_light" - ]; - wohnzimmer_deko = [ - "light.wohnzimmer_fernseher_led_strip" # led um fernseher - "light.wohnzimmer_lichterkette_led_strip" # led um fernsehwand - "light.wohnzimmer_fenster_lichterkette_licht" # led um fenster - ]; -in { - imports = [ ./tint_wohnzimmer.nix ]; - services.home-assistant.config.scene = [ - { name = "Wohnzimmer Abendlicht"; - id = "living_room_evening"; - entities = { - "light.wohnzimmer_komode_osram_light" = { - state = "on"; - brightness = 128; - }; - "light.wohnzimmer_schrank_osram_light" = { - state = "on"; - brightness = 128; - }; - "light.wohnzimmer_fenster_lichterkette_licht" = "on"; - "light.wohnzimmer_fernseher_led_strip" = { - state = "on"; - }; - }; - - } - ]; - services.home-assistant.config.wled = {}; - services.home-assistant.config.light = [ - { - platform = "group"; - name = "Wohnzimmerbeleuchtung"; - entities = wohnzimmerbeleuchtung; - } - { - platform = "group"; - name = "Wohnzimmer Deko"; - entities = wohnzimmer_deko; - } - { - platform = "group"; - name = "living_room_lights"; - entities = wohnzimmerbeleuchtung ++ wohnzimmer_deko; - } - ]; -} - -# trigger.to_state.attributes.action_group: -# 1: 18388 -# 2: 18389 -# 3: 18390 -- cgit v1.2.3