From 6fa5b38bed3f8e73d6f86a844ef775735a3cad29 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 31 Aug 2021 15:14:37 +0200 Subject: ma ham: consolidate button management --- .../home/ham/automation/ladestecker_timer.nix | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 makefu/2configs/home/ham/automation/ladestecker_timer.nix (limited to 'makefu/2configs/home/ham/automation/ladestecker_timer.nix') diff --git a/makefu/2configs/home/ham/automation/ladestecker_timer.nix b/makefu/2configs/home/ham/automation/ladestecker_timer.nix new file mode 100644 index 000000000..8e877129c --- /dev/null +++ b/makefu/2configs/home/ham/automation/ladestecker_timer.nix @@ -0,0 +1,24 @@ +let + relay = "switch.terrasse_plug_relay"; + timeout = "300"; +in { + services.home-assistant.config.automation = [ + { alias = "Always turn off Charging station after ${toString (timeout)}m"; + trigger = [ + { + platform = "state"; + entity_id = relay; + to = "on"; + for.minutes = timeout; + } + ]; + action = + [ + { + service = "homeassistant.turn_off"; + entity_id = [ relay ]; + } + ]; + } + ]; +} -- cgit v1.2.3