system_administration:manual_installation:8_home_assistant_configuration

Home Assistant configuration

Well… this is a long story. We will start from some basic tricks and tips that make the configuration management easier and then we will proceed with some more advanced settings.

Home Assistant use YAML syntax for its configuration files and the most important file is the configuration.yaml file that is located in /home/homeassistant/.homeassistant/

You can access all the configuration files via samba from a Windows or Linux machine, or you can edit them using a text editor like nano with the command line interface (CLI). In this case make sure to switch to Home Assistant user to avoid permission issues.

Click here to see how to edit a Home Assistant config file in a shell

Click here to see how to edit a Home Assistant config file in a shell

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ nano /home/homeassistant/.homeassistant/configuration.yaml

The Home position in the map in the Home Assistant version present in the image v.1.2 is different from the previous one. You can set your postion directly in Home Assitant Web UI under Configuration → General, but if you prefer also in the configuration.yaml commenting out and changing the following lines:

/home/homeassistant/.homeassistant/configuration.yaml
# Basic information
#homeassistant:
#  latitude: 32.87336
#  longitude: 117.22743
#  elevation: 430
#  unit_system: metric
#  time_zone: America/Los_Angeles
#  name: Home

More details here.

As stated above the configuration.yaml is the most important configuration file of Home Assistant, but to keep it simple to read is a good idea to split your configuration.

By default, but it may vary with the Home Assistant version, some parts of the configuration are already split. You should see something like that in the default configuration.yaml file:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

Edit them and add the following lines:

/home/homeassistant/.homeassistant/configuration.yaml
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

Please note that in the default configuration.yaml you should already have a “sensor” entry that should appear like that:

# Sensors
sensor:
  # Weather prediction
  - platform: yr

Simply delete this lines, we will cover this aspect later. For the d-diot image 1.2 this line is not present.

Create the new configuration files:

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/sensors.yaml
homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/binary_sensors.yaml
homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/switches.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

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.

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.homeassistant/customize.yaml

This configuration will add an entry for lirc_web and shellinabox in the right column of Home Assistant webui. The lirc_web and shellinabox web interfaces will be integrated in Home Assistant. Edit the file configuration.yaml and add the following lines:

/home/homeassistant/.homeassistant/configuration.yaml
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

For d-diot image v.1.1 and above, with ESPHome installed, add the following lines:

/home/homeassistant/.homeassistant/configuration.yaml
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

Substitute the d-diot.local part of the URL with your Raspberry Pi IP address if your network does not support avahi / zeroconf. See this if you have SSL encryption enabled.

Reference guides:

Add the following lines to configuration.yaml:

/home/homeassistant/.homeassistant/configuration.yaml
# MQTT
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'

Insert your credentials and uncomment username and password if you have enabled the authentication in Mosquitto.

For the d-diot image v.1.2 install this packages first:

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

To enable the LIRC component add the following lines to configuration.yaml:

/home/homeassistant/.homeassistant/configuration.yaml
# LIRC
lirc:

Create the .lircrc file in /home/homeassistant:

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ touch /home/homeassistant/.lircrc

Reference guide

Add the following lines to configuration.yaml

/home/homeassistant/.homeassistant/configuration.yaml
# 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'

Reference guide

Add the following lines to configuration.yaml

/home/homeassistant/.homeassistant/configuration.yaml
## RFLink
#rflink:
#  port: /dev/serial0
#  wait_for_ack: true

Home Assistant support different themes that can be changed directly in the webui.
A themes repository has been created by the Home Assistant community.

Reference guide:

Create a dir 'themes' in /home/homeassistant/.homeassistant and download all themes:

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ mkdir /home/homeassistant/.homeassistant/themes
homeassistant@d-diot:/home/pi $ cd /home/homeassistant/.homeassistant/themes
homeassistant@d-diot:~/.homeassistant/themes $ git clone https://github.com/maartenpaauw/home-assistant-community-themes.git

In the configuration.yaml add the following line:

/home/homeassistant/.homeassistant/configuration.yaml
# Webui Themes
frontend:
  themes:  !include_dir_merge_named themes

Some parameters of your Raspberry Pi can be displayed in the Home Assistant webui; add the following lines to sensors.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) }}'

