Skip to content

Handle unknown Grundfos pump modes - #1573

Merged
Ernst79 merged 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/grundfos-unknown-pump-mode
Sep 8, 2026
Merged

Handle unknown Grundfos pump modes#1573
Ernst79 merged 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/grundfos-unknown-pump-mode

Conversation

@IoannisArmamentos

Copy link
Copy Markdown
Contributor

Summary

Handle unknown Grundfos MI401 pump mode values without crashing the BLE parser.

Problem

The Grundfos parser used a direct lookup in PUMP_MODE_DICT.

If a device reports a pump mode that is not currently known by the integration, the lookup raises KeyError. Since the value comes directly from the BLE advertisement, this can also happen with malformed packets or future firmware introducing a new mode.

Fix

Use a safe dictionary lookup and report unknown values as:

Unknown (<value>)

Known pump modes remain unchanged.

A regression test covers an advertisement containing pump mode 255.

@Ernst79 Ernst79 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@Ernst79
Ernst79 merged commit 2c8569b into custom-components:master Sep 8, 2026
6 checks passed
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