pape: improve off switching

This commit is contained in:
Ingolf Wagner 2020-04-16 02:58:44 +02:00
parent fdc24d1a36
commit 1252eabe57
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -33,6 +33,8 @@ in {
prometheus.namespace = "hass"; prometheus.namespace = "hass";
# manual state
# ------------
input_select.situation = { input_select.situation = {
icon = "mdi:brightness-auto"; icon = "mdi:brightness-auto";
options = [ "on" "off" "essential" ]; options = [ "on" "off" "essential" ];
@ -41,9 +43,10 @@ in {
input_boolean.situation_toggle.icon = "mdi:toggle-switch"; input_boolean.situation_toggle.icon = "mdi:toggle-switch";
automation = let automation = let
# todo : at night only turn trigger essential groups # todo : at night only turn trigger essential groups
roomPresents = roomPresents = { roomGroup, roomOffGroup ? roomGroup, presentsGroup
{ roomGroup, presentsGroup, situation, brightness ? 255 }: [ , situation, brightness ? 255 }: [
{ {
alias = "presents -> turn on ${roomGroup} lights"; alias = "presents -> turn on ${roomGroup} lights";
trigger = { trigger = {
@ -72,7 +75,7 @@ in {
]; ];
} }
{ {
alias = "absents -> turn off ${roomGroup} lights"; alias = "absents -> turn off ${roomOffGroup} lights";
trigger = { trigger = {
platform = "state"; platform = "state";
entity_id = "group.${presentsGroup}"; entity_id = "group.${presentsGroup}";
@ -82,11 +85,11 @@ in {
action = [ action = [
{ {
service = "switch.turn_off"; service = "switch.turn_off";
data.entity_id = "group.${roomGroup}"; data.entity_id = "group.${roomOffGroup}";
} }
{ {
service = "light.turn_off"; service = "light.turn_off";
data.entity_id = "group.${roomGroup}"; data.entity_id = "group.${roomOffGroup}";
} }
]; ];
} }
@ -119,30 +122,35 @@ in {
} }
{ {
roomGroup = "kitchen_room_essentials"; roomGroup = "kitchen_room_essentials";
roomOffGroup = "kitchen_room";
presentsGroup = "kitchen_room_present"; presentsGroup = "kitchen_room_present";
situation = "essential"; situation = "essential";
brightness = 30; brightness = 30;
} }
{ {
roomGroup = "living_room_essential"; roomGroup = "living_room_essential";
roomOffGroup = "living_room_lights";
presentsGroup = "living_room_present"; presentsGroup = "living_room_present";
situation = "essential"; situation = "essential";
brightness = 30; brightness = 30;
} }
{ {
roomGroup = "floor_room_essential"; roomGroup = "floor_room_essential";
roomOffGroup = "floor_room_lights";
presentsGroup = "floor_room_present"; presentsGroup = "floor_room_present";
situation = "essential"; situation = "essential";
brightness = 30; brightness = 30;
} }
{ {
roomGroup = "bath_room_essential"; roomGroup = "bath_room_essential";
roomOffGroup = "bath_room_lights";
presentsGroup = "bath_room_present"; presentsGroup = "bath_room_present";
situation = "essential"; situation = "essential";
brightness = 30; brightness = 30;
} }
{ {
roomGroup = "bed_room_essential"; roomGroup = "bed_room_essential";
roomOffGroup = "bed_room_lights";
presentsGroup = "bed_room_present"; presentsGroup = "bed_room_present";
situation = "essential"; situation = "essential";
brightness = 30; brightness = 30;