Skip to content

Make the library pass mypy --strict (v1.17.1) - #8

Merged
MattieGit merged 1 commit into
mainfrom
strict-typing
Oct 14, 2026
Merged

MattieGit merged 1 commit into
mainfrom
strict-typing

Conversation

@MattieGit

Copy link
Copy Markdown
Owner

Home Assistant core runs the hr_energy_qube integration under strict typing, and the platinum quality scale asks for a typed library. The library already ships py.typed, but mypy --strict reported 5 errors in client.py. This fixes them and adds a strict mypy step to CI so it stays that way.

  • read_value() types its register definition as (address, register type, data type, scale, offset), the shape of the tuples in const.py.
  • _decode_registers() accepts the Sequence[int] that pymodbus returns.
  • read_entity() returns float | int | bool | None instead of Any; read_binary_sensor() and read_switch() narrow that to bool | None. All binary sensors and switches are coils or discrete inputs, which already returned a bool, so no return value changes.
  • CI runs mypy --strict src/python_qube_heatpump (mypy pinned to 2.4.0); AGENTS.md lists the command.

No API or behaviour change; version 1.17.1. Core can stay on its ==1.17.0 pin.

@MattieGit
MattieGit merged commit a6fc2be into main Oct 14, 2026
3 checks passed
@MattieGit
MattieGit deleted the strict-typing branch October 14, 2026 19:55
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.

1 participant