summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/lib/scripts.nix
blob: d8665f94f2b4729ce2b829314d270a95c305e0a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ lib, ... }:
{
  multi_flash = { entity, delays ? [ 500 ], alias ?  "${entity}_multi_flash_${toString (lib.length delays)}" }:
  {
    inherit alias;
    sequence = lib.flatten (builtins.map (delay: [
      { service = "homeassistant.turn_on";
        data.entity_id = entity;
      }
      { delay.milliseconds = delay; }
      { service = "homeassistant.turn_off";
        data.entity_id = entity;
      }
      { delay.milliseconds = delay; }
    ]
     ) delays);
   };
}