diff options
author | lassulus <lassulus@lassul.us> | 2019-03-12 11:16:45 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2019-03-12 11:16:45 +0100 |
commit | c4ebcc43d2b2f2451b16ee453f5275bd46018cd4 (patch) | |
tree | 64c85c3943ded41140866811c2838cfb8e6c4b92 /makefu/2configs/bureautomation/script/multi_blink.nix | |
parent | 44540e08146438e99840c6aff1af1b9a312d54ed (diff) | |
parent | da5fb52eb08097565c0e78035beb14a8a0ab2366 (diff) |
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/bureautomation/script/multi_blink.nix')
-rw-r--r-- | makefu/2configs/bureautomation/script/multi_blink.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/makefu/2configs/bureautomation/script/multi_blink.nix b/makefu/2configs/bureautomation/script/multi_blink.nix new file mode 100644 index 000000000..bb28dd46f --- /dev/null +++ b/makefu/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"; + }); +} |