In the d-diot image this sensors are grouped in a view accessible clicking the Raspberry Pi icon in the Home Assistant webui

Reference guide:

Set the location latitude and longitude in configuration.yaml under the “homeassistant” directive and add the following lines to sensors.yaml

/home/homeassistant/.homeassistant/sensors.yaml
# Outside conditions
- platform: yr
  name: Outside
#  forecast: 24
  monitored_conditions:
    - temperature
    - symbol
    - precipitation
    - windSpeed
    - pressure
    - windDirection
    - humidity
    - fog
    - cloudiness
    - lowClouds
    - mediumClouds
    - highClouds
    - dewpointTemperature

The nmap package has been installed in the first step of the manual installation.

The reference guide to learn how this component works in Home Assistant is here:

NMAP will work independently from your router but it uses the Raspberry Pi resources, so if you have for example a Netgear router, use the specific component.

To configure the nmap component, add the following line to configuration.yaml in the “device_tacker” section, that should be already present in the default configuration.yaml:

/home/homeassistant/.homeassistant/configuration.yaml
#device_tracker:
#    # NMAP
#    - platform: nmap_tracker
#    hosts: 192.168.1.0/24
#    home_interval: 10
#    exclude:
#     - 192.168.1.20

In the web interface of Home Assistant you can associate a specific nmap device to a person.

Reference guides:

The required deb packages have been already installed in the basic system setup, but only for d-diot images v.1.0 and v.1.1, here wee need to install the python library. This step is not necessary for the d-diot image v.1.2

pi@d-diot:~ $ sudo pip install pybluez

Add the following lines to configuration.yaml in the “device_tacker” section, under the NMAP platform:

/home/homeassistant/.homeassistant/configuration.yaml
#device_tracker:
#    # NMAP
#    - platform: nmap_tracker
#    hosts: 192.168.1.0/24
#    home_interval: 10
#    exclude:
#     - 192.168.1.20
#    # Bluetooth
#    - platform: bluetooth_tracker

In the web interface of Home Assistant you can associate a specific bluetooth device to a person.

In the basic system setup we have installed a MariaDB server. Now it's time to configure Home Assistant to use it.

As a first step we need to install the required python library in the virtual enviroment

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@d-diot:/home/pi $ pip3 install mysqlclient
(homeassistant) homeassistant@d-diot:/home/pi $ exit

Stop Home Assistant:

pi@d-diot:~ $ sudo systemctl stop home-assistant@homeassistant

Add the following lines under the “recorder” section that should be already present in the default configuration.yaml.

/home/homeassistant/.homeassistant/configuration.yaml
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

In the file secrets.yaml add the following line

/home/homeassistant/.homeassistant/secrets.yaml
mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant

Remove the default SQLAlchemy DB:

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ rm /home/homeassistant/.homeassistant/home-assistant_v2.db 
homeassistant@d-diot:/home/pi $ exit

Restart home assistant and see what happens:

pi@d-diot:~ $ sudo systemctl start home-assistant@homeassistant

Now Home Assistant will use the MariaDB server to store the historical data.
You can use any MariaDB server instance, even a remote one, simply changing the database URL in the file secrets.yaml.

Now we will see how to control the oled display with Home Assistant.

Add the following lines to shell_command.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 &

Add the following lines to input_select.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

Add the following lines to automations.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

Add the following lines to binary_sensors.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

Add the following lines to switches.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

Add the following lines to groups.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

The duck DNS component is necessary (in most cases) when you wont to make your Home Assistant instance accessible from the outside respect to your local network.

Reference guide:

Add the following line to configuration.yaml

/home/homeassistant/.homeassistant/configuration.yaml
#duckdns:
#  domain: your_duckdns_subdomain_without_.duckdns.org
#  access_token: !secret duckdns_token

Add the following lines to secrets.yaml

/home/homeassistant/.homeassistant/secrets.yaml
#duckdns_token: your_token_here

As for the duck DNS component, the SSL encryption is necessary when you wont to make your Home Assistant accessible from the outside respect to your local network.

A valid ssl certificate is issued with dehydrated, that is a lightweight bash script that uses let's encrypt with the DNS-01 challenge, supported by Duck DNS, to validate your domain name.
The advantages of this setup are:

  • No need to open port 80 on your router to validate or renew your domain certificate.
  • A full installation of let's encrypt is not required.
  • The certificate issued by let's encrypt are recognized as valid by the most common browser.

Reference guide:

Download and install dehydrated

pi@d-diot:~ $ sudo -u homeassistant -H -s
homeassistant@d-diot:/home/pi $ cd /home/homeassistant
homeassistant@d-diot:~ $ git clone https://github.com/lukas2511/dehydrated.git

Create a “config” file inside the dehydrated directory with the following lines:

homeassistant@d-diot:~ $ cd dehydrated
homeassistant@d-diot:~/dehydrated $ nano config
/home/homeassistant/.homeassistant/dehydrated/config
# Which challenge should be used? Currently http-01 and dns-01 are supported
CHALLENGETYPE="dns-01"
 
# Script to execute the DNS challenge and run after cert generation
HOOK="${BASEDIR}/hook.sh"

Create the hook script file:

homeassistant@d-diot:~/dehydrated $ nano hook.sh

Add the following lines:

/home/homeassistant/.homeassistant/dehydrated/hook.sh
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
 
domain="your_subdomain.duckdns.org"
token="your_token"
 
case "$1" in
    "deploy_challenge")
       curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=$4"
        echo
        ;;
     "clean_challenge")
        curl "https://www.duckdns.org/update?domains=$domain&token=$token&txt=removed&clear=true"
        echo
        ;;
     "deploy_cert")
        sudo systemctl restart home-assistant@homeassistant.service
        ;;
     "unchanged_cert")
        ;;
     "startup_hook")
        ;;
     "exit_hook")
        ;;
    *)
        echo Unknown hook "${1}"
        exit 0
        ;;
esac

Make the hook.sh script executable:

homeassistant@d-diot:~/dehydrated $ chmod 755 hook.sh

Create the file domains.txt:

homeassistant@d-diot:~/dehydrated $ nano domains.txt

Add the following lines

/home/homeassistant/.homeassistant/dehydrated/domains.txt
your_subdomain.duckdns.org

Add the following line to configuration.yaml:

/home/homeassistant/.homeassistant/configuration.yaml
# 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

Click here to see the file configuration.yaml

Click here to see the file configuration.yaml

/home/homeassistant/.homeassistant/configuration.yaml
homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 46.0679
  longitude: 11.1211
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Rome
  # Customization file
  customize: !include customize.yaml
 
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Show the introduction message on startup.
introduction:

 
# Discover some devices automatically
discovery:

# Text to speech
tts:
  - platform: google

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
 
##################### d-diot settings ############################################
 
# 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
 
# iFrame Panels
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
 
# Mosquitto MQTT
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
 
# Frontend
frontend:
  themes:  !include_dir_merge_named themes
 
# Device Tracker
#device_tracker:
     # NMAP
#    - platform: nmap_tracker
#    hosts: 192.168.1.0/24
#    home_interval: 10
#    exclude:
#     - 192.168.1.20
#    # Bluetooth
#    - platform: bluetooth_tracker
 
# 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
 
# Duck DNS
#duckdns:
#  domain: your_duckdns_subdomain_without_.duckdns.org
#  access_token: !secret duckdns_token
 
# SSL encryption
#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

Click here to see the file sensors.yaml

Click here to see the file sensors.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) }}'
 
# Outside conditions
- platform: yr
  name: Outside
#  forecast: 24
  monitored_conditions:
    - temperature
    - symbol
    - precipitation
    - windSpeed
    - pressure
    - windDirection
    - humidity
    - fog
    - cloudiness
    - lowClouds
    - mediumClouds
    - highClouds
    - dewpointTemperature

Click here to see the file binary_sensors.yaml

Click here to see the file binary_sensors.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

Click here to see the file automations.yaml

Click here to see the file automations.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

Click here to see the file groups.yaml

Click here to see the file groups.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

Click here to see the file input_select.yaml

Click here to see the file input_select.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

Click here to see the file secrets.yaml

Click here to see the file secrets.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
mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant
#duckdns_token: your_token_here

Click here to see the file shell_command.yaml

Click here to see the file shell_command.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 &

