Closed beocycris closed 2 years ago
Could you provide some details about your setup? A photo of your wiring (incl. the RS485 module) and the important parts (uart
section) of your configuration yaml?
Another interpretation of the log message is: "The device doesn't respond". Therefore we must make sure your device is connected properly. If this is the case it's possible your device version uses another protocol. Let's start with the wiring!
I won´t be at home till friday - so I decided to do a small scheme of the cabling.
And the code too:
substitutions:
name: solar-powermeter
esphome:
name: ${name}
platform: esp8266
board: d1_mini
external_components:
#- source: github://syssi/esphome-modbus-solax-x1@add-solax-x1-mini-g2-compatibility
- source: github://syssi/esphome-modbus-solax-x1@main
refresh: 0s
uart:
baud_rate: 9600
tx_pin: GPIO2
rx_pin: GPIO1
solax_x1:
serial_number: "3132333435363737363534333231"
address: 0x0A
update_interval: 2s
text_sensor:
- platform: solax_x1
mode_name:
name: "${name} mode name"
errors:
name: "${name} errors"
thanks!
I assume your RS485 module isn't handled properly:
https://electronics.stackexchange.com/questions/153500/correctly-using-re-and-de-with-rs485
I will add a flow control pin to the component to support your rs485 module. At the moment DE/RE isn't used correctly.
I've introduced a flow control pin here:
https://github.com/syssi/esphome-modbus-solax-x1/pull/19
Please use this new feature branch for your tests:
external_components:
- source: github://syssi/esphome-modbus-solax-x1@add-flow-control
refresh: 0s
The next step is to update your configuration to use flow control pin:
This should fit for you
uart:
id: uart0
baud_rate: 9600
tx_pin: GPIO5
rx_pin: GPIO4
modbus_solax:
id: modbus0
uart_id: uart0
flow_control_pin: GPIO0
solax_x1:
modbus_solax_id: modbus0
serial_number: "3132333435363737363534333231"
address: 0x0A
update_interval: 2s
I just found another issue. Your configuration doesn't align with your schema. Your schema shows:
tx_pin
) / GPIO5
tx_pin
) / GPIO4
flow_control
) GPIO0
The yaml configuration uses:
tx_pin
) / GPIO2
rx_pin
) / GPIO1
Please update your wiring.
Do i have to change my wiring physically? Or may I can use the:
D1=GPIO4 as tx
to the RS485-pin RO
,
D2=GPIO5 as rx
to the RS485-pin DI
and
GPIO0 as flowcontrole pin, connected to the bridged RS485-pins RE/DE
?
Or shell I change GPIO5 to the original tx
-pin and the GPIO to the rx
-pin on the microcrontroller?
Because I changed the my code to your provided one and nothing different happened than the issue above.
The tx_pin
must connected to DI
not RI
. If you use GPIO4
and GPIO5
a software serial implementation is used by ESPHome because these GPIOs doesn't support native UART. I would use the hardware/native UART pins of the ESP8266. The best wiring would look like this:
api:
ota:
logger:
level: INFO
baud_rate: 0 # <--- super important!
uart:
id: uart0
baud_rate: 9600
tx_pin: GPIO1
rx_pin: GPIO3
modbus_solax:
id: modbus0
uart_id: uart0
flow_control_pin: GPIO0
solax_x1:
modbus_solax_id: modbus0
serial_number: "3132333435363737363534333231"
address: 0x0A
update_interval: 2s
Ah ok got you.
So my config:
uart:
id: uart0
baud_rate: 9600
tx_pin: GPIO4
rx_pin: GPIO5
modbus_solax:
- id: modbus0
uart_id: uart0
flow_control_pin: GPIO2
solax_x1:
modbus_solax_id: modbus0
serial_number: "3132333435363737363534333231"
address: 0x0A
update_interval: 2s
Won´t work properly.
Then I really have to wait till weekend, when I´m able to solder the pins to tx
and rx
instead using GPIO4
and GPIO5
. GPIO2
also seems to be wrong and has to be GPIO0
.
How did you check this? You are from Germany aren't you? My inverter is offline already because it's dark out there. Without solar energy the device doesn't respond /shuts down.
1.: Wow - tell me "the stupid guy". 2.: Yes I´m from Germany. 3.: You're right. 4.: See 1. ......
So I have to give it another try tomorrow! Thank you!!!!
I´m just trying to receive the data stream. But like yesterday in the evening, no changes .....
Do i have to change any setting in the invertermenu ? Maybe the ModbusRTU to enable?
Please check your wiring this weekend. It's super important RE/DE
is connected properly.
Inverter settings: I don't have any menu items to enable/disable modbus. There is also no menu item to change the modbus address / device id for example. At my firmware version modbus is always enabled. Are you able to control something in this regard?
Yes - I will check, if RE/DE
is connected properly
I have the enabling option and also a menu to change the address of modbus.
But like you said, I´m only able to check that on friday.
What if I change the address to 10
. Do I have to change the yaml to 0x0A
or 0x10
?
The different menu sounds like real modbus rtu (polling selected registers). There are multiple things we should try as soon you have access to your device. ;-)
Could you provide your exact model name of the type label (something like X1-2.0-S-D(L)
), the software versions (master/manager) of your device and may be some photos of the menu structure? It should help to compare your device with well known devices/protocols.
Good morning. Well- the sun is shining so I was able to take a look at my settings. It s a X1 1.5 SD(L)
Could you look for some firmware versions at the menu?
Do you need these?
Perfect! Next wish: Could you provide a photo of the type label (on the right side of the device)?
Please provide some photos of your new wiring as next step. Enable the debug output of the UART component:
https://github.com/syssi/esphome-modbus-solax-x1#debugging
and provide some logs. It would like to know there is some serial traffic (outgoing & incoming) or not.
Sorry for the bad quality:
TX
= DI
= blue cable
RX
= RO
= green cable
D4
= DE/RE
= brown cable
Alright! Next step is to collect some serial traffic. Could you provide some logs (debug output of the uart
component enabled)?
Could you provide your configuration yaml? I would like to check you are using D4 = GPIO2 vs. D3 = GPIO0
.
I think there ist some communication......
Looks good! :-) Issue solved.
Thank you very much for supporting me!
Please make sure to set the logger
to 0 baud if you use GPIO1 and 3. Otherwise log messages are transmitted to the inverter too. ;-)
I will merge the flow control support into main now. Please update the feature branch at the external components section to @main
again later the day.
Of course. It should be fine like this!
Perfect! Last question about your device: You've enabled the ModbusRTU setting and the device address
is set to 1
. Right? I would like to improve the docs.
No is disabled the RTU option.
Hey guys,
thank for this modules. In my case I try to use it with a Solax X1 mini 1.5 V2. And I only receive the text which is mentioned in the title. May anyone has the same issue and can help me to fix it.
regards frank