Skip to content

homematicip_cloud: fix HmIP-FLC lock state polarity#170159

Merged
frenck merged 1 commit into
home-assistant:devfrom
lackas:hmip-flc-lock-polarity
May 11, 2026
Merged

homematicip_cloud: fix HmIP-FLC lock state polarity#170159
frenck merged 1 commit into
home-assistant:devfrom
lackas:hmip-flc-lock-polarity

Conversation

@lackas
Copy link
Copy Markdown
Contributor

@lackas lackas commented May 8, 2026

Breaking change

Proposed change

The HmIP-FLC Locked binary sensor returns the inverted state. It uses BinarySensorDeviceClass.LOCK, where the HA convention is ON = unlocked / open and OFF = locked / closed. The sensor currently returns ON when the API reports LOCKED, so it displays the opposite of the lock's actual state.

Reported on hahn-th/homematicip-rest-api#606 by a user with an HmIP-FLC. After receiving their diagnostics, the polarity turns out to depend on the channel's binaryBehaviorType configuration:

  • NORMALLY_OPEN (default): contact closure (e.g. magnetic door contact registering door closed) puts the input in the active state, which the firmware reports as lockState=LOCKED. To present "door closed = off" in HA the value must be inverted.
  • NORMALLY_CLOSE: the same physical event puts the input in the idle state, reported as lockState=UNLOCKED. Here the value must be used as-is.

The fix reads binaryBehaviorType from the channel and inverts conditionally, so HA shows the right state regardless of how the user wired the contact in the HmIP app. Tests cover all four combinations of binaryBehaviorType × lockState.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented May 8, 2026

Hey there @hahn-th, mind taking a look at this pull request as it has been labeled with an integration (homematicip_cloud) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homematicip_cloud can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign homematicip_cloud Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

The Locked binary sensor uses BinarySensorDeviceClass.LOCK, where the
HA convention is ON = unlocked / open and OFF = locked / closed. The
sensor returned ON when the API reports LOCKED, displaying the opposite
of the actual lock state.

Reported on hahn-th/homematicip-rest-api#606 by user dennisiser.

Update the test fixture-derived expectations accordingly: the FLC
fixture starts with lockState=LOCKED (now STATE_OFF) and the test
manipulates it to UNLOCKED (now STATE_ON).
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @lackas 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck frenck merged commit 86a967e into home-assistant:dev May 11, 2026
33 checks passed
@frenck frenck added this to the 2026.5.2 milestone May 11, 2026
lmaertin pushed a commit to lmaertin/homeassistant-core that referenced this pull request May 11, 2026
raman325 added a commit to raman325/home-assistant that referenced this pull request May 12, 2026
…-timer

* upstream/dev:
  Bump infrared-protocols to 5.1.0 (home-assistant#170365)
  Clean up template engine after extension modularization (home-assistant#170346)
  Bump axis to v71 (home-assistant#170347)
  Enhance WebDAV metadata download with concurrency (home-assistant#170223)
  Add target temperature sensor for ViCare RadiatorActuator devices (home-assistant#170102)
  Bump pyzbar to 0.1.9 (home-assistant#170076)
  homematicip_cloud: fix HmIP-FLC lock state polarity (home-assistant#170159)
  Watts: add timer mode service (home-assistant#169846)
  Set parallel updates for Ecowitt platforms (home-assistant#170349)
  Add config flow to Avea (home-assistant#168070)
  Cleanup Eurotronic number platform (home-assistant#170337)
  Add number platform to eurotronic_cometblue (home-assistant#168119)
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants