stockholm/makefu/2configs/bureautomation/lib/scripts.nix

19 lines
477 B
Nix
Raw Normal View History

2019-09-25 12:05:38 +00:00
{ 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);
};
}