parent
56eeb7745c
commit
8bcb9c43ad
6 changed files with 125 additions and 61 deletions
devices/homie/modules/home-assistant
|
@ -1,4 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
{pkgs, self, ...}: {
|
||||
imports = [
|
||||
./assist.nix
|
||||
./bluetooth.nix
|
||||
|
@ -7,9 +7,9 @@
|
|||
./netdaemon
|
||||
./spotify.nix
|
||||
./timer.nix
|
||||
];
|
||||
|
||||
# TODO: nix: add HA options for custom_sentences and stuff
|
||||
self.nixosModules.ha-plus
|
||||
];
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
|
|
|
@ -3,31 +3,18 @@
|
|||
dracul-ha-src,
|
||||
material-rounded-theme-src,
|
||||
material-symbols-src,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatStringsSep getExe;
|
||||
inherit (pkgs.writers) writeYAML;
|
||||
|
||||
themes = [
|
||||
"${caule-themes-src}/themes/caule-themes-pack-1.yaml"
|
||||
"${dracul-ha-src}/themes/dracul-ha.yaml"
|
||||
"${material-rounded-theme-src}/themes/material_rounded.yaml"
|
||||
];
|
||||
in {
|
||||
systemd.services.home-assistant.preStart = let
|
||||
WorkingDirectory = "/var/lib/hass";
|
||||
in
|
||||
getExe (pkgs.writeShellApplication {
|
||||
name = "ha-themes";
|
||||
text = ''
|
||||
mkdir -p ${WorkingDirectory}/themes
|
||||
cp -f ${concatStringsSep " " themes} ${WorkingDirectory}/themes
|
||||
'';
|
||||
});
|
||||
|
||||
services.home-assistant = {
|
||||
configFiles = {
|
||||
"themes/caule.yaml".source = "${caule-themes-src}/themes/caule-themes-pack-1.yaml";
|
||||
"themes/dracul-ha.yaml".source = "${dracul-ha-src}/themes/dracul-ha.yaml";
|
||||
"themes/material_rounded.yaml".source = "${material-rounded-theme-src}/themes/material_rounded.yaml";
|
||||
};
|
||||
|
||||
customLovelaceModules = builtins.attrValues {
|
||||
inherit
|
||||
(pkgs.home-assistant-custom-lovelace-modules)
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe;
|
||||
inherit (pkgs.writers) writeYAML;
|
||||
in {
|
||||
systemd.services.home-assistant.preStart = let
|
||||
WorkingDirectory = "/var/lib/hass";
|
||||
creds = config.sops.secrets.spotifyd.path;
|
||||
spotify = writeYAML "assist_spotify.yaml" (import ./spotify-sentences.nix);
|
||||
in
|
||||
getExe (pkgs.writeShellApplication {
|
||||
name = "spotify-files";
|
||||
text = ''
|
||||
mkdir -p ${WorkingDirectory}/custom_sentences/en
|
||||
cp -f ${spotify} ${WorkingDirectory}/custom_sentences/en/assist_spotify.yaml
|
||||
cp -f ${creds} ${WorkingDirectory}/.storage/SpotifyWebApiPython_librespot_credentials.json
|
||||
'';
|
||||
});
|
||||
|
||||
}: {
|
||||
services.home-assistant = {
|
||||
customComponents = builtins.attrValues {
|
||||
inherit
|
||||
|
@ -34,6 +16,12 @@ in {
|
|||
"spotify"
|
||||
];
|
||||
|
||||
customSentences."assist_spotify" = import ./spotify-sentences.nix;
|
||||
|
||||
configFiles.
|
||||
".storage/SpotifyWebApiPython_librespot_credentials.json"
|
||||
.source = config.sops.secrets.spotifyd.path;
|
||||
|
||||
config.intent_script = {
|
||||
PlayAlbum = {
|
||||
async_action = "false";
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
# From https://github.com/don86nl/ha_intents/blob/main/config/packages/assist_timers.yaml
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatStrings concatStringsSep getExe;
|
||||
inherit (pkgs.writers) writeYAML;
|
||||
{lib, ...}: let
|
||||
inherit (lib) concatStrings concatStringsSep;
|
||||
|
||||
mkTimer = id: {
|
||||
"assist_timer${toString id}" = {
|
||||
|
@ -43,20 +38,9 @@
|
|||
timer_media_location = "/path/to/file.mp3";
|
||||
};
|
||||
in {
|
||||
systemd.services.home-assistant.preStart = let
|
||||
WorkingDirectory = "/var/lib/hass";
|
||||
|
||||
timer = writeYAML "assist_timers.yaml" (import ./timer-sentences.nix);
|
||||
in
|
||||
getExe (pkgs.writeShellApplication {
|
||||
name = "timer-files";
|
||||
text = ''
|
||||
mkdir -p ${WorkingDirectory}/custom_sentences/en
|
||||
cp -f ${timer} ${WorkingDirectory}/custom_sentences/en/assist_timers.yaml
|
||||
'';
|
||||
});
|
||||
|
||||
services.home-assistant = {
|
||||
customSentences."assist_timers" = import ./timer-sentences.nix;
|
||||
|
||||
config = {
|
||||
homeassistant.customize."script.assist_timerstart" = {inherit settings;};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue