Now let us go and have a look at the Configuration file that you will likely be spending most of your setup time in.
- From the Configurator panel, click on the folder Icon on the top left.
- This should show a list of files from the config/ directory.
- Click the configuration.yaml file to open it.
- Note: If you get a popup titled Unsaved Changes, click the CLOSE FILE option.
You should now see the configuration.yaml.
There is not much here but you can add things like lights, switches, and sensors that use MQTT or other communication methods to send data. You can find some examples of code to add to this in most of the documentation for Home Assistants many available Components.
Here is an example of what the code looks like with a few MQTT devices added to it:
# 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
sensor:
# Weather prediction
- platform: yr
- platform: mqtt
name: "Light Sensor"
state_topic: "house/lux"
unit_of_measurement: 'Lux'
icon: mdi:brightness-6
- platform: mqtt
name: "Door Sensor"
state_topic: "house/door"
icon: mdi:door
fan:
- platform: mqtt
name: "Fan"
state_topic: "house/fan"
command_topic: "house/fan"
speed_state_topic: "house/fan/speed"
speed_command_topic: "house/fan/speed"
qos: 0
payload_on: "ON"
payload_off: "OFF"
payload_low_speed: "low"
payload_medium_speed: "medium"
payload_high_speed: "high"
speeds:
- low
- medium
- high
light:
- platform: mqtt
name: "Light 1"
state_topic: "house/led/one"
command_topic: "house/led/one"
brightness_state_topic: "house/led/one/brightness"
brightness_command_topic: "house/led/one/brightness"
rgb_state_topic: "house/led/one/color"
rgb_command_topic: "house/led/one/color"
on_command_type: first
state_value_template: "{{ value_json.state }}"
brightness_value_template: "{{ value_json.brightness }}"
rgb_value_template: "{{ value_json.rgb | join(',') }}"
qos: 0
payload_on: "ON"
payload_off: "OFF"
optimistic: false
lock:
- platform: mqtt
name: Frontdoor
state_topic: "house/lock"
command_topic: "house/lock"
payload_lock: "LOCK"
payload_unlock: "UNLOCK"
optimistic: true
qos: 1
#retain: true
value_template: '{{ value.x }}'
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
This tool will verify your YAML code is formatted correctly by displaying a green check mark near the top right corner of the screen. A red ! in the top right corner will tell you that something is wrong with your code and you can click on it to see what will need to be fixed before you are finished.
When you have checked your YAML code and saved, go to Server Control from the Configuration menu and click RESTART.
After a few seconds, you will see some text appear that will say Connection lost. Reconnecting... at the bottom left of the window. When that text disappears, the server is back online and your changes have been loaded.
Page last edited March 08, 2024
Text editor powered by tinymce.