diff options
author | makefu <github@syntax-fehler.de> | 2019-03-06 16:42:27 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2019-03-06 16:42:27 +0100 |
commit | c81db9c8cea9e85aa9f2e840d39502fc7222ed90 (patch) | |
tree | b752f082072945c22abb9232fb4664c4ff32a9f7 /2configs/bureautomation/script/multi_blink.nix | |
parent | e1b003a1123ab261b5448e9183b00c5f953faa90 (diff) |
ma bureautomation: split into files
Diffstat (limited to '2configs/bureautomation/script/multi_blink.nix')
-rw-r--r-- | 2configs/bureautomation/script/multi_blink.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/2configs/bureautomation/script/multi_blink.nix b/2configs/bureautomation/script/multi_blink.nix new file mode 100644 index 000000000..bb28dd46f --- /dev/null +++ b/2configs/bureautomation/script/multi_blink.nix @@ -0,0 +1,37 @@ +{lib, ... }: +let + # let an entity blink for X times with a delay of Y milliseconds + flash_entity = { entity, delay ? 500, count ? 4, alias ? "${entity}_blink_${toString count}_${toString delay}" }: + { + inherit alias; + sequence = lib.flatten (builtins.genList (i: [ + { service = "homeassistant.turn_on"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + { service = "homeassistant.turn_off"; + data.entity_id = entity; + } + { delay.milliseconds = delay; } + ] + ) count); + }; +in { + buzz_red_led = (flash_entity { + entity = "light.redbutton_buzzer"; + alias = "Red Button Buzz"; + count = 4; + }); + buzz_red_led_fast = (flash_entity { + entity = "light.redbutton_buzzer"; + delay = 250; + count = 2; + alias = "Red Button Buzz fast"; + }); + blitz_10s = (flash_entity { + entity = "switch.blitzdings"; + delay = 10000; + count = 1; + alias = "blitz for 10 seconds"; + }); +} |