445 lines
10 KiB
YAML
445 lines
10 KiB
YAML
|
esphome:
|
||
|
name: garten-bus-controller
|
||
|
|
||
|
esp32:
|
||
|
board: esp32-poe
|
||
|
framework:
|
||
|
type: arduino
|
||
|
|
||
|
# Enable logging
|
||
|
#logger:
|
||
|
|
||
|
# Enable Home Assistant API
|
||
|
api:
|
||
|
encryption:
|
||
|
key: !secret api_encryption_key
|
||
|
|
||
|
ota:
|
||
|
password: !secret ota_password
|
||
|
|
||
|
|
||
|
external_components:
|
||
|
- source:
|
||
|
type: git
|
||
|
url: "https://github.com/andyboeh/esphome-dmx512"
|
||
|
ref: master
|
||
|
|
||
|
|
||
|
external_components:
|
||
|
- source:
|
||
|
type: local
|
||
|
path: my_components
|
||
|
|
||
|
#wifi:
|
||
|
# ssid: "WLAN"
|
||
|
# password: !secret wifi_password
|
||
|
#
|
||
|
# # Enable fallback hotspot (captive portal) in case wifi connection fails
|
||
|
# ap:
|
||
|
# ssid: "Garten Bus Controller Hotspot"
|
||
|
# password: !secret ota_password
|
||
|
#captive_portal:
|
||
|
|
||
|
ethernet:
|
||
|
type: LAN8720
|
||
|
mdc_pin: GPIO23
|
||
|
mdio_pin: GPIO18
|
||
|
clk_mode: GPIO17_OUT
|
||
|
phy_addr: 0
|
||
|
power_pin: GPIO12
|
||
|
|
||
|
uart:
|
||
|
- id: "uart_dmx"
|
||
|
rx_pin: 0
|
||
|
tx_pin: 1 # the pin where the transmission happens connected to tx (not reversed)
|
||
|
stop_bits: 2
|
||
|
baud_rate: 250000
|
||
|
- id: uart_relays
|
||
|
rx_pin: 2
|
||
|
tx_pin: 3
|
||
|
baud_rate: 9600
|
||
|
- id: "uart_oxilife"
|
||
|
rx_pin: 4
|
||
|
tx_pin: 5
|
||
|
baud_rate: 19200
|
||
|
stop_bits: 1
|
||
|
parity: NONE
|
||
|
|
||
|
modbus:
|
||
|
- uart_id: "uart_relays"
|
||
|
id: "modbus_relays"
|
||
|
- uart_id: "uart_oxilife"
|
||
|
id: "modbus_oxilife"
|
||
|
|
||
|
modbus_controller:
|
||
|
- modbus_id: "modbus_relays"
|
||
|
id: "relayboard32"
|
||
|
address: 0x1
|
||
|
- modbus_id: "modbus_relays"
|
||
|
id: "relayboard8_with_inputs"
|
||
|
address: 0x2
|
||
|
update_interval: "1s"
|
||
|
- modbus_id: "modbus_oxilife"
|
||
|
id: "oxilife"
|
||
|
address: 0x1
|
||
|
update_interval: "1s"
|
||
|
|
||
|
|
||
|
packages:
|
||
|
# ------------ Relays of 32-Relay board ----
|
||
|
relay01: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard32
|
||
|
name: "modbus-switch01"
|
||
|
dev_addr: 0x1
|
||
|
register_addr: 0x01
|
||
|
relay02: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard32
|
||
|
name: "modbus-switch02"
|
||
|
dev_addr: 0x1
|
||
|
register_addr: 0x02
|
||
|
relay03: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard32
|
||
|
name: "modbus-switch03"
|
||
|
dev_addr: 0x1
|
||
|
register_addr: 0x03
|
||
|
relay16: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard32
|
||
|
name: "modbus-switch16"
|
||
|
dev_addr: 0x1
|
||
|
register_addr: 0x0f
|
||
|
relay17: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard32
|
||
|
name: "modbus-switch17"
|
||
|
dev_addr: 0x1
|
||
|
register_addr: 0x10
|
||
|
# ------------ Relays of 8-Relay board ----
|
||
|
b2relay1: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard8_with_inputs
|
||
|
name: "garten_relayboard8_switch1"
|
||
|
dev_addr: 0x2
|
||
|
register_addr: 0x1
|
||
|
b2relay2: !include
|
||
|
file: "modbus_relay.yaml"
|
||
|
vars:
|
||
|
cid: relayboard8_with_inputs
|
||
|
name: "garten_relayboard8_switch2"
|
||
|
dev_addr: 0x2
|
||
|
register_addr: 0x2
|
||
|
|
||
|
# Controls input output relationship
|
||
|
# 0 no relationship
|
||
|
# 1 self-locking
|
||
|
# 2 interlocking
|
||
|
# 3 momentary
|
||
|
# commented out for now, because it sends all the time
|
||
|
#number:
|
||
|
# - platform: modbus_controller
|
||
|
# modbus_controller_id: relayboard8_with_inputs
|
||
|
# name: "relayboard8-input-output-relationship"
|
||
|
# value_type: U_WORD
|
||
|
# address: 0x00fd
|
||
|
# min_value: 0
|
||
|
# max_value: 3
|
||
|
# skip_updates: true
|
||
|
|
||
|
|
||
|
dmx512:
|
||
|
id: dmx1
|
||
|
uart_id: uart_dmx
|
||
|
tx_pin: 1
|
||
|
uart_num: 0
|
||
|
periodic_update: true
|
||
|
|
||
|
output:
|
||
|
- platform: dmx512
|
||
|
channel: 1
|
||
|
universe: dmx1
|
||
|
id: pool_licht_r
|
||
|
- platform: dmx512
|
||
|
channel: 2
|
||
|
universe: dmx1
|
||
|
id: pool_licht_g
|
||
|
- platform: dmx512
|
||
|
channel: 3
|
||
|
universe: dmx1
|
||
|
id: pool_licht_b
|
||
|
- platform: dmx512
|
||
|
channel: 4
|
||
|
universe: dmx1
|
||
|
id: magnolie_links_r
|
||
|
- platform: dmx512
|
||
|
channel: 5
|
||
|
universe: dmx1
|
||
|
id: magnolie_links_g
|
||
|
- platform: dmx512
|
||
|
channel: 6
|
||
|
universe: dmx1
|
||
|
id: magnolie_links_b
|
||
|
light:
|
||
|
- platform: rgb
|
||
|
name: pool_licht
|
||
|
red: pool_licht_r
|
||
|
green: pool_licht_g
|
||
|
blue: pool_licht_b
|
||
|
default_transition_length: 0s
|
||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||
|
- platform: rgb
|
||
|
name: magnolie_links
|
||
|
red: magnolie_links_r
|
||
|
green: magnolie_links_g
|
||
|
blue: magnolie_links_b
|
||
|
default_transition_length: 0s
|
||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||
|
|
||
|
|
||
|
# ----------------------- Oxilife ------------------------------
|
||
|
|
||
|
sensor:
|
||
|
#- platform: modbus_controller
|
||
|
# modbus_controller_id: oxilife
|
||
|
# id: oxilife_ionization_current
|
||
|
# name: Ionization Strom
|
||
|
# value_type: U_WORD
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_hidro_current
|
||
|
name: Oxilife Hydrolyse
|
||
|
state_class: measurement
|
||
|
device_class: POWER_FACTOR
|
||
|
icon: mdi:percent
|
||
|
address: 0x0101
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
unit_of_measurement: "%"
|
||
|
filters:
|
||
|
- multiply: 0.1
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_ph
|
||
|
name: Oxilife pH
|
||
|
state_class: measurement
|
||
|
icon: mdi:ph
|
||
|
address: 0x0102
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
accuracy_decimals: 2
|
||
|
filters:
|
||
|
- multiply: 0.01
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_redox_level
|
||
|
name: Oxilife Redox Level
|
||
|
state_class: measurement
|
||
|
icon: mdi:atom
|
||
|
address: 0x0103
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
unit_of_measurement: "mV"
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_clorine_ppm
|
||
|
address: 0x0104
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
internal: true
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_conductivity
|
||
|
address: 0x0105
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
internal: true
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_temperature
|
||
|
name: Pool Temperatur
|
||
|
device_class: TEMPERATURE
|
||
|
state_class: measurement
|
||
|
address: 0x0106
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
unit_of_measurement: "°C"
|
||
|
accuracy_decimals: 1
|
||
|
filters:
|
||
|
- multiply: 0.1
|
||
|
# pH status
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife pH Status Alarm
|
||
|
id: oxilife_ph_status_alarm
|
||
|
address: 0x0107
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
bitmask: 0x000F
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Polarization A Time
|
||
|
address: 0x0214
|
||
|
register_type: read
|
||
|
value_type: U_DWORD
|
||
|
device_class: DURATION
|
||
|
state_class: total_increasing
|
||
|
unit_of_measurement: "s"
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Polarization B Time
|
||
|
address: 0x0216
|
||
|
register_type: read
|
||
|
value_type: U_DWORD
|
||
|
device_class: DURATION
|
||
|
state_class: total_increasing
|
||
|
unit_of_measurement: "s"
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Runtime Polarity Changes
|
||
|
address: 0x0216
|
||
|
register_type: read
|
||
|
value_type: U_DWORD
|
||
|
state_class: total_increasing
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay State
|
||
|
id: oxilife_raw_relays
|
||
|
address: 0x010E
|
||
|
register_type: read
|
||
|
value_type: U_WORD
|
||
|
|
||
|
binary_sensor:
|
||
|
# Oxilife
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_acid_pump
|
||
|
name: Oxilife Säure Pumpe
|
||
|
device_class: RUNNING
|
||
|
address: 0x0107
|
||
|
bitmask: 0x1000
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_ph_module_flow_control
|
||
|
name: Oxilife pH Flow Control
|
||
|
device_class: RUNNING
|
||
|
address: 0x0107
|
||
|
bitmask: 0x0400
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
id: oxilife_hydrolysis_flow
|
||
|
name: Oxilife Hydrolysis Flow
|
||
|
device_class: RUNNING
|
||
|
address: 0x010D
|
||
|
bitmask: 0x0008
|
||
|
register_type: read
|
||
|
#Oxilife relays
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay 1 pH
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0001
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay 2 Filtering
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0010
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay 3 Light
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0004
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay 4
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0008
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay Slow Speed
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0100
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay Medium Speed
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0200
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Relay High Speed
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0400
|
||
|
device_class: POWER
|
||
|
register_type: read
|
||
|
# Relay board
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: relayboard8_with_inputs
|
||
|
name: "garten_relayboard8_input1"
|
||
|
register_type: holding
|
||
|
address: 0x81
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: relayboard8_with_inputs
|
||
|
name: "garten_relayboard8_input2"
|
||
|
register_type: holding
|
||
|
address: 0x82
|
||
|
|
||
|
|
||
|
switch:
|
||
|
- platform: modbus_controller
|
||
|
modbus_controller_id: oxilife
|
||
|
name: Oxilife Aux Relay
|
||
|
register_type: holding
|
||
|
address: 0x010E
|
||
|
bitmask: 0x0008
|
||
|
write_lambda: |-
|
||
|
uint16_t previous = id(oxilife_raw_relays).state;
|
||
|
ESP_LOGE("main","Previous state to overwrite: = %d", previous);
|
||
|
if(x)
|
||
|
previous |= 0x0008;
|
||
|
else
|
||
|
previous &= ~(0x0008);
|
||
|
|
||
|
ESP_LOGE("main","Previous state overwritten: = %d", previous);
|
||
|
|
||
|
payload.push_back(0x01); // device address
|
||
|
payload.push_back(0x10); // write function
|
||
|
payload.push_back((uint8_t)(0x010E >> 8)); // register address high
|
||
|
payload.push_back((uint8_t)(0x010E)); // register address low
|
||
|
payload.push_back(0x00); // register count high
|
||
|
payload.push_back(0x01); // register count low
|
||
|
payload.push_back(0x02); // byte count
|
||
|
|
||
|
payload.push_back((uint8_t)(previous >> 8)); // data high
|
||
|
payload.push_back((uint8_t)(previous)); // data low
|
||
|
return true;
|
||
|
|
||
|
# filtration state: 0x0421 0 off, 1 is on
|
||
|
# filtration mode: register 0x0411
|
||
|
# 0 manual
|
||
|
# 1 auto
|
||
|
# 2 heating
|
||
|
# 3 smart
|
||
|
# 4 intelligent
|
||
|
# 13 backwash
|