From 33a99fb1cdb12f798cdb8d298cb3764279e4c47b Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 11 Jul 2020 18:54:59 +0200 Subject: [PATCH] home-assistant: toggle printer with button hold --- configs/pepe/home-assistant.nix | 14 ++++++++++++++ .../pepe/home-assistant/zigbee2mqtt/buttons.nix | 3 +++ 2 files changed, 17 insertions(+) diff --git a/configs/pepe/home-assistant.nix b/configs/pepe/home-assistant.nix index 38265e6..bf36430 100644 --- a/configs/pepe/home-assistant.nix +++ b/configs/pepe/home-assistant.nix @@ -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"; diff --git a/configs/pepe/home-assistant/zigbee2mqtt/buttons.nix b/configs/pepe/home-assistant/zigbee2mqtt/buttons.nix index fb24cb9..28306ae 100644 --- a/configs/pepe/home-assistant/zigbee2mqtt/buttons.nix +++ b/configs/pepe/home-assistant/zigbee2mqtt/buttons.nix @@ -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"; }; };