nixpkgs/pkgs/servers/home-assistant/custom-components
2024-05-10 10:14:17 +02:00
..
adaptive_lighting
auth-header
better_thermostat home-assistant-custom-components.better_thermostat: 1.5.0-beta7 -> 1.5.0 2024-04-19 08:37:41 -07:00
emporia_vue
epex_spot
frigate
govee-lan
gpio
homematicip_local home-assistant-custom-components.homematicip_local: 1.59.0 -> 1.60.1 2024-04-26 17:41:29 -07:00
indego
local_luftdaten
localtuya
midea-air-appliances-lan
miele home-assistant-custom-components.miele: 0.1.19 -> 2024.3.0 2024-04-20 22:27:02 +02:00
moonraker
ntfy home-assistant-custom-component.ntfy: 1.0.2 -> 1.1.0-pre.2 2024-05-10 10:14:17 +02:00
omnik_inverter
prometheus_sensor
sensi
smartir home-assistant-custom-components.smartir: init at 1.17.9 2024-04-17 21:00:03 +08:00
smartthinq-sensors
waste_collection_schedule
xiaomi_gateway3 home-assistant-custom-components.xiaomi_gateway3: init at 4.0.3 2024-04-18 20:16:27 +08:00
xiaomi_miot home-assistant-custom-components.xiaomi_miot: init at 0.7.17 2024-04-17 20:56:29 +08:00
yassi
default.nix home-assistant-custom-component.ntfy: fix typo 2024-05-08 17:52:41 +02:00
README.md

Packaging guidelines

buildHomeAssistantComponent

Custom components should be packaged using the buildHomeAssistantComponent function, that is provided at top-level. It builds upon buildPythonPackage but uses a custom install and check phase.

Python runtime dependencies can be directly consumed as unqualified function arguments. Pass them into propagatedBuildInputs, for them to be available to Home Assistant.

Out-of-tree components need to use Python packages from home-assistant.python.pkgs as to not introduce conflicting package versions into the Python environment.

Example Boilerplate:

{ lib
, buildHomeAssistantcomponent
, fetchFromGitHub
}:

buildHomeAssistantComponent {
  # owner, domain, version

  src = fetchFromGithub {
    # owner, repo, rev, hash
  };

  propagatedBuildInputs = [
    # python requirements, as specified in manifest.json
  ];

  meta = with lib; {
    # changelog, description, homepage, license, maintainers
  };
}

Package attribute

The attribute name must reflect the domain as seen in the manifest.json, which in turn will match the python module name below in the custom_components/ directory.

Example:

The project mweinelt/ha-prometheus-sensor would receive the attribute name "prometheus_sensor", because both domain in the manifest.json as well as the module name are prometheus_sensor.

Package name

The pname attribute is a composition of both owner and domain.

Don't set pname, set owner and domain instead.

Exposing the domain attribute separately allows checking for conflicting components at eval time.

Manifest check

The buildHomeAssistantComponent builder uses a hook to check whether the dependencies specified in the manifest.json are present and inside the specified version range. It also makes sure derivation and manifest agree about the domain name.

There shouldn't be a need to disable this hook, but you can set dontCheckManifest to true in the derivation to achieve that.