Edit config file
Everything what you should know about configuration file
Configuration file
The configuration file might look big and complicated, but it's really not. The file itself is separated into sections, which we will describe below.
For our example, we will use boneio-dimmer_gen2_8ch-01.yaml.
So let's begin. Here is the whole config file:
substitutions:
#name: boneio-dr-gen2-8ch-01
friendly_name: 'BoneIO Input24'
#serial_prefix: 'dim2' #Don't change it.
#firmware_manifest: 'https://boneio.eu/fwesp/boneio-dr-gen2-8ch-01.json'
esphome:
name: '${name}'
friendly_name: '${friendly_name}'
name_add_mac_suffix: true
project:
#name: boneio.dimmer-led-gen2
version: '0.1'
on_boot:
priority: -100
then:
- delay: 5s
- if:
condition:
lambda: 'return id(serial_no) != nullptr;'
then:
- component.update: serial_no
- logger.log: "Serial No updated on boot"
else:
- logger.log: "Serial No component not found"
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
ethernet:
id: eth
type: W5500
clk_pin: GPIO13
mosi_pin: GPIO39
miso_pin: GPIO38
cs_pin: GPIO12
interrupt_pin: GPIO2
reset_pin: GPIO1
clock_speed: 25MHz
external_components:
- source: github://boneIO-eu/esphome-LM75@main #Original source and thank you note for BTomala https://github.com/boneIO-eu/esphome-lm75
components: [lm75]
i2c:
sda: GPIO10
scl: GPIO11
scan: True
frequency: 400kHz
uart:
id: boneio_uart
rx_pin: GPIO21
tx_pin: GPIO14
baud_rate: 9600
stop_bits: 1
##CAN gpio48 - tx, gpio47 rx, gpio35 stb
modbus:
send_wait_time: 80ms
uart_id: boneio_uart
id: boneio_modbus
packages:
internals_packages:
url: https://github.com/boneIO-eu/esphome
ref: v1.7.1
files: [
'devices/serial_no.yaml',
# # 'devices/dimmer_i2c.yaml',
]
boneiopackages:
url: https://github.com/boneIO-eu/esphome_packages
ref: main
refresh: 1min
files:
- path: sdm630.yaml
dashboard_import:
package_import_url: github://boneIO-eu/esphome/boneio-dimmer_gen2_8ch-v0_1.yaml@main
import_full_config: true
pcf8574:
- id: 'pcf_inputs'
address: 0x38
# http_request:
# timeout: 7s
# verify_ssl: false
logger:
hardware_uart: UART0
api:
reboot_timeout: 0s
ota:
- platform: esphome
- platform: web_server
# - platform: http_request
# update:
# - id: update_std
# platform: http_request
# name: boneIO FW Update
# update_interval: 3 minutes
# source: ${firmware_manifest}
web_server:
port: 80
version: 3
local: true
debug:
update_interval: 15s
sensor:
- platform: debug
free:
name: "Heap Free"
block:
name: "Heap Max Block"
loop_time:
name: "Loop Time"
- platform: lm75
id: boneIO_temp
name: 'Temperature'
update_interval: 30s
entity_category: diagnostic
on_value_range:
- above: 70.0
then:
- switch.turn_on: buzzer
- below: 70.0
then:
- switch.turn_off: buzzer
switch:
- platform: gpio
id: buzzer
name: 'Buzzer'
pin:
number: GPIO9
mode:
output: true
inverted: false
- platform: gpio
id: can_bus_switch
name: 'CAN Bus Switch'
pin:
number: GPIO35
mode:
output: true
inverted: false
- platform: gpio
name: "CAN RX"
pin: GPIO47
- platform: gpio
name: "CAN TX"
pin: GPIO48
binary_sensor:
- platform: gpio
name: 'IN_01'
id: in_01
pin:
pcf8574: pcf_inputs
number: 0
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_02'
id: in_02
pin:
pcf8574: pcf_inputs
number: 1
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_03'
id: in_03
pin:
pcf8574: pcf_inputs
number: 2
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_04'
id: in_04
pin:
pcf8574: pcf_inputs
number: 3
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_05'
id: in_05
pin:
pcf8574: pcf_inputs
number: 4
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_06'
id: in_06
pin:
pcf8574: pcf_inputs
number: 5
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_07'
id: in_07
pin:
pcf8574: pcf_inputs
number: 6
mode:
input: true
inverted: true
- platform: gpio
name: 'IN_08'
id: in_08
pin:
pcf8574: pcf_inputs
number: 7
mode:
input: true
inverted: true
- platform: template
name: CAN Bus Button
id: can_bus_button
# canbus:
# - platform: esp32_can
# tx_pin: GPIO48
# rx_pin: GPIO47
# can_id: 4
# bit_rate: 50kbps
# on_frame:
# - can_id: 5
# then:
# - lambda: |-
# if(x.size() > 0) {
# switch(x[0]) {
# case 0x12: // button release
# id(can_bus_button).publish_state(false);
# break;
# case 0x11: // button press
# id(can_bus_button).publish_state(true);
# break;
# }
# }
# button:
# - platform: template
# name: 'CAN Sensor ON'
# on_press:
# - logger.log: Button Pressed
# - canbus.send: [0x11, 0x22, 0x33]
# - platform: template
# name: 'CAN Sensor OFF'
# on_press:
# - logger.log: Button Pressed
# - canbus.send: [0x12, 0x22, 0x33]substitutions
substitutions:
name: boneio-dr-gen2-8ch-01
friendly_name: 'BoneIO Dimmer 8ch'
serial_prefix: 'dim2' #Don't change it.
firmware_manifest: 'https://boneio.eu/fwesp/boneio-dr-gen2-8ch-01.json'This part is mainly responsible for the name of your controller.
You should focus on friendly_name. You should write the exact name of your boneIO here. The name depends on your needs.
It could be "boneIO Dimmer-G2" if you have one boneIO controller, or for example, "boneIO Dimmer-G2 1st-floor".
esphome
esphome:
name: '${name}'
friendly_name: '${friendly_name}'
name_add_mac_suffix: true
project:
name: boneio.dimmer-led-gen2
version: '0.1'
on_boot:
priority: -100
then:
- delay: 5s
- if:
condition:
lambda: 'return id(serial_no) != nullptr;'
then:
- component.update: serial_no
- logger.log: "Serial No updated on boot"
else:
- logger.log: "Serial No component not found"There are definitions for your controller. You shouldn't change name or friendly_name. The line name_add_mac_suffix: will add a MAC suffix to the controller's name, which is useful for identifying your controller. project: is the place where you define the type and version of your controller.
esp32
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idfDefinition of the ESP32 board and the required framework.
Ethernet
ethernet:
id: eth
type: W5500
clk_pin: GPIO13
mosi_pin: GPIO39
miso_pin: GPIO38
cs_pin: GPIO12
interrupt_pin: GPIO2
reset_pin: GPIO1
clock_speed: 25MHzThis part is responsible for the description of your controller's Ethernet port - you shouldn't change anything here.
dashboard_import
dashboard_import:
package_import_url: github://boneIO-eu/esphome/boneio-dimmer_gen2_8ch-01.yaml@main
import_full_config: trueThis is the place where the address for our GitHub repository is defined. The config and all additional packages are downloaded from there. There is nothing to change here.
packages
packages:
internals_packages:
url: https://github.com/boneIO-eu/esphome
ref: v1.7.1
files: [
'devices/serial_no.yaml',
# 'devices/dimmer_i2c.yaml',
]
boneiopackages:
url: https://github.com/boneIO-eu/esphome_packages
ref: main
refresh: 1min
files:
- path: sdm630.yamlHere are definitions of all packages used by boneIO, with the address to our GitHub. You can also find there the definitions of modbus devices.
logger
logger:
hardware_uart: UART0In case of troubleshooting, you can increase the log level to INFO, WARN, or DEBUG. This can be very useful in some cases.
api
api:
reboot_timeout: 0sHere, the reboot timeout is defined for when the controller loses connection with HA. If you want your boneIO to restart after losing connection with Home Assistant, you should enter a value that suits you here. For WiFi connections, the value should not be zero. For LAN connections, not rebooting does not negatively affect the connection with Home Assistant in most cases.
ota
ota:
- platform: esphome
- platform: web_server
# - platform: http_requestPart responsible for Over The Air updates. The web_server platform allows updating via the device's web panel.
web_server
web_server:
port: 80
local: true
version: 3Part responsible for enabling the web server of the controller.
time
time:
- platform: homeassistant
timezone: Europe/Warsaw
id: homeassistant_timeThis section is responsible for selecting your controller's time zone. Adjust it to your location.
Modbus Section
######################
### MODBUS SECTION ###
######################
# UNCOMMENT BELOW TO USE MODBUS
# uart:
# id: uart_pin14_15
# rx_pin: GPIO14
# tx_pin: GPIO15
# baud_rate: 9600
# stop_bits: 1
# modbus:
# send_wait_time: 200ms
# uart_id: uart_pin14_15
# id: boneio_modbus
# modbus_controller:
# - id: YOURDEVICE ID
# address: 0x09
# modbus_id: mod_bus
# setup_priority: -10
# update_interval: 60sThis section is responsible for Modbus. If you plan to use it, you should first uncomment it.
Then, please check our Modbus tutorial: Modbus with Esphome packages