From a1dbb153bcd5562bb3430f3a9f5749b2ad29c290 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 16 Feb 2025 11:49:38 +0000 Subject: [PATCH] Start adding custom components, currently not working --- system/Legion.nix | 2 +- .../customComponents/myenergi.nix | 18 ++++++++++++ .../customComponents/pymyenergi.nix | 29 +++++++++++++++++++ .../default.nix} | 9 ++++-- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 system/services/home-assistant/customComponents/myenergi.nix create mode 100644 system/services/home-assistant/customComponents/pymyenergi.nix rename system/services/{home-assistant.nix => home-assistant/default.nix} (86%) diff --git a/system/Legion.nix b/system/Legion.nix index 0e9f7a0e..87bde085 100644 --- a/system/Legion.nix +++ b/system/Legion.nix @@ -5,7 +5,7 @@ ./services/caddy.nix ./services/forgejo.nix ./services/grafana.nix - ./services/home-assistant.nix + ./services/home-assistant/default.nix ./services/nix-serve.nix ./services/sshd.nix ./services/syncthing.nix diff --git a/system/services/home-assistant/customComponents/myenergi.nix b/system/services/home-assistant/customComponents/myenergi.nix new file mode 100644 index 00000000..a243b8bb --- /dev/null +++ b/system/services/home-assistant/customComponents/myenergi.nix @@ -0,0 +1,18 @@ +{ + fetchFromGitHub, + buildHomeAssistantComponent, + pymyenergi, +}: +buildHomeAssistantComponent rec { + owner = "cjne"; + domain = "myenergi"; + version = "0.0.28"; + src = fetchFromGitHub { + owner = "cjne"; + repo = "ha-myenergi"; + rev = version; + hash = "sha256-Iu9HqGX3UZXSzsZR0jTSYNOgPPqxWryyRNxw6Fxj2qU="; + }; + dependencies = [ pymyenergi ]; + ignoreVersionRequirement = [ "pymyenergi" ]; +} diff --git a/system/services/home-assistant/customComponents/pymyenergi.nix b/system/services/home-assistant/customComponents/pymyenergi.nix new file mode 100644 index 00000000..bf14982a --- /dev/null +++ b/system/services/home-assistant/customComponents/pymyenergi.nix @@ -0,0 +1,29 @@ +{ + buildPythonPackage, + fetchFromGitHub, + pytestCheckHook, + pythonOlder, + httpx, + setuptools, + pycognito, +}: + +buildPythonPackage rec { + pname = "pymyenergi"; + version = "0.2.1"; + pyproject = false; + disabled = pythonOlder "3.6"; + src = fetchFromGitHub { + owner = "cjne"; + repo = "pymyenergi"; + tag = version; + hash = "sha256-yfAc+phs8qLiYyM5j5LGDtA4fIT5LrHF3cNIhYjQemI="; + }; + build-system = [ setuptools ]; + dependencies = [ + httpx + pycognito + ]; + nativeCheckInputs = [ pytestCheckHook ]; + pythonImportsCheck = [ "pymyenergi" ]; +} diff --git a/system/services/home-assistant.nix b/system/services/home-assistant/default.nix similarity index 86% rename from system/services/home-assistant.nix rename to system/services/home-assistant/default.nix index 2190f372..7dcfd2a6 100644 --- a/system/services/home-assistant.nix +++ b/system/services/home-assistant/default.nix @@ -21,9 +21,14 @@ "prusalink" "sonos" "syncthing" + "tado" "tplink_tapo" ]; - customComponents = with pkgs.home-assistant-custom-components; [ dirigera_platform ]; + customComponents = with pkgs.home-assistant-custom-components; [ + (dirigera_platform.override { + dirigera = (pkgs.python312Packages.dirigera.overrideAttrs (final: prev: { doCheck = false; })); + }) + ]; config = { # Includes dependencies for a basic setup # https://www.home-assistant.io/integrations/default_config/ @@ -41,7 +46,7 @@ }; homeassistant = { inherit (config.location) latitude longitude; - media_dirs.music = "/var/lib/syncthing/Music"; + # media_dirs.music = "/var/lib/syncthing/Music"; }; }; };