Home Assistant: Difference between revisions
imported>Mweinelt |
imported>Mweinelt |
||
| Line 48: | Line 48: | ||
=== Declarative configuration === | === Declarative configuration === | ||
Set up your home-assistant by configuring the <code>services.home-assistant.config</code> attribute set as if it were your home-assistant YAML configuration. The module parses the root and platforms level to automatically discover integrations used and will add | Set up your home-assistant by configuring the <code>services.home-assistant.config</code> attribute set as if it were your home-assistant YAML configuration. The module parses the root and platforms level to automatically discover integrations used and will add their dependencies to your home-assistant package. | ||
The following is a minimal starting configuration, that has all the dependencies that are required to complete the initial configuration flow, that creates your first user. | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
{ | { | ||
services.home-assistant = { | services.home-assistant = { | ||
enable = true; | enable = true; | ||
extraComponents = [ | |||
# Components required to complete the onboarding | |||
"met" | |||
"radio_browser" | |||
]; | |||
config = { | config = { | ||
# Includes dependencies for a basic setup | |||
# https://www.home-assistant.io/integrations/default_config/ | # https://www.home-assistant.io/integrations/default_config/ | ||
default_config = {}; | default_config = {}; | ||
}; | }; | ||
}; | }; | ||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||
===== First start ===== | |||
On your first start you may see multiple <code><nowiki>ModuleNotFoundError</nowiki></code> in Home Assistants journal log. These are dependencies required to set up devices Home Assistant already found on the network. | |||
The appropriate component to load can be looked up in the <code><nowiki>component-packages.nix</nowiki></code> file, that gets auto-generated as part of the packaging process. | |||
For example we can map the following error to | |||
ModuleNotFoundError: No module named 'aioesphomeapi' | |||
the <code><nowiki>esphome</nowiki></code> module quite easily. | |||
<syntaxHighlight lang=nix> | |||
{ | |||
version = "2022.8.0"; | |||
components = { | |||
[...] | |||
"esphome" = ps: with ps; [ | |||
aioesphomeapi | |||
aiohttp-cors | |||
ifaddr | |||
zeroconf | |||
]; | |||
[...] | |||
</syntaxHighlight> | |||
* https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/home-assistant/component-packages.nix | |||
==== Using components without YAML configuration ==== | ==== Using components without YAML configuration ==== | ||