Browse Source

Systemd service for home assistant

pull/4/head
Ales Komarek 6 years ago
parent
commit
1ea1f6fd77
2 changed files with 33 additions and 0 deletions
  1. +11
    -0
      home_assistant/files/home-assistant.service
  2. +22
    -0
      home_assistant/server.sls

+ 11
- 0
home_assistant/files/home-assistant.service View File

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=home_assistant
ExecStart=/srv/home_assistant/bin/hass --config /etc/home_assistant

[Install]
WantedBy=multi-user.target

+ 22
- 0
home_assistant/server.sls View File

- require: - require:
- file: home_assistant_config_dir - file: home_assistant_config_dir


home_assistant_service_script:
file.managed:
- name: /etc/systemd/system/home-assistant.service
- source: salt://home_assistant/files/home-assistant.service
- template: jinja
- user: root
- mode: 644
- watch_in:
- module: home_assistant_restart_systemd

home_assistant_service:
service.running:
- name: home-assistant
- enable: true
- watch:
- module: home_assistant_restart_systemd
- file: home_assistant_service_script

home_assistant_restart_systemd:
module.wait:
- name: service.systemctl_reload

{%- if server.known_device is defined %} {%- if server.known_device is defined %}


home_assistant_know_devices: home_assistant_know_devices:

Loading…
Cancel
Save