Home Assistant: Difference between revisions

imported>Krav
add example config for containerized version
imported>Simisimis
m adds automation snippet
Line 252: Line 252:
     "Z /var/lib/hass/custom_components 770 hass hass - -"
     "Z /var/lib/hass/custom_components 770 hass hass - -"
   ];
   ];
</syntaxHighlight>
== Combine declarative and UI defined automations ==
You can also declaratively define your automations while still being able to define them in Home Assistant UI. Automations defined in UI are stored in <code>/var/lib/hass/automations.yaml</code>. If you are not planning on using UI defined automations, then you can define them under  <code>services.home-assistant.config.automation</code>, otherwise split them into <code>services.home-assistant.config."automation manual"</code> and <code>services.home-assistant.config."automation ui"</code>, like so:
<syntaxHighlight lang=nix>
  services.home-assistant.config =
  {
    "automation manual" = [
      {
        alias = "living room plug off";
        trigger = {
          platform = "time";
          at = "22:00";
        };
        action = {
          type = "turn_off";
          device_id = "someID"; #Inspect yaml of automation created in UI
          entity_id = "switch.living_room_plug";
          domain = "switch";
        };
      }
    "automation ui" = "!include automations.yaml";
}
</syntaxHighlight>
</syntaxHighlight>