Skip to content
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

[Bug]: BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 #1223

Open
wills106 opened this issue Jan 16, 2025 · 14 comments
Open
Assignees
Labels

Comments

@wills106
Copy link
Owner

Describe the bug

Warning in log for BinaryPayloadDecoder is deprecated and will be removed in v3.9.0

Integration Version

2025.01.8

Homeassistant core version

2025.1.2

Inverter brand

All

Plugin used

plugin_solax.py

Serial prefix

N/A

Inverter firmware versions

N/A

Connection Method

N/A

Dongle firmware

N/A

Detailed Error Log

BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 ! Please use "client.convert_from_registers()" or "client.convert_to_registers" See documentation: "https://pymodbus.readthedocs.io/en/latest/source/client.html#pymodbus.client.mixin.ModbusClientMixin.convert_from_registers"

Additional context

I have raised this to try and reduce multiple Issues raised for the same warning.

Please don't spam this Issue saying you have the same error, as everyone will have this warning.

@wills106 wills106 added bug Something isn't working solax labels Jan 16, 2025
@wills106 wills106 self-assigned this Jan 16, 2025
@PSMGoossens
Copy link
Contributor

It seems that that the deprecation is no longer the case, but it's strange that it's popping up
https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.8.3
Anyway it's good that it is removed, because otherwise it means a bigger rewrite, since the new "solution" is less flexible and doesn't support some key features such as ordering

@wills106
Copy link
Owner Author

I'll keep track of pyModbus in case we do need to make the change, although there seems to be little examples of the changes required other than the very basic ones.

@PSMGoossens
Copy link
Contributor

Yeah I agree,
But it seems that we can only convert one datatype at the same and "skip" functionality is not there, and no support for ordering of int32.
See also discussion at pyModbus: pymodbus-dev/pymodbus#2456

@smartminjos
Copy link

same issue here ..... if you need any logs, let me know ...

@MrRickwi
Copy link

Same here, log is flooded:

Logger: pymodbus.logging
Quelle: custom_components/solax_modbus/init.py:771
Integration: SolaX Inverter Modbus (Dokumentation, Probleme)
Erstmals aufgetreten: 17. Januar 2025 um 06:27:19 (48216 Vorkommnisse)
Zuletzt protokolliert: 11:09:20

BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 ! Please use "client.convert_from_registers()" or "client.convert_to_registers" See documentation: "https://pymodbus.readthedocs.io/en/latest/source/client.html#pymodbus.client.mixin.ModbusClientMixin.convert_from_registers"

@PSMGoossens
Copy link
Contributor

Hi @wills106
I think we have a few options to solve this issue, I would like your opinion in this matter:
The operations are:

  1. Rewrite the logic of fetchting the data. I think it's not performance optimal, but that is what they are using in the "solar" example at pyModbus, solar example
  2. We could bring the payload.py from pyModbus to the application and support it ourself
  3. We could write our own code to do the encoding / decoding.
  4. Any other libs available?

I would prefer option 2 for now, brings the least risk and I don't think we need to maintain it a lot.

@flopp999
Copy link

flopp999 commented Jan 22, 2025

I don't know but maybe this can help you.
I have an Growatt MID 15KTL3-XH.
I tried and this code is working, at least for Growatt.
I didn't try those lines in Solax integration but I ran those lines by themself in a .py file

from pymodbus.client.mixin import ModbusClientMixin
registers = [19071, 20016, 17462, 17457, 12874]
serial=ModbusClientMixin.convert_from_registers(registers, data_type=ModbusClientMixin.DATATYPE.STRING)
print(serial)

will give output
N0D6D12J

link to classmethod
https://github.com/pymodbus-dev/pymodbus/blob/f7271cdf52770c0fb14d165ed35c3bc13fe7ae7e/pymodbus/client/mixin.py#L697

@honekr
Copy link

honekr commented Jan 24, 2025

Same issue:

Tato chyba pochází z vlastní integrace.

Logger: pymodbus.logging
Zdroj: custom_components/solax_modbus/__init__.py:771
integrace: SolaX Inverter Modbus (dokumentace, problémy)
První výskyt: 08:45:11 (1764 výskyty)
Naposledy logováno: 09:48:02

BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 ! Please use "client.convert_from_registers()" or "client.convert_to_registers" See documentation: "https://pymodbus.readthedocs.io/en/latest/source/client.html#pymodbus.client.mixin.ModbusClientMixin.convert_from_registers"

@PSMGoossens
Copy link
Contributor

I've created a PR where payload.py is brought to the application and the deprecration message is removed #1232

@steps56
Copy link

steps56 commented Jan 27, 2025

I've created a PR where payload.py is brought to the application and the deprecration message is removed #1232

Thanks.
Used the latest integration zip
https://github.com/wills106/homeassistant-solax-modbus/archive/refs/heads/main.zip
with the added payload file and no errors spamming HA any more.
Well done 👌.

@steps56
Copy link

steps56 commented Jan 28, 2025

Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: pymodbus.logging
Quelle: custom_components/old_solax_modbus/init.py:771
Integration: old_solax_modbus
Erstmals aufgetreten: 11:28:42 (4 Vorkommnisse)
Zuletzt protokolliert: 11:28:43

BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 ! Please use "client.convert_from_registers()" or "client.convert_to_registers" See documentation: "https://pymodbus.readthedocs.io/en/latest/source/client.html#pymodbus.client.mixin.ModbusClientMixin.convert_from_registers"

Sadly its back again after HA Update today...😪
If its possible, it should be fixed permanently to avoid future error spamming at each new HA core a. s. o. Update.
Thanks in advance.

Edit/Update:
The HA core Update crabbed all folders at costom components... and as I renamed the original one to "old_...." for safety if the workaround made by PSMGoossens (thanks a lot) wouldn't have worked.
Now after deleting the "old_..." and a HA start, all error spam has gone again gladly.
Hope this will survive the newt few HA core updates too...

@wills106
Copy link
Owner Author

wills106 commented Jan 30, 2025

Just released 2025.01.9 with the change.

Looks like reading groups of registers will return in the new version pymodbus-dev/pymodbus#2525 (comment)

Edit: It's been abandoned.

@smartminjos
Copy link

work like a charm ! thanks

@wills106
Copy link
Owner Author

wills106 commented Jan 30, 2025

Looks like reading groups of registers will return in the new version pymodbus-dev/pymodbus#2525 (comment)

Edit: It's been abandoned.

Probably need to look at how many separate reads would be needed with the new method. Unless we can string together the convert calls?

Or just stick with payload decoder being in this Integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants