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