home-assistant: toggle printer with button hold

This commit is contained in:
Ingolf Wagner 2020-07-11 18:54:59 +02:00
parent d1a9626cb7
commit 33a99fb1cd
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
2 changed files with 17 additions and 0 deletions

View file

@ -61,9 +61,22 @@ in {
options = [ "default" "night" ];
};
input_boolean.situation_toggle.icon = "mdi:toggle-switch";
input_boolean.printer_toggle.icon = "mdi:toggle-switch";
automation = [
{
alias = "Hold Button -> Toggle Printer";
trigger = {
platform = "state";
entity_id = "input_boolean.printer_toggle";
};
action = {
service = "switch.toggle";
data.entity_id = "switch.pal02";
};
}
{
alias = "set light-control scene";
trigger = {
@ -80,6 +93,7 @@ in {
};
}
# control situation with buttons
{
alias = "Button -> Change Scene";

View file

@ -13,16 +13,19 @@ let
id = "0x00158d0002b04f65";
groups = [ "living_room" ];
states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle";
};
"button_2" = {
id = "0x00158d0002b04f09";
groups = [ "bed_room" ];
states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle";
};
"button_3" = {
id = "0x00158d0002b00e04";
groups = [ "bed_room" ];
states.single = "input_boolean.situation_toggle";
states.hold = "input_boolean.printer_toggle";
};
};