Click here to see the file switches.yaml

Click here to see the file switches.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

Click here to see the file configuration.yaml

Click here to see the file configuration.yaml

/home/homeassistant/.homeassistant/configuration.yaml
homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 45.8858
  longitude: 10.8412
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Rome
  # Customization file
  customize: !include customize.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
 
# Discover some devices automatically
discovery:

#################### d-diot customization ########################################
 
# Sensors
#sensor:
  # Weather prediction
#  - platform: yr
 
##################################################################################
 
# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
 
 
 
#################### d-diot config ###############################################
 
# 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
 
# MQTT
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.20
##     Bluetooth
#    - platform: bluetooth_tracker
 
# 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
#duckdns:
#  domain: your_duckdns_subdomain_without_.duckdns.org
#  access_token: !secret duckdns_token
 
# SSL encryption with DuckDNS
#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
 
 
####################### End of d-diot config #####################################

Click here to see the file sensors.yaml

Click here to see the file sensors.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) }}'
 
# Outside conditions
- platform: yr
  name: Outside
#  forecast: 24
  monitored_conditions:
    - temperature
    - symbol
    - precipitation
    - windSpeed
    - pressure
    - windDirection
    - humidity
    - fog
    - cloudiness
    - lowClouds
    - mediumClouds
    - highClouds
    - dewpointTemperature

Click here to see the file binary_sensors.yaml

Click here to see the file binary_sensors.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

Click here to see the file automations.yaml

Click here to see the file automations.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

Click here to see the file groups.yaml

Click here to see the file groups.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

Click here to see the file input_select.yaml

Click here to see the file input_select.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

Click here to see the file secrets.yaml

Click here to see the file secrets.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
mariadb_connection_url: mysql://homeassistant:d-diot.com@localhost/homeassistant
#duckdns_token: your_token_here

Click here to see the file shell_command.yaml

Click here to see the file shell_command.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 &

Click here to see the file switches.yaml

Click here to see the file switches.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

Click here to see the file configuration.yaml

Click here to see the file configuration.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

Click here to see the file sensors.yaml

Click here to see the file sensors.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) }}'

Click here to see the file binary_sensors.yaml

Click here to see the file binary_sensors.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

Click here to see the file automations.yaml

Click here to see the file automations.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

Click here to see the file groups.yaml

Click here to see the file groups.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

Click here to see the file input_select.yaml

Click here to see the file input_select.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

Click here to see the file secrets.yaml

Click here to see the file secrets.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

Click here to see the file shell_command.yaml

Click here to see the file shell_command.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 &

Click here to see the file switches.yaml

Click here to see the file switches.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

Click here to see the file configuration.yaml

Click here to see the file configuration.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

Click here to see the file sensors.yaml

Click here to see the file sensors.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) }}'

Click here to see the file binary_sensors.yaml

Click here to see the file binary_sensors.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

Click here to see the file automations.yaml

Click here to see the file automations.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

Click here to see the file groups.yaml

Click here to see the file groups.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

Click here to see the file input_select.yaml

Click here to see the file input_select.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

Click here to see the file secrets.yaml

Click here to see the file secrets.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

Click here to see the file shell_command.yaml

Click here to see the file shell_command.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 &

Click here to see the file switches.yaml

Click here to see the file switches.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

Click here to see the file customize.yaml

Click here to see the file customize.yaml

Click here to see the file configuration.yaml

Click here to see the file configuration.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

Click here to see the file sensors.yaml

Click here to see the file sensors.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) }}'

Click here to see the file binary_sensors.yaml

Click here to see the file binary_sensors.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

Click here to see the file automations.yaml

Click here to see the file automations.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

Click here to see the file groups.yaml

Click here to see the file groups.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

Click here to see the file input_select.yaml

Click here to see the file input_select.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

Click here to see the file secrets.yaml

Click here to see the file secrets.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

Click here to see the file shell_command.yaml

Click here to see the file shell_command.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 &

Click here to see the file switches.yaml

Click here to see the file switches.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

Click here to see the file customize.yaml

Click here to see the file customize.yaml

  • system_administration/manual_installation/8_home_assistant_configuration.txt
  • Last modified: 2019/12/30 15:25
  • by franzunix