Home Assistant: Difference between revisions

imported>Mweinelt
imported>Mweinelt
No edit summary
Line 1: Line 1:
[https://www.home-assistant.io/ Home Assistant] is an open source home automation software that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts.  
[https://www.home-assistant.io/ Home Assistant] is an open source home automation software that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts.  


= Limited upstream support =
= Installation methods =


Upstream has defined several installation methods which they are willing to support. NixOS is obviously not one of them. If you find a problem you can still report it upstream if you are certain that the issue is relevant to upstreams supported installation methods as well. If not, or if in doubt, please open an isssue on the nixpkgs issue tracker or visit us via matrix in [https://matrix.to/#/#nixos-homeautomation:lossy.network?via=lossy.network&via=matrix.org&via=kack.it #nixos-homeautomation:lossy.network].
Upstream has defined several installation methods which they are willing to support. The NixOS module is not one of them. When you find a problem you can still report it upstream, if you are certain that the issue is relevant to upstream supported installation methods as well. If not, or if in doubt, please open an isssue on the nixpkgs issue tracker or visit the [https://matrix.to/#/#nixos-homeautomation:lossy.network?via=lossy.network&via=matrix.org&via=kack.it NixOS Home-Automation] (#nixos-homeautomation:lossy.network) Matrix room.
 
== Virtual machine ==
 
You could run your Home Assistant in a virtual machine, with your NixOS host providing the hypervisor.
 
* [https://www.home-assistant.io/installation/linux#install-home-assistant-operating-system Install Home Assistant Operating System (home-assistant.io)]
* [https://myme.no/posts/2021-11-25-nixos-home-assistant.html NixOS: Headless Home Assistant VM (myme.no)]
 
'''TODO:''' add example configuration
 
== OCI container ==
 
You could run your Home Assistant in any kind of container runtime
 
* [https://www.home-assistant.io/installation/linux#install-home-assistant-container Install Home Assistant Container (home-assistant.io)]
 
'''TODO:''' add example configuration
 
== NixOS Module ==
 
You could run home-assistant using the NixOS module system at `services-home-assistant`. As of 2021-11-28 we have roughly 70% of component dependencies packaged. There are two major ways of running home-assistant from the module system:
 
=== Declarative configuration ===
 
Set up your home-assistant by configuring <code>services.home-assistant.config</code> if it were your home-assistant configuration. The module parses the root and platforms level to automatically discover integrations used and will add them to your home-assistant package. The following is a minimal starting configuration, that has all the dependencies that are required for the configuration flow, that creates your initial user.
 
<syntaxHighlight lang=nix>
{
 
  services.home-assistant = {
    enable = false;
    # Good starting config, that will get you through the configuration
    # flow, that has a hard dependency on a few components.
    #
    # Components might not actually have YAML configuration, but
    # mentioning them in the configuration will get their dependencies
    # loaded.
    config = {
      # https://www.home-assistant.io/integrations/default_config/
      default_config = {};
      # https://www.home-assistant.io/integrations/esphome/
      esphome = {};
      # https://www.home-assistant.io/integrations/met/
      met = {};
    };
  };
}
</syntaxHighlighting>
 
 
=== Reusing existing YAML configuration ===
 
The module also supports passing it an existing configuration, however that comes with certain drawbacks. For example we cannot automatically detect the components, that your configuration requires. In that scenario you will need to resolve dependencies manually using <code>extraComponents</code>. Also you will be unable to reuse configuration values between parts of your NixOS configuration. A barebones setup to get you started may look like this:
 
<syntaxHighlight lang=nix>
{
  services.home-assistant = {
    enable = true;
    # Pass the path to the directory where your configuration.yaml
    # resides, /var/lib/hass might be a good location.
    configDir = /var/lib/hass;
    # Override the package to handle dependency management manually
    package = (pkgs.home-assistant.override {
      # https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/home-assistant/component-packages.nix
      extraComponents = [
        "default_config"
        "esphome"
        "met"
      ];
      extraPackages = py: with py; [
        # Are you using a database server for youre recorder?
        # https://www.home-assistant.io/integrations/recorder/
        #mysqlclient
        #psycopg2
 
      ];
    }).overrideAttrs (oldAttrs: {
      # Don't run package tests, they take a long time
      doInstallCheck = false;
    });
  };
}
</syntaxHighlighting>


= Running a recent version using an overlay =  
= Running a recent version using an overlay =