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 · 28 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.

@PSMGoossens
Copy link
Contributor

PSMGoossens commented Feb 4, 2025

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.

Calling the separate registers will be a massive overhead, so I think for now we should keep this solution
@wills106 Could you close this issue?

@wills106
Copy link
Owner Author

wills106 commented Feb 4, 2025

Calling the separate registers will be a massive overhead

I agree and don't fancy going that route unless we have too.

@wills106 wills106 closed this as completed Feb 4, 2025
@hubertozog
Copy link

@wills106 Unfortunately looks like problem appeared again. Or its some issue on my side?

@steps56
Copy link

steps56 commented Feb 19, 2025

@wills106 Unfortunately looks like problem appeared again. Or its some issue on my side?

... and an other one, those spikes at many values from time to time.
Mentionend at a separate thread, but never answered if been under investigation by wills106 😪.

Now, many stuck at 2025.01.6 Modbus Integration to avoid spikes and misfunction of newer versions sadly 🤷🏼‍♂️.

@wills106
Copy link
Owner Author

I have noticed you get the warning on restarting HA. But you only get it the once and not 10,000 times.

@steps56
Copy link

steps56 commented Feb 20, 2025

I have noticed you get the warning on restarting HA. But you only get it the once and not 10,000 times.

Yes, this is right.

@hubertozog
Copy link

In my case i got 12k times till last restart. So maybe somthing on my side, but what?

2025-02-20 12:07:14.600 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:14.981 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:15.047 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:15.451 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:15.834 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:15.901 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:29.602 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:29.985 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:30.063 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:30.471 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:30.853 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:30.919 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:44.614 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:44.996 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:45.062 WARNING (MainThread) [pymodbus.logging] 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"
2025-02-20 12:07:45.464 WARNING (MainThread) [pymodbus.logging] BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 !

@wills106
Copy link
Owner Author

In my case i got 12k times till last restart. So maybe somthing on my side, but what?

What version of the Integration are you using?

@hubertozog
Copy link

Right now 2025.02.1.

@wills106
Copy link
Owner Author

wills106 commented Feb 23, 2025

Reopening it for now, although it's not a major issue.

It only writes to the log once per HA restart.

@wills106 wills106 reopened this Feb 23, 2025
@hubertozog
Copy link

@wills106 In my case its spaming errors all the time, right now 9k times

Image

@PSMGoossens
Copy link
Contributor

Removed the left overs in all plugins via PR #1274

@steps56
Copy link

steps56 commented Mar 9, 2025

Is there a new Beta or ? out now containing your changes?
Can't find any now ...
Thanks for explaining please now.

@wills106
Copy link
Owner Author

Just released 2025.03.1 with the changes.

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

8 participants