fix only_lights
This commit is contained in:
parent
bbefba81da
commit
2c6cc5f340
|
@ -34,7 +34,7 @@
|
||||||
flat = {
|
flat = {
|
||||||
title = "Wohnungsmodus";
|
title = "Wohnungsmodus";
|
||||||
name = "flat";
|
name = "flat";
|
||||||
options = {inherit active vacation only_lights;};
|
options = {inherit active vacation;};
|
||||||
};
|
};
|
||||||
wohnzimmer = {
|
wohnzimmer = {
|
||||||
title = "Wohnzimmermodus";
|
title = "Wohnzimmermodus";
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
schlafzimmer = {
|
schlafzimmer = {
|
||||||
title = "Schlafzimmermodus";
|
title = "Schlafzimmermodus";
|
||||||
name = "schlafzimmer";
|
name = "schlafzimmer";
|
||||||
options = {inherit empty heat active force_active;};
|
options = {inherit empty heat active force_active only_lights;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
fenster = map (name: "binary_sensor.${name}")
|
fenster = map (name: "binary_sensor.${name}")
|
||||||
|
@ -398,7 +398,7 @@ in {
|
||||||
{
|
{
|
||||||
service = "input_number.set_value";
|
service = "input_number.set_value";
|
||||||
target.entity_id = "input_number.target_temperature_wohnzimmer";
|
target.entity_id = "input_number.target_temperature_wohnzimmer";
|
||||||
data.value = jinja.if' (jinja.isState (util.modeSelectEntity modes.wohnzimmer) "empty") "18" "23";
|
data.value = jinja.if' (jinja.isStates (util.modeSelectEntity modes.wohnzimmer) ["empty" "only_lights"]) "18" "23";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ in {
|
||||||
{
|
{
|
||||||
service = "input_number.set_value";
|
service = "input_number.set_value";
|
||||||
target.entity_id = "input_number.target_temperature_schlafzimmer";
|
target.entity_id = "input_number.target_temperature_schlafzimmer";
|
||||||
data.value = jinja.if' (jinja.isState (util.modeSelectEntity modes.schlafzimmer) "empty") "18" "20.5";
|
data.value = jinja.if' (jinja.isStates (util.modeSelectEntity modes.schlafzimmer) ["empty" "only_lights"]) "18" "20.5";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ in {
|
||||||
{
|
{
|
||||||
service = jinja.if'
|
service = jinja.if'
|
||||||
(jinja.or
|
(jinja.or
|
||||||
(jinja.isState (util.modeSelectEntity modes.wohnzimmer) "force_active")
|
(jinja.isStates (util.modeSelectEntity modes.wohnzimmer) ["force_active" "only_lights"])
|
||||||
(jinja.and
|
(jinja.and
|
||||||
(jinja.isState (util.modeSelectEntity modes.wohnzimmer) "active")
|
(jinja.isState (util.modeSelectEntity modes.wohnzimmer) "active")
|
||||||
"state_attr('sun.sun', 'elevation') < 6"))
|
"state_attr('sun.sun', 'elevation') < 6"))
|
||||||
|
@ -443,7 +443,7 @@ in {
|
||||||
{
|
{
|
||||||
service = jinja.if'
|
service = jinja.if'
|
||||||
(jinja.or
|
(jinja.or
|
||||||
(jinja.isState (util.modeSelectEntity modes.schlafzimmer) "force_active")
|
(jinja.isStates (util.modeSelectEntity modes.schlafzimmer) ["force_active" "only_lights"])
|
||||||
(jinja.and
|
(jinja.and
|
||||||
(jinja.isState (util.modeSelectEntity modes.schlafzimmer) "active")
|
(jinja.isState (util.modeSelectEntity modes.schlafzimmer) "active")
|
||||||
"state_attr('sun.sun', 'elevation') < 6"))
|
"state_attr('sun.sun', 'elevation') < 6"))
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
lib: rec {
|
lib: let
|
||||||
|
inherit (builtins) foldl';
|
||||||
|
in rec {
|
||||||
case = default: attrs: ''
|
case = default: attrs: ''
|
||||||
{% if ${lib.concatStringsSep "\n{% elseif " (lib.mapAttrsToList (condition: result: "${condition} %}\n ${result}") attrs)}
|
{% if ${lib.concatStringsSep "\n{% elseif " (lib.mapAttrsToList (condition: result: "${condition} %}\n ${result}") attrs)}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -9,4 +11,5 @@ lib: rec {
|
||||||
or = lhs: rhs: "(${lhs} or ${rhs})";
|
or = lhs: rhs: "(${lhs} or ${rhs})";
|
||||||
and = lhs: rhs: "(${lhs} and ${rhs})";
|
and = lhs: rhs: "(${lhs} and ${rhs})";
|
||||||
isState = entity: state: "is_state('${entity}','${state}')";
|
isState = entity: state: "is_state('${entity}','${state}')";
|
||||||
|
isStates = entity: states: foldl' or "false" (map (isState entity) states);
|
||||||
}
|
}
|
||||||
|
|
1
test.nix
1
test.nix
|
@ -3,7 +3,6 @@ let
|
||||||
in {
|
in {
|
||||||
pre-commit-check = nix-pre-commit-hooks.run {
|
pre-commit-check = nix-pre-commit-hooks.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
excludes = ["nix/.*" "hardware-configuration.nix"];
|
|
||||||
hooks = {
|
hooks = {
|
||||||
hlint.enable = true;
|
hlint.enable = true;
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
|
|
Loading…
Reference in a new issue