depot/third_party/nixpkgs/pkgs/servers/home-assistant/custom-components
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00
..
adaptive_lighting Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
alarmo Project import generated by Copybara. 2024-07-27 08:49:29 +02:00
auth-header Project import generated by Copybara. 2024-04-21 17:54:59 +02:00
average Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
awtrix Project import generated by Copybara. 2024-06-24 14:47:55 -04:00
better_thermostat Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
bodymiscale Project import generated by Copybara. 2024-10-04 18:56:33 +02:00
dwd Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
elevenlabs_tts Project import generated by Copybara. 2024-07-27 08:49:29 +02:00
emporia_vue Project import generated by Copybara. 2024-02-29 21:09:43 +01:00
epex_spot Project import generated by Copybara. 2024-07-01 15:47:52 +00:00
frigate Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
garmin_connect Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
govee-lan Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
gpio Project import generated by Copybara. 2024-02-29 21:09:43 +01:00
homematicip_local Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
indego Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
local_luftdaten Project import generated by Copybara. 2024-04-21 17:54:59 +02:00
localtuya Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
mass Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
midea-air-appliances-lan Project import generated by Copybara. 2024-04-21 17:54:59 +02:00
midea_ac Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
midea_ac_lan Project import generated by Copybara. 2024-06-05 17:53:02 +02:00
miele Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
moonraker Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
nest_protect Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
ntfy Project import generated by Copybara. 2024-05-15 17:35:15 +02:00
omnik_inverter Project import generated by Copybara. 2024-06-20 20:27:18 +05:30
prometheus_sensor Project import generated by Copybara. 2024-06-05 17:53:02 +02:00
samsungtv-smart Project import generated by Copybara. 2024-07-27 08:49:29 +02:00
sensi Project import generated by Copybara. 2024-04-21 17:54:59 +02:00
smartir Project import generated by Copybara. 2024-05-15 17:35:15 +02:00
smartthinq-sensors Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
solax_modbus Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
solis-sensor Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
somweb Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
spook Project import generated by Copybara. 2024-06-24 14:47:55 -04:00
tuya_local Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
volkswagen_we_connect_id Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
volkswagencarnet Project import generated by Copybara. 2024-07-27 08:49:29 +02:00
waste_collection_schedule Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
xiaomi_gateway3 Project import generated by Copybara. 2024-09-26 11:04:55 +00:00
xiaomi_miot Project import generated by Copybara. 2024-09-19 17:19:46 +03:00
yassi Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
default.nix Project import generated by Copybara. 2024-10-11 07:15:48 +02:00
README.md Project import generated by Copybara. 2024-07-27 08:49:29 +02:00

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.