update: light-control and buttons

This commit is contained in:
Ingolf Wagner 2020-06-11 12:28:29 +02:00
parent 6fd3b5f26e
commit 6a8af64c7e
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
2 changed files with 37 additions and 6 deletions

View file

@ -50,7 +50,7 @@ in {
# all scenes # all scenes
input_select.scene = { input_select.scene = {
icon = "mdi:brightness-auto"; icon = "mdi:brightness-auto";
options = [ "default" "night" "outside" ]; options = [ "default" "night" "outside" "cooking" ];
}; };
# scenes controlled by buttons # scenes controlled by buttons
input_select.scene_button = { input_select.scene_button = {
@ -62,9 +62,7 @@ in {
automation = [ automation = [
{ {
# This automation script runs when the thermostat mode selector is changed. alias = "set light-control scene";
# It publishes its value to the same MQTT topic it is also subscribed to.
alias = "Mqtt publish Scene";
trigger = { trigger = {
platform = "state"; platform = "state";
entity_id = "input_select.scene"; entity_id = "input_select.scene";
@ -73,7 +71,6 @@ in {
service = "mqtt.publish"; service = "mqtt.publish";
data_template = { data_template = {
topic = "control/lights/set"; topic = "control/lights/set";
#retain = true;
payload_template = payload_template =
''{"scene":"{{ states('input_select.scene')}}"}''; ''{"scene":"{{ states('input_select.scene')}}"}'';
}; };
@ -82,16 +79,45 @@ in {
# control situation with buttons # control situation with buttons
{ {
alias = "Toggle Button (controlled) Scene"; alias = "Button -> Change Scene";
trigger = { trigger = {
platform = "state"; platform = "state";
entity_id = "input_boolean.situation_toggle"; entity_id = "input_boolean.situation_toggle";
}; };
condition = {
condition = "not";
conditions = [{
condition = {
condition = "state";
entity_id = "input_select.scene";
state = "outside";
};
}];
};
action = { action = {
service = "input_select.select_next"; service = "input_select.select_next";
data.entity_id = "input_select.scene_button"; data.entity_id = "input_select.scene_button";
}; };
} }
{
alias = "Button -> Default Scene";
trigger = {
platform = "state";
entity_id = "input_boolean.situation_toggle";
};
condition = {
condition = "state";
entity_id = "input_select.scene";
state = "outside";
};
action = {
service = "input_select.select_option";
data = {
entity_id = "input_select.scene_button";
option = "default";
};
};
}
{ {
alias = "Button Scene -> Scene"; alias = "Button Scene -> Scene";
trigger = { trigger = {
@ -106,6 +132,7 @@ in {
}; };
}; };
} }
{ {
alias = "Set Scene To Outside when opening door"; alias = "Set Scene To Outside when opening door";
trigger = [ trigger = [

View file

@ -14,6 +14,10 @@
name = "outside"; name = "outside";
room_tracking_enabled = false; room_tracking_enabled = false;
} }
{
name = "cooking";
enabled_switches = [ "stat/PAL07/RESULT" "stat/PAL08/RESULT" ];
}
{ {
name = "night"; name = "night";
room_tracking_enabled = false; room_tracking_enabled = false;