From ca5c7c86e23f0588339ff08753a448679ee6630b Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Tue, 2 Sep 2025 11:12:31 -0400 Subject: HA: Check fridge door Some other minor adjustments to entity naming, fan, and grow light. --- hostnix/elmo/home-assistant.nix | 48 +++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/hostnix/elmo/home-assistant.nix b/hostnix/elmo/home-assistant.nix index 4a2ff80..6ca11e6 100644 --- a/hostnix/elmo/home-assistant.nix +++ b/hostnix/elmo/home-assistant.nix @@ -52,6 +52,10 @@ target.entity_id = entity; }; }; + + entity = { + sad_lamp = "switch.dot"; + }; }; in @@ -450,7 +454,7 @@ }; action = [ (ha.action.off "light.panel_light") - (ha.action.off "switch.dot") + (ha.action.off ha.entity.sad_lamp) (ha.action.off "climate.bedroom_cool") (ha.action.off "climate.air_conditioner_1") ]; @@ -479,7 +483,7 @@ ]; action = [ (ha.action.on "light.panel_light") - (ha.action.on "switch.dot") + (ha.action.on ha.entity.sad_lamp) ]; } @@ -571,14 +575,21 @@ alias = "Grow light morning"; # TODO make configurable (snooze) trigger = [ (ha.trigger.at "09:00") ]; + condition = [ + { + condition = "zone"; + entity_id = "person.joe"; + zone = "zone.home"; + } + ]; action = [ (ha.action.on "light.grow_light") (ha.action.on "switch.wakko") - { - service = "fan.set_percentage"; - target.entity_id = "fan.core_200s"; - data.percentage = 100; - } + # { + # service = "fan.set_percentage"; + # target.entity_id = "fan.core_200s"; + # data.percentage = 100; + # } ]; } { @@ -598,6 +609,29 @@ (button "binary_sensor.bedroom_button_2" (ha.action.toggle "switch.wakko")) + { + alias = "Fridge door ajar"; + triggers = [ + { + trigger = "state"; + entity_id = [ "binary_sensor.fridge_door_sensor" ]; + to = [ "on" ]; + for.minutes = 1; + } + ]; + actions = [ + { + action = "notify.notify"; + data.message = "Check fridge door"; + } + (ha.action.toggle "light.panel_light") + (ha.action.toggle ha.entity.sad_lamp) + { delay.milliseconds = 500; } + (ha.action.toggle "light.panel_light") + (ha.action.toggle ha.entity.sad_lamp) + ]; + } + # The panel light can become unresponsive and need to be reboot. { alias = "Panel light reinitialize"; -- cgit v1.3.1