From 13de526bc3bea7aaba911be8393827d8c92fa5c4 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 2 May 2020 00:45:54 +0200 Subject: [PATCH] hass.io: working on room presents --- configs/pepe/home-assistant.nix | 44 +++++++++++++++++++++++--- configs/pepe/home-assistant/sonoff.nix | 2 +- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/configs/pepe/home-assistant.nix b/configs/pepe/home-assistant.nix index 961c8da..5e00aaf 100644 --- a/configs/pepe/home-assistant.nix +++ b/configs/pepe/home-assistant.nix @@ -50,6 +50,21 @@ in { input_boolean.bed_room_buttons.icon = "mdi:toggle-switch"; input_boolean.situation_toggle.icon = "mdi:toggle-switch"; + # room presents when I'm alone + input_boolean.alone.icon = "mdi:account"; + input_select.room_present = { + icon = "mdi:map-marker"; + options = [ + "kitchen_room_present" + "bath_room_present" + "living_room_present" + "bed_room_present" + "floor_room_present" + "bath_room_present" + "outside" + ]; + }; + automation = let allRooms = @@ -103,9 +118,25 @@ in { to = "off"; }; condition = { - condition = "state"; - entity_id = "input_select.situation"; - state = situation; + condition = "and"; + conditions = [ + { + condition = "template"; + value_template = + "{{ states( 'input_select.room_present' ) != '${presentsGroup}' }}"; + } + { + condition = "template"; + value_template = + "{{ states( 'input_boolean.alone' ) == 'on' }}"; + } + { + condition = "template"; + value_template = + "{{ states( 'input_select.situation' ) == '${situation}' }}"; + } + ]; + }; action = [ { @@ -319,6 +350,7 @@ in { name = "Räume"; view = true; entities = [ + "group.today" "group.floor_room" "group.bed_room" "group.living_room" @@ -337,7 +369,11 @@ in { control = "hidden"; name = "Today"; view = false; - entities = [ "input_select.situation" ]; + entities = [ + "input_select.situation" + "input_select.room_present" + "input_boolean.alone" + ]; }; view_overview = { name = "Übersicht"; diff --git a/configs/pepe/home-assistant/sonoff.nix b/configs/pepe/home-assistant/sonoff.nix index bcc52a5..e6666bf 100644 --- a/configs/pepe/home-assistant/sonoff.nix +++ b/configs/pepe/home-assistant/sonoff.nix @@ -10,7 +10,7 @@ let "pal02" = { label = "Wohnzimmer Lampe"; icon = "mdi:lightbulb"; - groups = [ "all_lights" "living_room_lights" "living_room" ]; + groups = [ ]; }; "pal03" = { label = "Wohnzimmer Lampe";