feat(hass): add material you sensor
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
ecef42208a
commit
938a703e92
2 changed files with 49 additions and 38 deletions
|
@ -9,43 +9,6 @@
|
|||
./timer.nix
|
||||
];
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "yaml2nix";
|
||||
runtimeInputs = with pkgs; [yj];
|
||||
text = ''
|
||||
input="$(yj < "$1")"
|
||||
output="''${2:-""}"
|
||||
|
||||
nixCode="$(nix eval --expr "builtins.fromJSON '''$input'''" --impure | alejandra -q | sed 's/ = null;/ = {};/g')"
|
||||
|
||||
if [[ "$output" != "" ]]; then
|
||||
echo "$nixCode" > "$output"
|
||||
else
|
||||
echo "$nixCode"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
|
||||
(pkgs.writeShellApplication {
|
||||
name = "nix2yaml";
|
||||
runtimeInputs = with pkgs; [remarshal];
|
||||
text = ''
|
||||
input="$1"
|
||||
output="''${2:-""}"
|
||||
|
||||
yamlCode="$(nix eval --json --file "$input" | remarshal --if json --of yaml)"
|
||||
|
||||
if [[ "$output" != "" ]]; then
|
||||
echo "$yamlCode" > "$output"
|
||||
else
|
||||
echo "$yamlCode"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
# TODO: some components / integrations / addons require manual interaction in the GUI, find way to make it all declarative
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
|
||||
|
@ -90,4 +53,40 @@
|
|||
zeroconf = {};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "yaml2nix";
|
||||
runtimeInputs = with pkgs; [yj];
|
||||
text = ''
|
||||
input="$(yj < "$1")"
|
||||
output="''${2:-""}"
|
||||
|
||||
nixCode="$(nix eval --expr "builtins.fromJSON '''$input'''" --impure | alejandra -q | sed 's/ = null;/ = {};/g')"
|
||||
|
||||
if [[ "$output" != "" ]]; then
|
||||
echo "$nixCode" > "$output"
|
||||
else
|
||||
echo "$nixCode"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
|
||||
(pkgs.writeShellApplication {
|
||||
name = "nix2yaml";
|
||||
runtimeInputs = with pkgs; [remarshal];
|
||||
text = ''
|
||||
input="$1"
|
||||
output="''${2:-""}"
|
||||
|
||||
yamlCode="$(nix eval --json --file "$input" | remarshal --if json --of yaml)"
|
||||
|
||||
if [[ "$output" != "" ]]; then
|
||||
echo "$yamlCode" > "$output"
|
||||
else
|
||||
echo "$yamlCode"
|
||||
fi
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
|
||||
material-symbols = pkgs.stdenv.mkDerivation {
|
||||
pname = "material-symbols";
|
||||
version = "0.0.0";
|
||||
version = "0.0.0+${material-symbols-src.shortRev}";
|
||||
src = material-symbols-src;
|
||||
phases = ["installPhase"];
|
||||
installPhase = ''
|
||||
|
@ -51,6 +51,18 @@ in {
|
|||
extra_module_url = ["/local/nixos-lovelace-modules/card-mod.js"];
|
||||
};
|
||||
|
||||
config.template = [
|
||||
{
|
||||
sensor = [
|
||||
{
|
||||
name = "Material Rounded Base Color Matt";
|
||||
unique_id = "material_rounded_base_color_matt";
|
||||
state = ''{{ states("sensor.pixel_8_accent_color") }}'';
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
lovelaceConfig = {
|
||||
title = "Our House";
|
||||
views = [
|
||||
|
|
Loading…
Reference in a new issue