feat(hass): add material you sensor
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-06 22:16:59 -04:00
parent ecef42208a
commit 938a703e92
2 changed files with 49 additions and 38 deletions

View file

@ -9,43 +9,6 @@
./timer.nix ./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 = { services.home-assistant = {
enable = true; enable = true;
@ -90,4 +53,40 @@
zeroconf = {}; 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
'';
})
];
} }

View file

@ -36,7 +36,7 @@ in {
material-symbols = pkgs.stdenv.mkDerivation { material-symbols = pkgs.stdenv.mkDerivation {
pname = "material-symbols"; pname = "material-symbols";
version = "0.0.0"; version = "0.0.0+${material-symbols-src.shortRev}";
src = material-symbols-src; src = material-symbols-src;
phases = ["installPhase"]; phases = ["installPhase"];
installPhase = '' installPhase = ''
@ -51,6 +51,18 @@ in {
extra_module_url = ["/local/nixos-lovelace-modules/card-mod.js"]; 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 = { lovelaceConfig = {
title = "Our House"; title = "Our House";
views = [ views = [