stockholm/makefu/2configs/bureautomation/lib/scripts.nix
2019-09-25 14:05:38 +02:00

19 lines
477 B
Nix

{ 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);
};
}