Skip to content

Fix pymodbus ≥3.0 compatibility by replacing unpack_bitstring import#24

Open
Uhae wants to merge 1 commit into
redpomodoro:mainfrom
Uhae:fix/pymodbus-unpackbitstring
Open

Fix pymodbus ≥3.0 compatibility by replacing unpack_bitstring import#24
Uhae wants to merge 1 commit into
redpomodoro:mainfrom
Uhae:fix/pymodbus-unpackbitstring

Conversation

@Uhae
Copy link
Copy Markdown

@Uhae Uhae commented Jul 31, 2025

This integration fails on pymodbus 3.x due to:
ImportError: cannot import name 'unpack_bitstring' from 'pymodbus.utilities'

This PR removes the broken import and replaces it with a local implementation of unpack_bitstring() (copied from pymodbus 2.x). Also corrects an indentation bug that caused __init__() to break.

Tested with:

  • Home Assistant Core 2024.x
  • pymodbus==3.3.0
  • BYD LVS system

Restores full compatibility with newer HA installs.

@tsrz
Copy link
Copy Markdown

tsrz commented Aug 6, 2025

thank you, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants