Browse Source

Getting ready

pull/1/head
Ales Komarek 8 years ago
parent
commit
3d81462f9c
11 changed files with 104 additions and 36 deletions
  1. +8
    -6
      README.rst
  2. +11
    -0
      home_assistant/files/configuration.yaml
  3. +0
    -1
      home_assistant/files/home_assistant.conf
  4. +2
    -0
      home_assistant/files/known_devices.yaml
  5. +1
    -0
      home_assistant/files/requirements.txt
  6. +0
    -0
      home_assistant/files/supervisor.conf
  7. +3
    -20
      home_assistant/map.jinja
  8. +0
    -8
      home_assistant/meta/sensu.yml
  9. +1
    -1
      home_assistant/meta/sphinx.yml
  10. +54
    -0
      home_assistant/server.sls
  11. +24
    -0
      metadata/service/server/single.yml

+ 8
- 6
README.rst View File

@@ -1,23 +1,25 @@

==================================
home_assistant
Home Assistant
==================================

Service home_assistant description
Home Assistant is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control.
Sample pillars
==============

Single home_assistant service
Single homeassistant service

.. code-block:: yaml

home_assistant:
server:
enabled: true
version: icehouse
bind:
address: 0.0.0.0
port: 8123

Read more
=========

* links
* https://home-assistant.io/getting-started/

+ 11
- 0
home_assistant/files/configuration.yaml View File

@@ -0,0 +1,11 @@
{%- from "home_assistant/map.jinja" import server with context %}
{%- from "linux/map.jinja" import system with context %}
homeassistant:
name: {{ server.name }}
latitude: {{ server.latitude }}
longitude: {{ server.longitude }}
temperature_unit: {{ server.temperature_unit }}
time_zone: {{ system.timezone }}
http:
api_password: {{ server.api_password }}
{{ server.plugin|yaml(False) }}

+ 0
- 1
home_assistant/files/home_assistant.conf View File

@@ -1 +0,0 @@
# Service config file

+ 2
- 0
home_assistant/files/known_devices.yaml View File

@@ -0,0 +1,2 @@
{%- from "home_assistant/map.jinja" import server with context %}
{{ server.known_device|yaml(False) }}

+ 1
- 0
home_assistant/files/requirements.txt View File

@@ -0,0 +1 @@
homeassistant

+ 0
- 0
home_assistant/files/supervisor.conf View File


+ 3
- 20
home_assistant/map.jinja View File

@@ -1,29 +1,12 @@

{%- set source_engine = salt['pillar.get']('home_assistant:server:source:engine') %}

{%- load_yaml as base_defaults %}
{%- if source_engine == 'git' %}
Debian:
pkgs:
- python-psycopg2
dir:
base: /srv/home_assistant/venv
home: /var/lib/home_assistant
workspace: /srv/home_assistant/workspace
RedHat:
pkgs:
- python-psycopg2
dir:
base: /srv/home_assistant/venv
home: /var/lib/home_assistant
workspace: /srv/home_assistant/workspace
{%- else %}
Debian:
pkgs:
- helpdesk
- python3-dev
- python3-pip
dir:
base: /usr/lib/home_assistant
{%- endif %}
base: /srv/home_assistant
{%- endload %}

{%- set server = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('home_assistant:server')) %}

+ 0
- 8
home_assistant/meta/sensu.yml View File

@@ -1,8 +0,0 @@
# Sample check
check:
local_home_assistant_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -C home_assistant -u home_assistant -c 1:1"
interval: 60
occurrences: 1
subscribers:
- local-home_assistant-server

+ 1
- 1
home_assistant/meta/sphinx.yml View File

@@ -2,7 +2,7 @@
# Fill in documentation details
doc:
name: home_assistant
description: Some service info
description: Home Assistant is an open-source home automation platform.
role:
server:
name: server

+ 54
- 0
home_assistant/server.sls View File

@@ -1,4 +1,58 @@
{%- from "home_assistant/map.jinja" import server with context %}
{%- if server.enabled %}

home_assistant_packages:
pkg.installed:
- names: {{ server.pkgs }}

{{ server.dir.base }}:
virtualenv.manage:
- requirements: salt://home_assistant/files/requirements.txt
- require:
- pkg: home_assistant_packages
- user: home_assistant

home_assistant_user:
user.present:
- name: home_assistant
- system: true
- home: {{ server.dir.base }}
- require:
- virtualenv: {{ server.dir.base }}

home_assistant_dir:
file.directory:
- names:
- /etc/home_assistant
- /var/log/home_assistant
- mode: 700
- makedirs: true
- user: home_assistant
- require:
- virtualenv: {{ server.dir.base }}

home_assistant_config:
file.managed:
- name: /etc/home_assistant/configuration.yaml
- source: salt://home_assistant/files/configuration.yaml
- template: jinja
- user: home_assistant
- mode: 600
- require:
- file: home_assistant_dir

{%- if server.known_device is defined %}

home_assistant_know_devices:
file.managed:
- name: /etc/home_assistant/known_devices.yaml
- source: salt://home_assistant/files/known_devices.yaml
- template: jinja
- user: home_assistant
- mode: 600
- require:
- file: home_assistant_dir

{%- endif %}

{%- endif %}

+ 24
- 0
metadata/service/server/single.yml View File

@@ -8,3 +8,27 @@ parameters:
enabled: true
bind:
address: 0.0.0.0
port: 8123
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 50.0
longitude: 14.4
# C for Celcius, F for Fahrenheit
temperature_unit: C
time_zone: Europe/Prague
plugin:
# View all events in a logbook
logbook:
# Discover some devices automatically
discovery:
# Enables support for tracking state changes over time.
history:
# Checks for available updates
updater:
# Enables the frontend
frontend:
# Allows you to issue voice commands from the frontend
conversation:
# Track the sun
sun:

Loading…
Cancel
Save