-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
esp32-multiple-uarts-example.yaml
267 lines (242 loc) · 7.92 KB
/
esp32-multiple-uarts-example.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
substitutions:
name: soyosource-gtn-virtual-meter
device_description: "Monitor multiple Soyosource GTNs and control the power output on demand both via RS485"
device0: firstfloor_soyosource_gtn_virtual_meter
device1: groundfloor_soyosource_gtn_virtual_meter
external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main
tx_pin_uart_0: GPIO1
rx_pin_uart_0: GPIO3
tx_pin_uart_1: GPIO14
rx_pin_uart_1: GPIO4
esphome:
name: ${name}
comment: ${device_description}
min_version: 2024.6.0
project:
name: "syssi.esphome-soyosource-gtn-virtual-meter"
version: 2.2.0
esp32:
board: esp-wrover-kit
external_components:
- source: ${external_components_source}
refresh: 0s
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
ota:
platform: esphome
logger:
baud_rate: 0
level: INFO
# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
password: !secret mqtt_password
id: mqtt_client
# api:
uart:
- id: uart_0
baud_rate: 4800
tx_pin: ${tx_pin_uart_0}
rx_pin: ${rx_pin_uart_0}
- id: uart_1
baud_rate: 4800
tx_pin: ${tx_pin_uart_1}
rx_pin: ${rx_pin_uart_1}
soyosource_modbus:
- id: modbus0
uart_id: uart_0
# flow_control_pin: GPIO12
# The name is used as prefix for some log messages and should
# help to distinguish between different instances/devices
name: firstfloor
- id: modbus1
uart_id: uart_1
name: groundfloor
# flow_control_pin: GPIO13
soyosource_inverter:
- id: inverter0
soyosource_modbus_id: modbus0
- id: inverter1
soyosource_modbus_id: modbus1
soyosource_virtual_meter:
- id: virtualmeter0
soyosource_modbus_id: modbus0
update_interval: 3s
# the state of this sensor (instantaneous power in watt) is used as source
power_id: powermeter0
power_sensor_inactivity_timeout: 20s
power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED
min_power_demand: 0
max_power_demand: 900
zero_output_on_min_power_demand: true
# A positive buffer value (10) tries to avoid exporting power to the grid (demand - 10 watts)
# A negative buffer value (-10) exports power to the grid (demand + 10 watts)
buffer: 10
# The operation_status_id sensor is expected here. Passing the operation_status won't work
# The state is used to suspend the limiter if the operation status of the inverter isn't 0x0 (normal)
# operation_status_id: operation_status_id0
- id: virtualmeter1
soyosource_modbus_id: modbus1
update_interval: 3s
# the state of this sensor (instantaneous power in watt) is used as source
power_id: powermeter1
power_sensor_inactivity_timeout: 20s
power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED
min_power_demand: 0
max_power_demand: 900
zero_output_on_min_power_demand: true
# A positive buffer value (10) tries to avoid exporting power to the grid (demand - 10 watts)
# A negative buffer value (-10) exports power to the grid (demand + 10 watts)
buffer: 10
# The operation_status_id sensor is expected here. Passing the operation_status won't work
# The state is used to suspend the limiter if the operation status of the inverter isn't 0x0 (normal)
# operation_status_id: operation_status_id1
binary_sensor:
- platform: soyosource_inverter
soyosource_inverter_id: inverter0
fan_running:
name: "${device0} fan running"
- platform: soyosource_inverter
soyosource_inverter_id: inverter1
fan_running:
name: "${device1} fan running"
number:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
buffer:
name: "${device0} buffer"
initial_value: 10
restore_value: true
manual_power_demand:
name: "${device0} manual power demand"
max_power_demand:
name: "${device0} max power demand"
initial_value: 600
restore_value: true
power_demand_divider:
name: "${device0} power demand divider"
initial_value: 1
restore_value: true
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
buffer:
name: "${device1} buffer"
initial_value: 10
restore_value: true
manual_power_demand:
name: "${device1} manual power demand"
max_power_demand:
name: "${device1} max power demand"
initial_value: 600
restore_value: true
power_demand_divider:
name: "${device1} power demand divider"
initial_value: 1
restore_value: true
sensor:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
power_demand:
name: "${device0} power demand"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
power_demand:
name: "${device1} power demand"
- platform: soyosource_inverter
soyosource_inverter_id: inverter0
operation_status_id:
name: "${device0} operation status id"
id: operation_status_id0
battery_voltage:
name: "${device0} battery voltage"
battery_current:
name: "${device0} battery current"
battery_power:
name: "${device0} battery power"
ac_voltage:
name: "${device0} ac voltage"
ac_frequency:
name: "${device0} ac frequency"
temperature:
name: "${device0} temperature"
- platform: soyosource_inverter
soyosource_inverter_id: inverter1
operation_status_id:
name: "${device1} operation status id"
id: operation_status_id1
battery_voltage:
name: "${device1} battery voltage"
battery_current:
name: "${device1} battery current"
battery_power:
name: "${device1} battery power"
ac_voltage:
name: "${device1} ac voltage"
ac_frequency:
name: "${device1} ac frequency"
temperature:
name: "${device1} temperature"
# mqtt subscribe example
- id: powermeter0
internal: true
platform: mqtt_subscribe
name: "${device0} instantaneous power consumption"
topic: "smartmeter/sensor/firstfloor/obis/1-0:16.7.0/255/value"
accuracy_decimals: 2
unit_of_measurement: W
device_class: power
filters:
- throttle_average: 15s
- id: powermeter1
internal: true
platform: mqtt_subscribe
name: "${device1} instantaneous power consumption"
topic: "smartmeter/sensor/groundfloor/obis/1-0:16.7.0/255/value"
accuracy_decimals: 2
unit_of_measurement: W
device_class: power
filters:
- throttle_average: 15s
# # import smartmeter reading from homeassistant f.e.
# # requires the "api" component see above
# - platform: homeassistant
# id: powermeter0
# name: "${device0} smartmeter instantaneous power"
# entity_id: sensor.firstfloor_smartmeter_instantaneous_power
#
# - platform: homeassistant
# id: powermeter1
# name: "${device1} smartmeter instantaneous power"
# entity_id: sensor.groundfloor_smartmeter_instantaneous_power
switch:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
manual_mode:
name: "${device0} manual mode"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
manual_mode:
name: "${device1} manual mode"
text_sensor:
- platform: soyosource_inverter
soyosource_inverter_id: inverter0
operation_status:
name: "${device0} operation status"
- platform: soyosource_inverter
soyosource_inverter_id: inverter1
operation_status:
name: "${device1} operation status"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
operation_mode:
name: "${device0} limiter operation mode"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
operation_mode:
name: "${device1} limiter operation mode"