ma bureautomation/aramark: init
This commit is contained in:
parent
73ea6c9f5e
commit
2676e426ec
18
2configs/bureautomation/lib/scripts.nix
Normal file
18
2configs/bureautomation/lib/scripts.nix
Normal file
|
@ -0,0 +1,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);
|
||||||
|
};
|
||||||
|
}
|
24
2configs/bureautomation/multi/aramark.nix
Normal file
24
2configs/bureautomation/multi/aramark.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
aramark = topic: name:
|
||||||
|
{ platform = "mqtt";
|
||||||
|
inherit name;
|
||||||
|
state_topic = "/aramark/thales-deutschland/${topic}";
|
||||||
|
};
|
||||||
|
aramark_menue = menue:
|
||||||
|
[
|
||||||
|
(aramark "${menue}/title" menue)
|
||||||
|
(aramark "${menue}/description" "${menue} Text")
|
||||||
|
((aramark "${menue}/price" "${menue} Preis") // { unit_of_measurement = "€"; })
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
sensor = (aramark_menue "Menü 1")
|
||||||
|
++ (aramark_menue "Menü 2")
|
||||||
|
++ (aramark_menue "Mercato")
|
||||||
|
++ (aramark_menue "Aktion");
|
||||||
|
binary_sensor =
|
||||||
|
[
|
||||||
|
((aramark "pommes" "Pommes" ) // { payload_on = "True"; payload_off = "False"; })
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue