pepe: control situations
This commit is contained in:
parent
b7b7f1f2b3
commit
afd0a285cd
3 changed files with 128 additions and 43 deletions
|
@ -33,72 +33,154 @@ in {
|
||||||
|
|
||||||
prometheus.namespace = "hass";
|
prometheus.namespace = "hass";
|
||||||
|
|
||||||
|
input_select.situation = {
|
||||||
|
icon = "mdi:brightness-auto";
|
||||||
|
options = [ "on" "off" "essential" ];
|
||||||
|
};
|
||||||
input_boolean.bed_room_buttons.icon = "mdi:toggle-switch";
|
input_boolean.bed_room_buttons.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 = { roomGroup, presentsGroup }: [
|
roomPresents =
|
||||||
{
|
{ roomGroup, presentsGroup, situation, brightness ? 255 }: [
|
||||||
alias = "presents -> turn on ${roomGroup} lights";
|
{
|
||||||
trigger = {
|
alias = "presents -> turn on ${roomGroup} lights";
|
||||||
platform = "state";
|
trigger = {
|
||||||
entity_id = "group.${presentsGroup}";
|
platform = "state";
|
||||||
from = "off";
|
entity_id = "group.${presentsGroup}";
|
||||||
to = "on";
|
from = "off";
|
||||||
};
|
to = "on";
|
||||||
action = [
|
};
|
||||||
{
|
condition = {
|
||||||
service = "switch.turn_on";
|
condition = "state";
|
||||||
entity_id = "group.${roomGroup}";
|
entity_id = "input_select.situation";
|
||||||
}
|
state = situation;
|
||||||
{
|
};
|
||||||
service = "light.turn_on";
|
action = [
|
||||||
entity_id = "group.${roomGroup}";
|
{
|
||||||
}
|
service = "switch.turn_on";
|
||||||
];
|
data.entity_id = "group.${roomGroup}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
alias = "absents -> turn off ${roomGroup} lights";
|
service = "light.turn_on";
|
||||||
trigger = {
|
data = {
|
||||||
platform = "state";
|
entity_id = "group.${roomGroup}";
|
||||||
entity_id = "group.${presentsGroup}";
|
brightness = brightness;
|
||||||
from = "on";
|
};
|
||||||
to = "off";
|
}
|
||||||
};
|
];
|
||||||
action = [
|
}
|
||||||
{
|
{
|
||||||
service = "switch.turn_off";
|
alias = "absents -> turn off ${roomGroup} lights";
|
||||||
entity_id = "group.${roomGroup}";
|
trigger = {
|
||||||
}
|
platform = "state";
|
||||||
{
|
entity_id = "group.${presentsGroup}";
|
||||||
service = "light.turn_off";
|
from = "on";
|
||||||
entity_id = "group.${roomGroup}";
|
to = "off";
|
||||||
}
|
};
|
||||||
];
|
action = [
|
||||||
}
|
{
|
||||||
];
|
service = "switch.turn_off";
|
||||||
|
data.entity_id = "group.${roomGroup}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
service = "light.turn_off";
|
||||||
|
data.entity_id = "group.${roomGroup}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
in lib.flatten (map roomPresents [
|
in lib.flatten (map roomPresents [
|
||||||
{
|
{
|
||||||
roomGroup = "kitchen_room_lights";
|
roomGroup = "kitchen_room_lights";
|
||||||
presentsGroup = "kitchen_room_present";
|
presentsGroup = "kitchen_room_present";
|
||||||
|
situation = "on";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
roomGroup = "living_room_lights";
|
roomGroup = "living_room_lights";
|
||||||
presentsGroup = "living_room_present";
|
presentsGroup = "living_room_present";
|
||||||
|
situation = "on";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
roomGroup = "floor_room_lights";
|
roomGroup = "floor_room_lights";
|
||||||
presentsGroup = "floor_room_present";
|
presentsGroup = "floor_room_present";
|
||||||
|
situation = "on";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
roomGroup = "bath_room_lights";
|
roomGroup = "bath_room_lights";
|
||||||
presentsGroup = "bath_room_present";
|
presentsGroup = "bath_room_present";
|
||||||
|
situation = "on";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
roomGroup = "bed_room_lights";
|
roomGroup = "bed_room_lights";
|
||||||
presentsGroup = "bed_room_present";
|
presentsGroup = "bed_room_present";
|
||||||
|
situation = "on";
|
||||||
}
|
}
|
||||||
]);
|
{
|
||||||
|
roomGroup = "kitchen_room_essentials";
|
||||||
|
presentsGroup = "kitchen_room_present";
|
||||||
|
situation = "essential";
|
||||||
|
brightness = 30;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
roomGroup = "living_room_essential";
|
||||||
|
presentsGroup = "living_room_present";
|
||||||
|
situation = "essential";
|
||||||
|
brightness = 30;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
roomGroup = "floor_room_essential";
|
||||||
|
presentsGroup = "floor_room_present";
|
||||||
|
situation = "essential";
|
||||||
|
brightness = 30;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
roomGroup = "bath_room_essential";
|
||||||
|
presentsGroup = "bath_room_present";
|
||||||
|
situation = "essential";
|
||||||
|
brightness = 30;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
roomGroup = "bed_room_essential";
|
||||||
|
presentsGroup = "bed_room_present";
|
||||||
|
situation = "essential";
|
||||||
|
brightness = 30;
|
||||||
|
}
|
||||||
|
]) ++ [
|
||||||
|
{
|
||||||
|
alias = "set essential";
|
||||||
|
trigger = {
|
||||||
|
platform = "state";
|
||||||
|
entity_id = "input_boolean.situation_toggle";
|
||||||
|
from = "off";
|
||||||
|
to = "on";
|
||||||
|
};
|
||||||
|
action = {
|
||||||
|
service = "input_select.select_option";
|
||||||
|
data = {
|
||||||
|
entity_id = "input_select.situation";
|
||||||
|
option = "essential";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
alias = "unset essential";
|
||||||
|
trigger = {
|
||||||
|
platform = "state";
|
||||||
|
entity_id = "input_boolean.situation_toggle";
|
||||||
|
from = "on";
|
||||||
|
to = "off";
|
||||||
|
};
|
||||||
|
action = {
|
||||||
|
service = "input_select.select_option";
|
||||||
|
data = {
|
||||||
|
entity_id = "input_select.situation";
|
||||||
|
option = "on";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
group = let
|
group = let
|
||||||
create_room = { name, description }: {
|
create_room = { name, description }: {
|
||||||
|
@ -133,7 +215,6 @@ in {
|
||||||
"group.${name}_lights"
|
"group.${name}_lights"
|
||||||
"group.${name}_present"
|
"group.${name}_present"
|
||||||
"group.${name}_essential"
|
"group.${name}_essential"
|
||||||
"group.${name}_essential_present"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -185,6 +266,7 @@ in {
|
||||||
control = "hidden";
|
control = "hidden";
|
||||||
name = "Today";
|
name = "Today";
|
||||||
view = false;
|
view = false;
|
||||||
|
entities = [ "input_select.situation" ];
|
||||||
};
|
};
|
||||||
view_overview = {
|
view_overview = {
|
||||||
name = "Übersicht";
|
name = "Übersicht";
|
||||||
|
|
|
@ -13,16 +13,19 @@ let
|
||||||
id = "0x00158d0002b04f65";
|
id = "0x00158d0002b04f65";
|
||||||
# states = { click = "input_boolean.living_room_button"; } # input state to hold (optional) (default "input_boolean.single_${name}")
|
# states = { click = "input_boolean.living_room_button"; } # input state to hold (optional) (default "input_boolean.single_${name}")
|
||||||
groups = [ "living_room" "living_room_present" ];
|
groups = [ "living_room" "living_room_present" ];
|
||||||
|
states.double = "input_boolean.situation_toggle";
|
||||||
};
|
};
|
||||||
"button_2" = {
|
"button_2" = {
|
||||||
id = "0x00158d0002b04f09";
|
id = "0x00158d0002b04f09";
|
||||||
groups = [ "bed_room" "bed_room_present" ];
|
groups = [ "bed_room" "bed_room_present" ];
|
||||||
states.single = "input_boolean.bed_room_buttons";
|
states.single = "input_boolean.bed_room_buttons";
|
||||||
|
states.double = "input_boolean.situation_toggle";
|
||||||
};
|
};
|
||||||
"button_3" = {
|
"button_3" = {
|
||||||
id = "0x00158d0002b00e04";
|
id = "0x00158d0002b00e04";
|
||||||
groups = [ "bed_room" "bed_room_present" ];
|
groups = [ "bed_room" "bed_room_present" ];
|
||||||
states.single = "input_boolean.bed_room_buttons";
|
states.single = "input_boolean.bed_room_buttons";
|
||||||
|
states.double = "input_boolean.situation_toggle";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ let
|
||||||
};
|
};
|
||||||
"light_3" = {
|
"light_3" = {
|
||||||
id = "0x7cb03eaa0a033a86";
|
id = "0x7cb03eaa0a033a86";
|
||||||
groups = [ "living_room" "living_room_lights" ];
|
groups = [ "living_room" "living_room_essential" "living_room_lights" ];
|
||||||
};
|
};
|
||||||
"light_4" = {
|
"light_4" = {
|
||||||
id = "0x7cb03eaa0a04aabf";
|
id = "0x7cb03eaa0a04aabf";
|
||||||
|
|
Loading…
Reference in a new issue