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

View file

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