diff --git a/pkgs/development/python-modules/sofar-modbus/default.nix b/pkgs/development/python-modules/sofar-modbus/default.nix new file mode 100644 index 000000000000..8b64ece285f4 --- /dev/null +++ b/pkgs/development/python-modules/sofar-modbus/default.nix @@ -0,0 +1,53 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + hatchling, + modbus-connection, + pyprojectVersionPatchHook, + pytest-asyncio, + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "sofar-modbus"; + version = "0.5.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "darkrain-nl"; + repo = "sofar-modbus"; + tag = finalAttrs.version; + hash = "sha256-rigrnxn/eHu98S0RHDdJXs7zx5RovCpQnsvqUCkY0yo="; + }; + + nativeBuildInputs = [ + pyprojectVersionPatchHook + ]; + + build-system = [ + hatchling + ]; + + dependencies = [ + modbus-connection + ] + ++ modbus-connection.optional-dependencies.tmodbus; + + nativeCheckInputs = [ + pytest-asyncio + pytestCheckHook + ]; + + pythonImportsCheck = [ + "sofar_modbus" + ]; + + meta = { + description = "Read Sofar Solar inverters over Modbus"; + homepage = "https://github.com/darkrain-nl/sofar-modbus"; + changelog = "https://github.com/darkrain-nl/sofar-modbus/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.jamiemagee ]; + }; +}) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 32fe4180eb75..c379d975c456 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -6686,9 +6686,10 @@ [ modbus-connection pymodbus + sofar-modbus tmodbus ] - ++ modbus-connection.optional-dependencies.tmodbus; # missing inputs: sofar-modbus + ++ modbus-connection.optional-dependencies.tmodbus; "solaredge" = ps: with ps; [ aiosolaredge @@ -9241,6 +9242,7 @@ "snmp" "snoo" "snooz" + "sofar" "solaredge" "solarlog" "solarman" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 35732c879307..175cdf806f63 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -19296,6 +19296,8 @@ self: super: with self; { soco = callPackage ../development/python-modules/soco { }; + sofar-modbus = callPackage ../development/python-modules/sofar-modbus { }; + softlayer = callPackage ../development/python-modules/softlayer { }; solaredge-local = callPackage ../development/python-modules/solaredge-local { };