diff --git a/devices/homie/modules/home-assistant/netdaemon/.version b/devices/homie/modules/home-assistant/netdaemon/.version new file mode 100644 index 00000000..fb0b462a --- /dev/null +++ b/devices/homie/modules/home-assistant/netdaemon/.version @@ -0,0 +1 @@ +24.37.1 diff --git a/devices/homie/modules/home-assistant/netdaemon/HomeAssistantGenerated.cs b/devices/homie/modules/home-assistant/netdaemon/HomeAssistantGenerated.cs index 7923695a..98c6a00c 100644 --- a/devices/homie/modules/home-assistant/netdaemon/HomeAssistantGenerated.cs +++ b/devices/homie/modules/home-assistant/netdaemon/HomeAssistantGenerated.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // Generated using NetDaemon CodeGenerator nd-codegen v24.37.1.0 -// At: 2024-10-08T21:14:58.2735702-04:00 +// At: 2024-10-10T12:06:21.5284008-04:00 // // *** Make sure the version of the codegen tool and your nugets Joysoftware.NetDaemon.* have the same version.*** // You can use following command to keep it up to date with the latest version: @@ -379,6 +379,10 @@ public partial class InputBooleanEntities public InputBooleanEntity NetdaemonSpotifyPlayAlbum => new(_haContext, "input_boolean.netdaemon_spotify_play_album"); ///netdaemon_spotify_play_artist public InputBooleanEntity NetdaemonSpotifyPlayArtist => new(_haContext, "input_boolean.netdaemon_spotify_play_artist"); + ///netdaemon_spotify_play_playlist + public InputBooleanEntity NetdaemonSpotifyPlayPlaylist => new(_haContext, "input_boolean.netdaemon_spotify_play_playlist"); + ///netdaemon_spotify_play_song + public InputBooleanEntity NetdaemonSpotifyPlaySong => new(_haContext, "input_boolean.netdaemon_spotify_play_song"); } public partial class InputTextEntities @@ -597,9 +601,9 @@ public partial class SensorEntities public SensorEntity Pixel8WifiConnection => new(_haContext, "sensor.pixel_8_wifi_connection"); ///Pixel 8 WiFi IP address public SensorEntity Pixel8WifiIpAddress => new(_haContext, "sensor.pixel_8_wifi_ip_address"); - ///SM-F741W Battery state + ///Z Flip 6 Battery state public SensorEntity SmF741wBatteryState => new(_haContext, "sensor.sm_f741w_battery_state"); - ///SM-F741W Charger type + ///Z Flip 6 Charger type public SensorEntity SmF741wChargerType => new(_haContext, "sensor.sm_f741w_charger_type"); ///Sun Next dawn public SensorEntity SunNextDawn => new(_haContext, "sensor.sun_next_dawn"); @@ -641,7 +645,7 @@ public partial class SensorEntities public NumericSensorEntity Pixel8WifiLinkSpeed => new(_haContext, "sensor.pixel_8_wifi_link_speed"); ///Pixel 8 WiFi signal strength public NumericSensorEntity Pixel8WifiSignalStrength => new(_haContext, "sensor.pixel_8_wifi_signal_strength"); - ///SM-F741W Battery level + ///Z Flip 6 Battery level public NumericSensorEntity SmF741wBatteryLevel => new(_haContext, "sensor.sm_f741w_battery_level"); } @@ -1518,7 +1522,7 @@ public partial record NumericSensorAttributes public IReadOnlyList? PairedDevices { get; init; } [JsonPropertyName("ip6_addresses")] - public IReadOnlyList? Ip6Addresses { get; init; } + public object? Ip6Addresses { get; init; } } public partial record SttEntity : Entity, SttAttributes> @@ -4007,6 +4011,16 @@ public partial class NetdaemonServices { _haContext.CallService("netdaemon", "spotify_play_artist", null, data); } + + public void SpotifyPlayPlaylist(object? data = null) + { + _haContext.CallService("netdaemon", "spotify_play_playlist", null, data); + } + + public void SpotifyPlaySong(object? data = null) + { + _haContext.CallService("netdaemon", "spotify_play_song", null, data); + } } public partial record NetdaemonEntityCreateParameters diff --git a/devices/homie/modules/home-assistant/netdaemon/default.nix b/devices/homie/modules/home-assistant/netdaemon/default.nix index 056cf057..d346686c 100644 --- a/devices/homie/modules/home-assistant/netdaemon/default.nix +++ b/devices/homie/modules/home-assistant/netdaemon/default.nix @@ -48,7 +48,7 @@ in { ]; text = '' # Install codegen - dotnet tool install --create-manifest-if-needed NetDaemon.HassModel.CodeGen + dotnet tool install --create-manifest-if-needed NetDaemon.HassModel.CodeGen --version "$(cat ./.version)" # Run it dotnet tool run nd-codegen -token "$(sed 's/HomeAssistant__Token=//' ${secrets.netdaemon.path})" @@ -71,6 +71,9 @@ in { $(nix build --no-link --print-out-paths --impure --expr "let self = builtins.getFlake (\"$FLAKE\"); inherit (self.nixosConfigurations.homie) pkgs; in (pkgs.callPackage $FLAKE/devices/homie/modules/home-assistant/netdaemon/package.nix {}).fetch-deps") . alejandra . rm -r "$FLAKE/.config" + + sed -i "s/finalImageTag = .*/finalImageTag = \"$(cat ./.version)\";/" ./images/netdaemon.nix + updateImages . ''; }) ]; diff --git a/devices/homie/modules/home-assistant/netdaemon/netdaemon.csproj b/devices/homie/modules/home-assistant/netdaemon/netdaemon.csproj index 616389a0..05390222 100644 --- a/devices/homie/modules/home-assistant/netdaemon/netdaemon.csproj +++ b/devices/homie/modules/home-assistant/netdaemon/netdaemon.csproj @@ -6,6 +6,7 @@ 12.0 enable netdaemon + $([System.IO.File]::ReadAllText(".version")) diff --git a/devices/homie/modules/home-assistant/netdaemon/package.nix b/devices/homie/modules/home-assistant/netdaemon/package.nix index a1f7b475..9770921a 100644 --- a/devices/homie/modules/home-assistant/netdaemon/package.nix +++ b/devices/homie/modules/home-assistant/netdaemon/package.nix @@ -1,22 +1,26 @@ { + lib, buildDotnetModule, dotnetCorePackages, - nix-gitignore, }: let + inherit (lib) any hasInfix hasSuffix removeSuffix; + + srcDirs = ["apps"]; + srcPatterns = [".cs" ".csproj" ".json" ".version"]; + pname = "netdaemon-config"; in buildDotnetModule { inherit pname; - version = "0.0.0"; + version = removeSuffix "\n" (builtins.readFile ./.version); - src = - nix-gitignore.gitignoreSource [ - "*.nix" - ".direnv" - ".envrc" - "images" - ] - ./.; + src = builtins.path { + name = "netdaemon-src"; + path = ./.; + filter = file: type: + (type == "directory" && any (s: hasInfix s file) srcDirs) + || any (s: hasSuffix s file) srcPatterns; + }; projectFile = "netdaemon.csproj"; nugetDeps = ./deps.nix; diff --git a/nixosModules/borgbackup/module.nix b/nixosModules/borgbackup/module.nix index aaccce31..e0ede4a0 100644 --- a/nixosModules/borgbackup/module.nix +++ b/nixosModules/borgbackup/module.nix @@ -4,8 +4,9 @@ pkgs, ... }: let - inherit (lib) all any attrValues findSingle length mapAttrs mkIf mkOption types; - inherit (builtins) filter hasAttr listToAttrs removeAttrs; + inherit (lib) mkIf mkOption types; + inherit (lib.lists) all any filter findSingle length; + inherit (lib.attrsets) attrValues hasAttr listToAttrs mapAttrs removeAttrs; inherit (config.sops) secrets; inherit (config.vars) hostName; diff --git a/nixosModules/esphome-plus/default.nix b/nixosModules/esphome-plus/default.nix index 583ee702..f46058ac 100644 --- a/nixosModules/esphome-plus/default.nix +++ b/nixosModules/esphome-plus/default.nix @@ -4,22 +4,11 @@ pkgs, ... }: let - inherit - (lib) - concatMapStringsSep - converge - elem - filterAttrsRecursive - getExe - mapAttrsToList - mkForce - mkIf - mkOption - optionalAttrs - optionals - optionalString - types - ; + inherit (lib) converge getExe mkOption types; + inherit (lib.modules) mkForce mkIf; + inherit (lib.lists) elem optionals; + inherit (lib.strings) concatMapStringsSep optionalString; + inherit (lib.attrsets) mapAttrsToList filterAttrsRecursive optionalAttrs; cfg = config.services.esphome; diff --git a/nixosModules/wyoming-plus/default.nix b/nixosModules/wyoming-plus/default.nix index 47388af8..48dee898 100644 --- a/nixosModules/wyoming-plus/default.nix +++ b/nixosModules/wyoming-plus/default.nix @@ -4,20 +4,10 @@ pkgs, ... }: let - inherit - (lib) - attrNames - concatMapStringsSep - concatStringsSep - filterAttrs - listToAttrs - map - mkForce - mkIf - mkOverride - nameValuePair - optionalString - ; + inherit (lib.lists) map; + inherit (lib.modules) mkForce mkIf mkOverride; + inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString; + inherit (lib.attrsets) attrNames nameValuePair filterAttrs listToAttrs; cfg = config.services.wyoming; in {