-
Notifications
You must be signed in to change notification settings - Fork 1
/
modbus-sensor-reader-multi.yaml
154 lines (141 loc) · 3.48 KB
/
modbus-sensor-reader-multi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
esphome:
name: modbus-sensor-reader
friendly_name: modbus-sensor-reader
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxx"
ota:
password: "xxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Optional manual IP
manual_ip:
static_ip: 192.168.1.15
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-xxx"
password: "xxx"
captive_portal:
### RS485
uart:
- id: uart_1
rx_pin: 19
tx_pin: 18
baud_rate: 4800
stop_bits: 1
## In case of use of multiple RS485 adapters
# - id: uart_2
# rx_pin: 16
# tx_pin: 15
# baud_rate: 4800
# stop_bits: 1
modbus:
- id: modbus1
uart_id: uart_1
flow_control_pin: 4
send_wait_time: 250ms # Time between each sensor read. Increase to avoid overlapping reads or in case of CRC errors
## In case of use of multiple RS485 adapters
# - id: modbus2
# uart_id: uart_2
# flow_control_pin: 2
modbus_controller:
- id: con_modbus_1
modbus_id: modbus1
update_interval: 11s
address: 0x01 # Set/write the right address in the sensor memory before use
command_throttle: 150ms
setup_priority: -10
- id: con_modbus_2
modbus_id: modbus1
update_interval: 11s
address: 0x02 # Set/write the right address in the sensor memory before use
command_throttle: 150ms
setup_priority: -10
## In case of use of multiple RS485 adapters
# - id: con_modbus_name3
# modbus_id: modbus2
# update_interval: 11s
# address: 0x03 # Set/write the right address in the sensor memory before use
# command_throttle: 150ms
# setup_priority: -10
sensor:
# Sensor 1
- platform: modbus_controller
modbus_controller_id: con_modbus_1
name: "Humidity"
id: humidity
address: 0x0000
register_type: read
value_type: U_WORD
unit_of_measurement: "%"
accuracy_decimals: 2
filters:
- multiply: 0.1
state_class: measurement
- platform: modbus_controller
modbus_controller_id: con_modbus_1
name: "Temperature"
id: temperature
address: 0x0001
register_type: read
value_type: U_WORD
unit_of_measurement: "°C"
accuracy_decimals: 2
filters:
- multiply: 0.1
state_class: measurement
- platform: modbus_controller
modbus_controller_id: con_modbus_1
name: "Conductivity"
id: conductivity
address: 0x0002
register_type: read
value_type: U_WORD
unit_of_measurement: "μs/cm"
accuracy_decimals: 1
state_class: measurement
# Sensor 2
- platform: modbus_controller
modbus_controller_id: con_modbus_2
name: "Humidity 2"
id: humidity_2
address: 0x0000
register_type: read
value_type: U_WORD
unit_of_measurement: "%"
accuracy_decimals: 2
filters:
- multiply: 0.1
state_class: measurement
- platform: modbus_controller
modbus_controller_id: con_modbus_2
name: "Temperature 2"
id: temperature_2
address: 0x0001
register_type: read
value_type: U_WORD
unit_of_measurement: "°C"
accuracy_decimals: 2
filters:
- multiply: 0.1
state_class: measurement
- platform: modbus_controller
modbus_controller_id: con_modbus_2
name: "Conductivity 2"
id: conductivity_2
address: 0x0002
register_type: read
value_type: U_WORD
unit_of_measurement: "μs/cm"
accuracy_decimals: 1
state_class: measurement