diff options
Diffstat (limited to 'hostnix')
| -rw-r--r-- | hostnix/elmo/home-assistant.nix | 183 |
1 files changed, 45 insertions, 138 deletions
diff --git a/hostnix/elmo/home-assistant.nix b/hostnix/elmo/home-assistant.nix index e4fa35d..5299508 100644 --- a/hostnix/elmo/home-assistant.nix +++ b/hostnix/elmo/home-assistant.nix @@ -88,43 +88,6 @@ # value_template: "{{ state_attr('weather.knyc_daynight', 'forecast')[1]['precipitation_probability']|float > 0 or state_attr('weather.knyc_daynight', 'forecast')[2]['precipitation_probability']|float > 0 }}" # #value_template: "{{ states('sensor.dark_sky_precip_probability_0d')|float > 5 }}" -#switch: -# - platform: template -# switches: -# heater: -# value_template: "{{ state_attr('climate.sensi', 'temperature')|float > 80 }}" -# availability_template: "{{ not is_state('climate.sensi', 'unavailable') }}" -# turn_on: -# service: climate.set_temperature -# data: -# entity_id: climate.sensi -# temperature: 85 -# turn_off: -# service: climate.set_temperature -# data: -# entity_id: climate.sensi -# temperature: 60 -# cooler: -# value_template: "{{ is_state('climate.sensi', 'cool') and state_attr('climate.sensi', 'temperature')|float < 72 }}" -# availability_template: "{{ not is_state('climate.sensi', 'unavailable') }}" -# turn_on: -# - service: climate.set_hvac_mode -# data: -# entity_id: climate.sensi -# hvac_mode: cool -# - service: climate.set_temperature -# data: -# entity_id: climate.sensi -# temperature: 70 -# turn_off: -# - service: climate.set_temperature -# data: -# entity_id: climate.sensi -# temperature: 75 -# - service: climate.turn_off -# data: -# entity_id: climate.sensi - input_number.target_panel_brightness = { name = "Target panel brightness"; min = 0; @@ -283,39 +246,6 @@ # entity_id: media_player.55_tcl_roku_tv # mode: restart # id: c759fbc37e4f46e0a834d95f40a78427 -# - id: c51d746e68384b7586a83236ff46b0f6 -# alias: Grow light update -# description: '' -# trigger: -# - platform: state -# entity_id: -# - input_number.target_panel_brightness -# condition: [] -# action: -# - if: -# - condition: template -# value_template: '{{ states(''input_number.target_panel_brightness'') == ''0.0'' -# }}' -# then: -# - service: light.turn_off -# data: {} -# target: -# entity_id: light.grow_light -# - service: switch.turn_off -# data: {} -# target: -# entity_id: switch.dot -# else: -# - service: light.turn_on -# data: -# brightness_pct: '{{ states(''input_number.target_panel_brightness'') }}' -# target: -# entity_id: light.grow_light -# - service: switch.turn_on -# data: {} -# target: -# entity_id: switch.dot -# mode: single # - alias: Barrier webhook # description: '' # trigger: @@ -392,51 +322,6 @@ # entity_id: media_player.55_tcl_roku_tv # mode: restart # id: a86bdf5640e34e5d9b4864f7b58d4bae -# - id: '1675140424295' -# alias: Bedroom toggle grow light -# description: '' -# trigger: -# - platform: state -# entity_id: -# - binary_sensor.bedroom_button_1 -# to: 'on' -# condition: [] -# action: -# - service: switch.toggle -# data: {} -# target: -# entity_id: switch.dot -# mode: single -# - id: '1675140647798' -# alias: Panel light reinitialize -# description: '' -# trigger: -# - platform: state -# entity_id: -# - light.panel_light -# to: unavailable -# condition: [] -# action: -# - repeat: -# while: -# - condition: state -# entity_id: light.panel_light -# state: unavailable -# sequence: -# - service: switch.turn_off -# data: {} -# target: -# entity_id: switch.wakko -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 10 -# milliseconds: 0 -# - service: switch.turn_on -# data: {} -# target: -# entity_id: switch.wakko -# mode: single # - id: '1678928586230' # alias: Spotify WIP # description: '' @@ -527,6 +412,22 @@ # mode: single automation = let + + button = entity_id: action: { + inherit action; + alias = "Button ${entity_id}"; + trigger = { + inherit entity_id; + platform = "state"; + to = "on"; + }; + }; + + service = service: target_id: { + inherit service; + target.entity_id = target_id; + }; + setTemperatureAt = at: temperature: { alias = "Thermostat ${at}"; trigger = { @@ -541,6 +442,7 @@ } ]; }; + in [ { @@ -573,7 +475,24 @@ ]; } { - alias = "Panel off"; + alias = "Grow light update"; + trigger = [ + { + platform = "state"; + entity_id = "input_number.target_panel_brightness"; + } + ]; + action = [ + { + service = "light.turn_on"; + target.entity_id = "light.grow_light"; + data.brightness_pct = "{{ states('input_number.target_panel_brightness') }}"; + } + ]; + } + + { + alias = "Depart"; trigger = { platform = "zone"; entity_id = "person.joe"; @@ -581,10 +500,7 @@ event = "leave"; }; action = [ - { - service = "light.turn_off"; - target.entity_id = "light.panel_light"; - } + (service "light.turn_off" "light.panel_light") ]; } @@ -600,10 +516,6 @@ target.entity_id = "input_number.target_panel_brightness"; data.value = 15; } - # { - # service = "switch.turn_on"; - # target.entity_id = "switch.dot"; - # } ]; } { @@ -648,28 +560,23 @@ target.entity_id = "input_number.target_panel_brightness"; data.value = 0; } - # { - # service = "switch.turn_off"; - # target.entity_id = "switch.dot"; - # } ]; } { - alias = "Bedroom toggle panel light"; + alias = "Alarm"; trigger = { - platform = "state"; - entity_id = "binary_sensor.bedroom_button_2"; - to = "on"; + platform = "time"; + at = "08:00"; }; - action = [ - { - service = "light.toggle"; - target.entity_id = "light.panel_light"; - } - ]; + action = [ (service "switch.turn_on" "switch.wakko") ]; } + (button "binary_sensor.bedroom_button_1" + (service "switch.toggle" "switch.wakko")) + (button "binary_sensor.bedroom_button_2" + (service "light.toggle" "light.panel_light")) + (setTemperatureAt "06:00" 71) (setTemperatureAt "12:00" 70) (setTemperatureAt "19:00" 71) |
