-
-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing to Modbus registers stopped working #94149
Comments
Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) modbus documentation |
Two things:
|
Hi Debug is activated in configuration.yaml: logger: I've removed all custom_components, for some odd reason HACS still comes up in the log (eventhough I removed the integration as well). |
there are no debug lines from neither pymodbus nor modbus. It means you did not restart HA, so it did not pickup the configuration or the modbus integration never connected. you can control it yourself, the log needs to contain a lot modbus debug lines. |
please remember We need a debug log containing your attempt to write, so we can see what actually happens. One of the possible problems is that your device wants a write_register and not write_registers as you have chooses by using an array. |
I've tried multiple restarts and multiple register writes and it is still not showing up in the logs. Can you perhaps confirm if the logging is set up correctly as I don't know how else I can get it to log... The only modbus entries I see is on startup when the port is opened. Log file setup in configuration.yaml: Loads default set of integrations. Do not remove.default_config: logger: Load frontend themes from the themes folderfrontend: Text to speechtts:
automation: !include automations.yaml homeassistant: |
seems you did not do the needed spaces at the start of each. The documentation have an example ready to copy/paste. |
Managed to get the log to work after I have yet again did a clean install. This is now running a HA OS on a Odroid XU4. I can see the write errors but it is not clear to me what it actually mean |
you have a problem: Left_Inverter: Modbus Error: [Connection] Failed to pymodbus.logging] [Errno 2] could not open port /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_789195d4659cec11b292654d73138bba-if00-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_789195d4659cec11b292654d73138bba-if00-port0' seems your serial port cannot be opened, this is a problem outside our control. This continues throughout the log, so you have not read any values, and of course you are also not able to write registers. Closing this issue as it is a user problem and not a bug in the integration. |
Hi @janiversen i’ve seen the message but I don’t think it is the cause. I am able to successfully read from the device. The error randomly appears- I suspect it sometimes updates too quickly or updates during a change on the hardware parameters itself. Here is proof that it is not the port thab cannot be opened: |
Well if you say so, I requested a debug log showing the write fails and the successful communication before, so I assumed you provided that. I can only interpret the log you supply, and the last log was clearly a connect error so if you claim that is not the problem then please provide a log showing the problem. |
Hi Here's an updated log file: I have removed all but one of the addresses I am scanning. I am able to write to the register successfully (see below screenshot) although I noticed two errors in the log file (above) again. Could updating/scanning of the modbus sensor entities cause or prevent a write cycle from taking place? If so, is there a way to suspend modbus reading/scanning until writing is complete? |
That is not a debug log ! apart from that the only error is the I/O and that will surely interrupt both read and write cycles, Without a real debug log containing a failing write I cannot help you further. |
Thank you trying to assist. The device is not added as an integration so I cannot enable debug logging as with other integrations. The sensors appear as entities. |
#Read the documentation for the modbus integration |
@janiversen, /dev/serial/by-id is broken due to a recent Linux update. |
The problem
At some point of time (unsure if this was due to an update), writing to a modbus register stopped working for me. I don't use it (writing) often, however for the past week or so I have been trying to write to a modbus register with no success. Writing to the register does not fail or produce an error, it just does not update the register with the new value. I have no problem reading modbus registers and have been able to do so continuously for months already.
I tried different HA installations: HA Supervised, HA OS, different hardware, e.g. Odroid XU4, two different Generic X86-64 machines. The device (a Growatt SPF 5000 ES inverter) is connected via an onboard usb-to-serial device (the underlying chipset is Silicon Lab CP210x).
What version of Home Assistant Core has the issue?
2023.5.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Modbus
Link to integration documentation on our website
https://www.home-assistant.io/integrations/modbus/
Diagnostics information
home-assistant_2023-06-07T09-47-19.107Z.log
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: