system_administration:manual_installation:8_home_assistant_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
system_administration:manual_installation:8_home_assistant_configuration [2019/10/20 11:40]
franzunix [Configuration splitting]
system_administration:manual_installation:8_home_assistant_configuration [2019/12/30 20:25]
franzunix [d-diot image v.1.3]
Line 72: Line 72:
 homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/input_select.yaml homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/input_select.yaml
 homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/shell_command.yaml homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/shell_command.yaml
 +</cli>
 +
 +In the d-diot images above v.1.2 the customize.yaml file is present by default and included in the configuration.yaml under Basic information section.
 +<cli>
 +pi@d-diot:~ $ sudo -u homeassistant -H -s
 +homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/customize.yaml
 </cli> </cli>
  
Line 138: Line 144:
 ===== LIRC ===== ===== LIRC =====
  
 +For the d-diot image v.1.2 install this packages first:
 +<cli>
 +pi@raspberrypi:~ $ cd /home/pi/build
 +pi@d-diot:~/build $ sudo apt install ./liblircclient-dev_0.10.1-5.2_armhf.deb ./liblirc-dev_0.10.1-5.2_armhf.deb
 +</cli>
 To enable the [[https://www.home-assistant.io/components/lirc/|LIRC component]] add the following lines to configuration.yaml: To enable the [[https://www.home-assistant.io/components/lirc/|LIRC component]] add the following lines to configuration.yaml:
 <file yaml /home/homeassistant/.homeassistant/configuration.yaml> <file yaml /home/homeassistant/.homeassistant/configuration.yaml>
Line 148: Line 159:
 homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.lircrc homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.lircrc
 </cli> </cli>
 +<alert type="warning" icon="glyphicon glyphicon-alert" dismiss="false">
 +In the d-diot image v.1.2 the LIRC component is disabled because of this [[https://community.home-assistant.io/t/python-lirc-on-python3-7-3/126994|issue]]. To [[https://github.com/tompreston/python-lirc/issues/26|fix the problem]] run the following commands and then enable lirc in configuration.yaml:
 +<cli>
 +pi@d-diot:~ $ sudo -u homeassistant -H -s
 +homeassistant@d-diot:/home/pi $ source /srv/homeassistant/bin/activate
 +(homeassistant) homeassistant@d-diot:/home/pi $ cd /home/homeassistant
 +(homeassistant) homeassistant@d-diot:~ $ pip3 install cython
 +(homeassistant) homeassistant@d-diot:~ $ git clone https://github.com/tompreston/python-lirc.git
 +(homeassistant) homeassistant@d-diot:~ $ find python-lirc -name '*.pyx' -exec cython {} \;
 +(homeassistant) homeassistant@d-diot:~ $ pip3 install python-lirc/
 +</cli>
 +</alert>
  
 ===== MySensors ===== ===== MySensors =====
Line 210: Line 233:
   themes:  !include_dir_merge_named themes   themes:  !include_dir_merge_named themes
 </file> </file>
 +
 +<alert type="warning" icon="glyphicon glyphicon-alert" dismiss="false">
 +In the d-diot image v.1.3 and above the themes are not more pre-installed because a better way to manage exist: the Home Assistant Community Store (HACS)! See [[how_to:home_assistant:hacs|here]] to know more. 
 +</alert>
  
 ===== Raspberry sensors ===== ===== Raspberry sensors =====
Line 561: Line 588:
 Add the following lines: Add the following lines:
 <file bash /home/homeassistant/.homeassistant/dehydrated/hook.sh> <file bash /home/homeassistant/.homeassistant/dehydrated/hook.sh>
-    #!/usr/bin/env bash +#!/usr/bin/env bash 
-    set -e +set -e 
-    set -u +set -u 
-    set -o pipefail+set -o pipefail
            
-    domain="your_subdomain.duckdns.org" +domain="your_subdomain.duckdns.org" 
-    token="your_token"+token="your_token"
            
-    case "$1" in +case "$1" in 
-        "deploy_challenge"+    "deploy_challenge"
-            curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=$4" +       curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=$4" 
-            echo +        echo 
-            ;; +        ;; 
-        "clean_challenge"+     "clean_challenge"
-            curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=removed&clear=true" +        curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=removed&clear=true" 
-            echo +        echo 
-            ;; +        ;; 
-        "deploy_cert"+     "deploy_cert"
-            sudo systemctl restart home-assistant@homeassistant.service +        sudo systemctl restart home-assistant@homeassistant.service 
-            ;; +        ;; 
-        "unchanged_cert"+     "unchanged_cert"
-            ;; +        ;; 
-        "startup_hook"+     "startup_hook"
-            ;; +        ;; 
-        "exit_hook"+     "exit_hook"
-            ;; +        ;; 
-        *) +    *) 
-            echo Unknown hook "${1}" +        echo Unknown hook "${1}" 
-            exit 0 +        exit 0 
-            ;; +        ;; 
-    esac+esac
 </file> </file>
 Make the hook.sh script executable: Make the hook.sh script executable:
Line 597: Line 624:
 homeassistant@d-diot:~/dehydrated $ chmod 755 hook.sh homeassistant@d-diot:~/dehydrated $ chmod 755 hook.sh
 </cli> </cli>
 +Create the file domains.txt:
 +<cli>
 +homeassistant@d-diot:~/dehydrated $ nano domains.txt
 +</cli>
 +Add the following lines
 +<file bash /home/homeassistant/.homeassistant/dehydrated/domains.txt>
 +your_subdomain.duckdns.org
 +</file>
 +
 Add the following line to configuration.yaml:  Add the following line to configuration.yaml: 
 <file yaml /home/homeassistant/.homeassistant/configuration.yaml> <file yaml /home/homeassistant/.homeassistant/configuration.yaml>
Line 1268: Line 1304:
 </file> </file>
 </hidden> </hidden>
 +==== d-diot image v.1.2 ====
 +<hidden Click here to see the file configuration.yaml>
 +<file yaml /home/homeassistant/.homeassistant/configuration.yaml>
 +# Configure a default setup of Home Assistant (frontend, api, etc)
 +default_config:
  
 +# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
 +# http:
 +#   base_url: example.duckdns.org:8123
 +
 +# Text to speech
 +tts:
 +  - platform: google_translate
 +
 +# Configuration split
 +group: !include groups.yaml
 +automation: !include automations.yaml
 +script: !include scripts.yaml
 +
 +#################### d-diot config ###############################################
 +
 +# Basic information
 +#homeassistant:
 +#  latitude: 32.87336
 +#  longitude: 117.22743
 +#  elevation: 430
 +#  unit_system: metric
 +#  time_zone: America/Los_Angeles
 +#  name: Home
 +
 +
 +# Configuration split
 +sensor: !include sensors.yaml
 +binary_sensor: !include binary_sensors.yaml
 +switch: !include switches.yaml
 +input_select: !include input_select.yaml
 +shell_command: !include shell_command.yaml
 +
 +# Panel Iframe
 +panel_iframe:
 +  lircweb:
 +    title: 'Ir remotes'
 +    url: 'http://d-diot.local:3000'
 +    icon: mdi:radiobox-marked
 +  shellinabox:
 +    title: 'Shell'
 +    url: 'https://d-diot.local:4200'
 +    icon: mdi:powershell
 +  esphome:
 +    title: 'ESPHome'
 +    url: 'http://d-diot.local:6052'
 +    icon: mdi:chip
 +
 +# Mosquitto MQTT broker
 +mqtt:
 +  broker: localhost
 +  port: 1883
 +#  username: 
 +#  password: 
 +  discovery: true
 +  discovery_prefix: homeassistant
 +  birth_message:
 +    topic: 'hass/status'
 +    payload: 'online'
 +  will_message:
 +    topic: 'hass/status'
 +    payload: 'offline'
 +
 +# LIRC
 +#lirc:
 +
 +# Mysensors
 +mysensors:
 +  gateways:
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-rfm69.json'
 +      tcp_port: 5003
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-nrf24.json'
 +      tcp_port: 5004
 +  optimistic: false
 +  persistence: true
 +  version: '2.3'
 +
 +# RFLink
 +rflink:
 +  port: /dev/serial0
 +  wait_for_ack: true
 +
 +# Webui Themes
 +frontend:
 +  themes:  !include_dir_merge_named themes
 +
 +# Tracker
 +#device_tracker:
 +# NMAP
 +#  - platform: nmap_tracker
 +#    hosts: 192.168.1.0/24
 +#    home_interval: 10
 +#    exclude:
 +#      - 192.168.1.71
 +# Bluetooth
 +#  - platform: bluetooth_tracker
 +
 +# MySQL recorder
 +recorder:
 +  purge_keep_days: 3
 +  purge_interval: 1
 +  db_url: !secret mariadb_connection_url
 +  include:
 +    entities:
 +      - sensor.processor_use
 +      - sensor.memory_use_percent
 +      - sensor.disk_use_percent
 +      - sensor.load_5m
 +      - sensor.cpu_temperature
 +
 +#duckdns:
 +#  domain: your_duckdns_subdomain_without_.duckdns.org
 +#  access_token: !secret duckdns_token
 +
 +# SSL encryption and DuckDNS access
 +#http:
 +#  base_url: your_subdomain.duckdns.org:8123
 +#  ssl_certificate: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/fullchain.pem
 +#  ssl_key: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/privkey.pem
 +
 +# Enable logger to individuate the RFLink devices
 +#logger:
 +#  default: error
 +#  logs:
 +#    rflink: debug
 +#    homeassistant.components.rflink: debug
 +</file>
 +</hidden>
 +<hidden Click here to see the file sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/sensors.yaml>
 +# System monitor
 +- platform: systemmonitor
 +  resources:
 +    - type: disk_use_percent
 +      arg: /
 +    - type: disk_use
 +      arg: /
 +    - type: disk_free
 +      arg: /
 +    - type: memory_free
 +    - type: memory_use_percent
 +    - type: memory_use 
 +    - type: swap_use_percent
 +    - type: swap_use
 +    - type: swap_free
 +#    - type: load_1m  
 +    - type: load_5m
 +#    - type: load_15m
 +    - type: network_in
 +      arg: eth0
 +    - type: network_out
 +      arg: eth0
 +    - type: network_in
 +      arg: wlan0
 +    - type: network_out
 +      arg: wlan0
 +#packets_in Interface, e.g., eth0
 +#packets_out Interface, e.g., eth0
 +    - type: ipv4_address
 +      arg: eth0
 +    - type: ipv4_address
 +      arg: wlan0
 +#ipv6_address Interface, e.g., eth0
 +    - type: processor_use 
 +#    - type: process
 +#      arg: octave-cli
 +    - type: last_boot
 + 
 +#CPU temp
 +- platform: command_line
 +  name: CPU Temperature
 +  command: "cat /sys/class/thermal/thermal_zone0/temp"
 +  # If errors occur, remove degree symbol below
 +  unit_of_measurement: "°C"
 +  value_template: '{{ value | multiply(0.001) | round(1) }}'
 +</file>
 +</hidden>
 +<hidden Click here to see the file binary_sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/binary_sensors.yaml>
 +# MQTT binary sensor
 +- platform: mqtt
 +  name: "OLED status"
 +  state_topic: "oled/status"
 +  payload_on: 1
 +  payload_off: 0
 +  qos: 0
 +  device_class: light
 +</file>
 +</hidden>
 +<hidden Click here to see the file automations.yaml>
 +<file yaml /home/homeassistant/.homeassistant/automations.yaml>
 +- id: '1551909333005'
 +  alias: Oled - Input to MQTT
 +  trigger:
 +  - entity_id: input_select.oled
 +    platform: state
 +  condition: []
 +  action:
 +  - data_template:
 +      payload: '{{ states(''input_select.oled'') }}'
 +      retain: false
 +      topic: oled/set
 +    service: mqtt.publish
 +- id: '1551910316293'
 +  alias: Oled - MQTT to Input
 +  trigger:
 +  - platform: mqtt
 +    topic: oled/state
 +  condition: []
 +  action:
 +  - data_template:
 +      entity_id: input_select.oled
 +      option: '{{ trigger.payload }}'
 +    service: input_select.select_option
 +- id: '1552122444469'
 +  alias: Oled-Autostart
 +  trigger:
 +  - event: start
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.start_oled
 +- id: '1552128743168'
 +  alias: Oled-Autostop
 +  trigger:
 +  - event: shutdown
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.stop_oled
 +</file>
 +</hidden>
 +<hidden Click here to see the file groups.yaml>
 +<file yaml /home/homeassistant/.homeassistant/groups.yaml>
 +# Oled related automations
 +enable_oled:
 +  name: "Enable Oled"
 +  entities:
 +    - automation.oled_autostart
 +    - automation.oled_autostop
 +    - automation.oled_input_to_mqtt
 +    - automation.oled_mqtt_to_input
 +  all: true
 +</file>
 +</hidden>
 +<hidden Click here to see the file input_select.yaml>
 +<file yaml /home/homeassistant/.homeassistant/input_select.yaml>
 +oled:
 +  name: Mode
 +  options:
 +    - Turn off
 +    - Wifi
 +    - Ethernet
 +    - Clock
 +    - Load
 +    - Disk usage
 +    - CPU Temp
 +    - RAM
 +  initial: Clock
 +  icon: mdi:fullscreen
 +</file>
 +</hidden>
 +<hidden Click here to see the file secrets.yaml>
 +<file yaml /home/homeassistant/.homeassistant/secrets.yaml>
 +# Use this file to store secrets like usernames and passwords.
 +# Learn more at https://home-assistant.io/docs/configuration/secrets/
 +some_password: welcome
 +
 +#################### d-diot config ############################################
 +
 +# MySQL database
 +mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant
 +
 +# DuckDNS token
 +#duckdns_token: your_token_here
 +</file>
 +</hidden>
 +<hidden Click here to see the file shell_command.yaml>
 +<file yaml /home/homeassistant/.homeassistant/shell_command.yaml>
 +start_oled: /home/homeassistant/oled/./oled.py &
 +stop_oled: mosquitto_pub -h localhost -t oled/set -m 'Turn off' && sleep 5 && killall oled.py &
 +</file>
 +</hidden>
 +<hidden Click here to see the file switches.yaml>
 +<file yaml /home/homeassistant/.homeassistant/switches.yaml>
 +# Template switches
 +- platform: template
 +  switches:
 +    oled:
 +      friendly_name: "Status"
 +      value_template: "{{ is_state('binary_sensor.oled_status', 'on') }}"
 +      turn_on:
 +        service: shell_command.start_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +      turn_off:
 +        service: shell_command.stop_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +</file>
 +</hidden>
 +
 +==== d-diot image v.1.2.1 ====
 +<hidden Click here to see the file configuration.yaml>
 +<file yaml /home/homeassistant/.homeassistant/configuration.yaml>
 +# Configure a default setup of Home Assistant (frontend, api, etc)
 +default_config:
 +
 +# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
 +# http:
 +#   base_url: example.duckdns.org:8123
 +
 +# Text to speech
 +tts:
 +  - platform: google_translate
 +
 +# Configuration split
 +group: !include groups.yaml
 +automation: !include automations.yaml
 +script: !include scripts.yaml
 +
 +#################### d-diot config ###############################################
 +
 +# Basic information
 +homeassistant:
 +#  latitude: 32.87336
 +#  longitude: 117.22743
 +#  elevation: 430
 +#  unit_system: metric
 +#  time_zone: America/Los_Angeles
 +#  name: Home
 +  customize: !include customize.yaml
 +
 +# Configuration split
 +sensor: !include sensors.yaml
 +binary_sensor: !include binary_sensors.yaml
 +switch: !include switches.yaml
 +input_select: !include input_select.yaml
 +shell_command: !include shell_command.yaml
 +
 +# Panel Iframe
 +panel_iframe:
 +  lircweb:
 +    title: 'Ir remotes'
 +    url: 'http://d-diot.local:3000'
 +    icon: mdi:radiobox-marked
 +  shellinabox:
 +    title: 'Shell'
 +    url: 'https://d-diot.local:4200'
 +    icon: mdi:powershell
 +  esphome:
 +    title: 'ESPHome'
 +    url: 'http://d-diot.local:6052'
 +    icon: mdi:chip
 +
 +# Mosquitto MQTT broker
 +mqtt:
 +  broker: localhost
 +  port: 1883
 +#  username: 
 +#  password: 
 +  discovery: true
 +  discovery_prefix: homeassistant
 +  birth_message:
 +    topic: 'hass/status'
 +    payload: 'online'
 +  will_message:
 +    topic: 'hass/status'
 +    payload: 'offline'
 +
 +# LIRC
 +lirc:
 +
 +# Mysensors
 +mysensors:
 +  gateways:
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-rfm69.json'
 +      tcp_port: 5003
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-nrf24.json'
 +      tcp_port: 5004
 +  optimistic: false
 +  persistence: true
 +  version: '2.3'
 +
 +# RFLink
 +#rflink:
 +#  port: /dev/serial0
 +#  wait_for_ack: true
 +
 +# Webui Themes
 +frontend:
 +  themes:  !include_dir_merge_named themes
 +
 +# Tracker
 +#device_tracker:
 +# NMAP
 +#  - platform: nmap_tracker
 +#    hosts: 192.168.1.0/24
 +#    home_interval: 10
 +#    exclude:
 +#      - 192.168.1.71
 +# Bluetooth
 +#  - platform: bluetooth_tracker
 +
 +# MySQL recorder
 +recorder:
 +  purge_keep_days: 3
 +  purge_interval: 1
 +  db_url: !secret mariadb_connection_url
 +  include:
 +    entities:
 +      - sensor.processor_use
 +      - sensor.memory_use_percent
 +      - sensor.disk_use_percent
 +      - sensor.load_5m
 +      - sensor.cpu_temperature
 +
 +#duckdns:
 +#  domain: your_duckdns_subdomain_without_.duckdns.org
 +#  access_token: !secret duckdns_token
 +
 +# SSL encryption and DuckDNS access
 +#http:
 +#  base_url: your_subdomain.duckdns.org:8123
 +#  ssl_certificate: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/fullchain.pem
 +#  ssl_key: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/privkey.pem
 +
 +# Enable logger to individuate the RFLink devices
 +#logger:
 +#  default: error
 +#  logs:
 +#    rflink: debug
 +#    homeassistant.components.rflink: debug
 +
 +
 +</file>
 +</hidden>
 +<hidden Click here to see the file sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/sensors.yaml>
 +# System monitor
 +- platform: systemmonitor
 +  resources:
 +    - type: disk_use_percent
 +      arg: /
 +    - type: disk_use
 +      arg: /
 +    - type: disk_free
 +      arg: /
 +    - type: memory_free
 +    - type: memory_use_percent
 +    - type: memory_use 
 +    - type: swap_use_percent
 +    - type: swap_use
 +    - type: swap_free
 +#    - type: load_1m  
 +    - type: load_5m
 +#    - type: load_15m
 +    - type: network_in
 +      arg: eth0
 +    - type: network_out
 +      arg: eth0
 +    - type: network_in
 +      arg: wlan0
 +    - type: network_out
 +      arg: wlan0
 +#packets_in Interface, e.g., eth0
 +#packets_out Interface, e.g., eth0
 +    - type: ipv4_address
 +      arg: eth0
 +    - type: ipv4_address
 +      arg: wlan0
 +#ipv6_address Interface, e.g., eth0
 +    - type: processor_use 
 +#    - type: process
 +#      arg: octave-cli
 +    - type: last_boot
 + 
 +#CPU temp
 +- platform: command_line
 +  name: CPU Temperature
 +  command: "cat /sys/class/thermal/thermal_zone0/temp"
 +  # If errors occur, remove degree symbol below
 +  unit_of_measurement: "°C"
 +  value_template: '{{ value | multiply(0.001) | round(1) }}'
 +</file>
 +</hidden>
 +<hidden Click here to see the file binary_sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/binary_sensors.yaml>
 +# MQTT binary sensor
 +- platform: mqtt
 +  name: "OLED status"
 +  state_topic: "oled/status"
 +  payload_on: 1
 +  payload_off: 0
 +  qos: 0
 +  device_class: light
 +</file>
 +</hidden>
 +<hidden Click here to see the file automations.yaml>
 +<file yaml /home/homeassistant/.homeassistant/automations.yaml>
 +- id: '1551909333005'
 +  alias: Oled - Input to MQTT
 +  trigger:
 +  - entity_id: input_select.oled
 +    platform: state
 +  condition: []
 +  action:
 +  - data_template:
 +      payload: '{{ states(''input_select.oled'') }}'
 +      retain: false
 +      topic: oled/set
 +    service: mqtt.publish
 +- id: '1551910316293'
 +  alias: Oled - MQTT to Input
 +  trigger:
 +  - platform: mqtt
 +    topic: oled/state
 +  condition: []
 +  action:
 +  - data_template:
 +      entity_id: input_select.oled
 +      option: '{{ trigger.payload }}'
 +    service: input_select.select_option
 +- id: '1552122444469'
 +  alias: Oled-Autostart
 +  trigger:
 +  - event: start
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.start_oled
 +- id: '1552128743168'
 +  alias: Oled-Autostop
 +  trigger:
 +  - event: shutdown
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.stop_oled
 +</file>
 +</hidden>
 +<hidden Click here to see the file groups.yaml>
 +<file yaml /home/homeassistant/.homeassistant/groups.yaml>
 +# Oled related automations
 +enable_oled:
 +  name: "Enable Oled"
 +  entities:
 +    - automation.oled_autostart
 +    - automation.oled_autostop
 +    - automation.oled_input_to_mqtt
 +    - automation.oled_mqtt_to_input
 +  all: true
 +</file>
 +</hidden>
 +<hidden Click here to see the file input_select.yaml>
 +<file yaml /home/homeassistant/.homeassistant/input_select.yaml>
 +oled:
 +  name: Mode
 +  options:
 +    - Turn off
 +    - Wifi
 +    - Ethernet
 +    - Clock
 +    - Load
 +    - Disk usage
 +    - CPU Temp
 +    - RAM
 +  initial: Clock
 +  icon: mdi:fullscreen
 +</file>
 +</hidden>
 +<hidden Click here to see the file secrets.yaml>
 +<file yaml /home/homeassistant/.homeassistant/secrets.yaml>
 +# Use this file to store secrets like usernames and passwords.
 +# Learn more at https://home-assistant.io/docs/configuration/secrets/
 +some_password: welcome
 +
 +#################### d-diot config ############################################
 +
 +# MySQL database
 +mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant
 +
 +# DuckDNS token
 +#duckdns_token: your_token_here
 +</file>
 +</hidden>
 +<hidden Click here to see the file shell_command.yaml>
 +<file yaml /home/homeassistant/.homeassistant/shell_command.yaml>
 +start_oled: /home/homeassistant/oled/./oled.py &
 +stop_oled: mosquitto_pub -h localhost -t oled/set -m 'Turn off' && sleep 5 && killall oled.py &
 +</file>
 +</hidden>
 +<hidden Click here to see the file switches.yaml>
 +<file yaml /home/homeassistant/.homeassistant/switches.yaml>
 +# Template switches
 +- platform: template
 +  switches:
 +    oled:
 +      friendly_name: "Status"
 +      value_template: "{{ is_state('binary_sensor.oled_status', 'on') }}"
 +      turn_on:
 +        service: shell_command.start_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +      turn_off:
 +        service: shell_command.stop_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +</file>
 +</hidden>
 +<hidden Click here to see the file customize.yaml>
 +<file yaml /home/homeassistant/.homeassistant/customize.yaml>
 +</file>
 +</hidden>
 +==== d-diot image v.1.3 ====
 +<hidden Click here to see the file configuration.yaml>
 +<file yaml /home/homeassistant/.homeassistant/configuration.yaml>
 +# Configure a default setup of Home Assistant (frontend, api, etc)
 +default_config:
 +
 +# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
 +# http:
 +#   base_url: example.duckdns.org:8123
 +
 +# Text to speech
 +tts:
 +  - platform: google_translate
 +
 +group: !include groups.yaml
 +automation: !include automations.yaml
 +script: !include scripts.yaml
 +scene: !include scenes.yaml
 +
 +
 +#################### d-diot config ###############################################
 + 
 +# Basic information
 +homeassistant:
 +#  latitude: 32.87336
 +#  longitude: 117.22743
 +#  elevation: 430
 +#  unit_system: metric
 +#  time_zone: America/Los_Angeles
 +#  name: Home
 +  customize: !include customize.yaml
 +
 +# Configuration split
 +sensor: !include sensors.yaml
 +binary_sensor: !include binary_sensors.yaml
 +switch: !include switches.yaml
 +input_select: !include input_select.yaml
 +shell_command: !include shell_command.yaml
 +
 +# Panel Iframe
 +panel_iframe:
 +  lircweb:
 +    title: 'Ir remotes'
 +    url: 'http://d-diot.local:3000'
 +    icon: mdi:radiobox-marked
 +  shellinabox:
 +    title: 'Shell'
 +    url: 'https://d-diot.local:4200'
 +    icon: mdi:powershell
 +  esphome:
 +    title: 'ESPHome'
 +    url: 'http://d-diot.local:6052'
 +    icon: mdi:chip
 + 
 +# Mosquitto MQTT broker
 +mqtt:
 +  broker: localhost
 +  port: 1883
 +#  username: 
 +#  password: 
 +  discovery: true
 +  discovery_prefix: homeassistant
 +  birth_message:
 +    topic: 'hass/status'
 +    payload: 'online'
 +  will_message:
 +    topic: 'hass/status'
 +    payload: 'offline'
 + 
 +# LIRC
 +lirc:
 +
 +# Mysensors
 +mysensors:
 +  gateways:
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-rfm69.json'
 +      tcp_port: 5003
 +    - device: 'localhost'
 +      persistence_file: '/home/homeassistant/mysensors-nrf24.json'
 +      tcp_port: 5004
 +  optimistic: false
 +  persistence: true
 +  version: '2.3'
 + 
 +# RFLink
 +#rflink:
 +#  port: /dev/serial0
 +#  wait_for_ack: true
 +
 +# Tracker
 +#device_tracker:
 +# NMAP
 +#  - platform: nmap_tracker
 +#    hosts: 192.168.1.0/24
 +#    home_interval: 10
 +#    exclude:
 +#      - 192.168.1.71
 +# Bluetooth
 +#  - platform: bluetooth_tracker
 + 
 +# MySQL recorder
 +recorder:
 +  purge_keep_days: 3
 +  purge_interval: 1
 +  db_url: !secret mariadb_connection_url
 +  include:
 +    entities:
 +      - sensor.processor_use
 +      - sensor.memory_use_percent
 +      - sensor.disk_use_percent
 +      - sensor.load_5m
 +      - sensor.cpu_temperature
 + 
 +#duckdns:
 +#  domain: your_duckdns_subdomain_without_.duckdns.org
 +#  access_token: !secret duckdns_token
 + 
 +# SSL encryption and DuckDNS access
 +#http:
 +#  base_url: your_subdomain.duckdns.org:8123
 +#  ssl_certificate: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/fullchain.pem
 +#  ssl_key: /home/homeassistant/dehydrated/certs/your_subdomain.duckdns.org/privkey.pem
 + 
 +# Enable logger to individuate the RFLink devices
 +#logger:
 +#  default: error
 +#  logs:
 +#    rflink: debug
 +#    homeassistant.components.rflink: debug
 +
 +</file>
 +</hidden>
 +<hidden Click here to see the file sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/sensors.yaml>
 +# System monitor
 +- platform: systemmonitor
 +  resources:
 +    - type: disk_use_percent
 +      arg: /
 +#    - type: disk_use
 +#      arg: /
 +#    - type: disk_free
 +#      arg: /
 +#    - type: memory_free
 +    - type: memory_use_percent
 +#    - type: memory_use 
 +#    - type: swap_use_percent
 +#    - type: swap_use
 +#    - type: swap_free
 +#    - type: load_1m  
 +    - type: load_5m
 +#    - type: load_15m
 +#    - type: network_in
 +#      arg: eth0
 +#    - type: network_out
 +#      arg: eth0
 +#    - type: network_in
 +#      arg: wlan0
 +#    - type: network_out
 +#      arg: wlan0
 +#packets_in Interface, e.g., eth0
 +#packets_out Interface, e.g., eth0
 +    - type: ipv4_address
 +      arg: eth0
 +    - type: ipv4_address
 +      arg: wlan0
 +#ipv6_address Interface, e.g., eth0
 +    - type: processor_use 
 +#    - type: process
 +#      arg: octave-cli
 +    - type: last_boot
 + 
 +#CPU temp
 +- platform: command_line
 +  name: CPU Temperature
 +  command: "cat /sys/class/thermal/thermal_zone0/temp"
 +  # If errors occur, remove degree symbol below
 +  unit_of_measurement: "°C"
 +  value_template: '{{ value | multiply(0.001) | round(1) }}'
 +</file>
 +</hidden>
 +<hidden Click here to see the file binary_sensors.yaml>
 +<file yaml /home/homeassistant/.homeassistant/binary_sensors.yaml>
 +# MQTT binary sensor
 +- platform: mqtt
 +  name: "OLED status"
 +  state_topic: "oled/status"
 +  payload_on: 1
 +  payload_off: 0
 +  qos: 0
 +  device_class: light
 +</file>
 +</hidden>
 +<hidden Click here to see the file automations.yaml>
 +<file yaml /home/homeassistant/.homeassistant/automations.yaml>
 +- id: '1551909333005'
 +  alias: Oled - Input to MQTT
 +  trigger:
 +  - entity_id: input_select.oled
 +    platform: state
 +  condition: []
 +  action:
 +  - data_template:
 +      payload: '{{ states(''input_select.oled'') }}'
 +      retain: false
 +      topic: oled/set
 +    service: mqtt.publish
 +- id: '1551910316293'
 +  alias: Oled - MQTT to Input
 +  trigger:
 +  - platform: mqtt
 +    topic: oled/state
 +  condition: []
 +  action:
 +  - data_template:
 +      entity_id: input_select.oled
 +      option: '{{ trigger.payload }}'
 +    service: input_select.select_option
 +- id: '1552122444469'
 +  alias: Oled-Autostart
 +  trigger:
 +  - event: start
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.start_oled
 +- id: '1552128743168'
 +  alias: Oled-Autostop
 +  trigger:
 +  - event: shutdown
 +    platform: homeassistant
 +  condition: []
 +  action:
 +  - service: shell_command.stop_oled
 +</file>
 +</hidden>
 +<hidden Click here to see the file groups.yaml>
 +<file yaml /home/homeassistant/.homeassistant/groups.yaml>
 +# Oled related automations
 +enable_oled:
 +  name: "Enable Oled"
 +  entities:
 +    - automation.oled_autostart
 +    - automation.oled_autostop
 +    - automation.oled_input_to_mqtt
 +    - automation.oled_mqtt_to_input
 +  all: true
 +</file>
 +</hidden>
 +<hidden Click here to see the file input_select.yaml>
 +<file yaml /home/homeassistant/.homeassistant/input_select.yaml>
 +oled:
 +  name: Mode
 +  options:
 +    - Turn off
 +    - Wifi
 +    - Ethernet
 +    - Clock
 +    - Load
 +    - Disk usage
 +    - CPU Temp
 +    - RAM
 +  initial: Clock
 +  icon: mdi:fullscreen
 +</file>
 +</hidden>
 +<hidden Click here to see the file secrets.yaml>
 +<file yaml /home/homeassistant/.homeassistant/secrets.yaml>
 +# Use this file to store secrets like usernames and passwords.
 +# Learn more at https://home-assistant.io/docs/configuration/secrets/
 +some_password: welcome
 +
 +#################### d-diot config ############################################
 +
 +# MySQL database
 +mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant
 +
 +# DuckDNS token
 +#duckdns_token: your_token_here
 +</file>
 +</hidden>
 +<hidden Click here to see the file shell_command.yaml>
 +<file yaml /home/homeassistant/.homeassistant/shell_command.yaml>
 +start_oled: /home/homeassistant/oled/./oled.py &
 +stop_oled: mosquitto_pub -h localhost -t oled/set -m 'Turn off' && sleep 5 && killall oled.py &
 +</file>
 +</hidden>
 +<hidden Click here to see the file switches.yaml>
 +<file yaml /home/homeassistant/.homeassistant/switches.yaml>
 +# Template switches
 +- platform: template
 +  switches:
 +    oled:
 +      friendly_name: "Status"
 +      value_template: "{{ is_state('binary_sensor.oled_status', 'on') }}"
 +      turn_on:
 +        service: shell_command.start_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +      turn_off:
 +        service: shell_command.stop_oled
 +        data:
 +          entity_id: binary_sensor.oled_status
 +</file>
 +</hidden>
 +<hidden Click here to see the file customize.yaml>
 +<file yaml /home/homeassistant/.homeassistant/customize.yaml>
 +</file>
 +</hidden>
 [<>] [<>]
  • system_administration/manual_installation/8_home_assistant_configuration.txt
  • Last modified: 2019/12/30 20:25
  • by franzunix