fmt
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
@@ -10,7 +9,7 @@ let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
cfg = config.${namespace}.services.home-assistant.automation;
|
||||
|
||||
automationToYaml = lscfg: ''
|
||||
automationToYaml = lscfg: ''
|
||||
- id: '${toString lscfg.id}'
|
||||
alias: ${lscfg.alias}
|
||||
description: '${lscfg.description}'
|
||||
@@ -115,31 +114,29 @@ let
|
||||
- ${lscfg.lightEntityId}
|
||||
mode: single
|
||||
'';
|
||||
|
||||
lightswitchAutomations = concatStringsSep "\n" (mapAttrsToList (_: automationToYaml) cfg.lightswitch);
|
||||
|
||||
lightswitchAutomations = concatStringsSep "\n" (
|
||||
mapAttrsToList (_: automationToYaml) cfg.lightswitch
|
||||
);
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.home-assistant.automation = {
|
||||
lightswitch =
|
||||
mkOpt
|
||||
(types.attrsOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
id = mkOpt types.int 0 "Automation Id";
|
||||
alias = mkOpt types.str "" "Alias/Friendly Name";
|
||||
description = mkOpt types.str "" "Automation Description";
|
||||
mqttDeviceId = mkOpt types.str "" "mqtt device id of the sitch";
|
||||
deviceAction = mkOpt types.str "" "device action";
|
||||
lightEntityId = mkOpt types.str "" "home assistant entity id for the lights";
|
||||
transitionTime = mkOpt types.int 2 "light transition time in seconds";
|
||||
brightnessPercent = mkOpt types.int 100 "brightness percentage when turned on";
|
||||
lightTemperature = mkOpt types.int 6000 "light temperature when turned on";
|
||||
brightnessStepPercent = mkOpt types.int 10 "dimmer step in brightness percent";
|
||||
};
|
||||
}
|
||||
))
|
||||
{ }
|
||||
"lightswitch automations";
|
||||
lightswitch = mkOpt (types.attrsOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
id = mkOpt types.int 0 "Automation Id";
|
||||
alias = mkOpt types.str "" "Alias/Friendly Name";
|
||||
description = mkOpt types.str "" "Automation Description";
|
||||
mqttDeviceId = mkOpt types.str "" "mqtt device id of the sitch";
|
||||
deviceAction = mkOpt types.str "" "device action";
|
||||
lightEntityId = mkOpt types.str "" "home assistant entity id for the lights";
|
||||
transitionTime = mkOpt types.int 2 "light transition time in seconds";
|
||||
brightnessPercent = mkOpt types.int 100 "brightness percentage when turned on";
|
||||
lightTemperature = mkOpt types.int 6000 "light temperature when turned on";
|
||||
brightnessStepPercent = mkOpt types.int 10 "dimmer step in brightness percent";
|
||||
};
|
||||
}
|
||||
)) { } "lightswitch automations";
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
Reference in New Issue
Block a user