blob: bb28dd46f0c5cc47bbf3bd28aeb5902825c47cae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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";
});
}
|