Skip to content

Add Elk E27 Alarm Engine integration#170241

Open
mitchmitchell wants to merge 172 commits into
home-assistant:devfrom
mitchmitchell:dev
Open

Add Elk E27 Alarm Engine integration#170241
mitchmitchell wants to merge 172 commits into
home-assistant:devfrom
mitchmitchell:dev

Conversation

@mitchmitchell

@mitchmitchell mitchmitchell commented May 9, 2026

Copy link
Copy Markdown

Proposed change

Add the Elk E27 Alarm Engine integration.

This initial PR intentionally keeps the Home Assistant platform scope to alarm_control_panel, following the new integration review guidance to start with one platform. It supports:

  • Local config flow setup for an Elk E27 panel.
  • E27 linking credentials storage.
  • Alarm control panel entities for panel areas.
  • Arm away, arm home, arm night, disarm, and automatic arming action support.

Additional E27 domains are being kept for follow-up PRs.

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

elke27==0.3.7 provides the local E27 client, linking support, the public Home Assistant-facing client API, zone area metadata used by custom bypass, and runtime panel-name metadata used for device registry naming.

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 home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @mitchmitchell

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant

home-assistant Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft May 9, 2026 23:47

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When adding new integrations, limit included platforms to a single platform. Please reduce this PR to a single platform. See the review process for more details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Home Assistant integration (elke27) to support the Elk Products E27 Alarm Engine via the elke27_lib client library, including config flow onboarding, a hub/coordinator runtime model, multiple entity platforms, diagnostics, and a comprehensive test suite.

Changes:

  • Introduces the elke27 integration (manifest, config flow, hub + coordinator, entity platforms, services, translations/icons, diagnostics).
  • Adds unit tests (and opt-in live tests) covering setup, hub behavior, coordinator event handling, entities, and diagnostics.
  • Adds integration docs and a quality scale tracking file.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/components/elke27/init.py Test package marker for the integration tests.
tests/components/elke27/README.md Documents unit vs. opt-in live test execution and env vars.
tests/components/elke27/test_alarm_control_panel.py Tests area entity state mapping and arm/disarm behavior.
tests/components/elke27/test_binary_sensor.py Tests zone entity creation, device class mapping, and edge cases.
tests/components/elke27/test_climate.py Tests thermostat entity behavior and hub command delegation.
tests/components/elke27/test_coordinator.py Tests coordinator subscriptions, debouncing, and event-driven refreshes.
tests/components/elke27/test_diagnostics.py Tests diagnostics payload generation and redaction/serialization.
tests/components/elke27/test_entity.py Tests shared entity helpers (unique base, device info, panel fields).
tests/components/elke27/test_hub.py Tests hub lifecycle, reconnect logic, and command methods.
tests/components/elke27/test_identity.py Tests integration-serial generation and MAC/source-IP lookup behavior.
tests/components/elke27/test_init.py Tests integration setup/unload, unique-id migration, and service behavior.
tests/components/elke27/test_light.py Tests light entity behavior including brightness mapping.
tests/components/elke27/test_live.py Adds opt-in live tests gated by env vars/markers.
tests/components/elke27/test_lock.py Tests lock entities and hub command delegation.
tests/components/elke27/test_sensor.py Tests diagnostic sensors reflecting coordinator/hub state.
tests/components/elke27/test_switch.py Tests output switches and hub delegation + PIN-required handling.
homeassistant/components/elke27/init.py Sets up config entries, forwards platforms, registers alarm_arm_automatic service, migrates unique IDs.
homeassistant/components/elke27/alarm_control_panel.py Implements area alarm control panel entities and state mapping.
homeassistant/components/elke27/binary_sensor.py Implements zone binary sensor entities driven by snapshot + definitions.
homeassistant/components/elke27/climate.py Implements thermostat entities with mode/fan/setpoint support.
homeassistant/components/elke27/config_flow.py Implements discovery/manual onboarding and relink/reauth flow.
homeassistant/components/elke27/const.py Defines integration constants and config keys.
homeassistant/components/elke27/coordinator.py Coordinator for event-driven snapshot updates and domain refresh debouncing.
homeassistant/components/elke27/diagnostics.py Generates diagnostics and normalizes/redacts snapshot data.
homeassistant/components/elke27/docs/Change-Order-Plan.md Internal development plan for incremental integration milestones.
homeassistant/components/elke27/docs/integration-docs.md Integration documentation (setup, behavior, troubleshooting).
homeassistant/components/elke27/entity.py Shared helpers for unique IDs, device info, and snapshot field extraction.
homeassistant/components/elke27/hub.py Hub wrapper around Elke27Client lifecycle, reconnect, and command helpers.
homeassistant/components/elke27/icons.json Declares entity icon translations for the integration.
homeassistant/components/elke27/identity.py Integration-serial generation and client identity helpers.
homeassistant/components/elke27/light.py Implements light entities (incl. brightness mapping).
homeassistant/components/elke27/lock.py Implements lock entities and state parsing.
homeassistant/components/elke27/manifest.json Declares integration metadata and dependency on elke27==0.3.2.
homeassistant/components/elke27/models.py Defines Elke27RuntimeData stored on the config entry.
homeassistant/components/elke27/quality_scale.yaml Tracks quality scale rule completion/exemptions/todos.
homeassistant/components/elke27/sensor.py Implements diagnostic sensors for panel name and connection state.
homeassistant/components/elke27/services.yaml Declares the alarm_arm_automatic service schema/selector UI.
homeassistant/components/elke27/strings.json Adds config flow + entity translations.
homeassistant/components/elke27/switch.py Implements output switches and hub delegation.
Comments suppressed due to low confidence (1)

homeassistant/components/elke27/services.yaml:22

  • Mark the code selector as a password field (e.g., text: { type: password }) so alarm codes aren’t shown in clear text in the UI/service call history.
    code:
      name: Code
      description: Alarm code to arm the area.
      required: true
      selector:
        text:

Comment thread homeassistant/components/elke27/hub.py Outdated
Comment thread homeassistant/components/elke27/hub.py Outdated
Comment thread homeassistant/components/elke27/hub.py Outdated
Comment thread homeassistant/components/elke27/icons.json Outdated
Comment thread homeassistant/components/elke27/sensor.py Outdated
Comment thread homeassistant/components/elke27/entity.py Outdated
Comment thread homeassistant/components/elke27/identity.py Outdated
Comment thread homeassistant/components/elke27/alarm_control_panel.py
Comment thread homeassistant/components/elke27/docs/integration-docs.md Outdated
Copilot AI review requested due to automatic review settings May 11, 2026 02:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings May 11, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread homeassistant/components/elke27/alarm_control_panel.py
Comment thread homeassistant/components/elke27/__init__.py
Comment thread homeassistant/components/elke27/config_flow.py
Comment thread homeassistant/components/elke27/__init__.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 24 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/elke27/config_flow.py
Comment thread homeassistant/components/elke27/hub.py
Comment thread tests/components/elke27/test_coordinator.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 24 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/elke27/const.py Outdated
@mitchmitchell

Copy link
Copy Markdown
Author

Follow-up cleanup from the review pass:

  • Switched area entity device metadata to DeviceInfo.
  • Removed internal panel/table snapshot cache data from config entry options.
  • Removed unused runtime-data constants.
  • Changed already_configured to the valid common device abort translation key and regenerated translations.
  • Marked parallel-updates and entity-unavailable as done in quality_scale.yaml.
  • Added elke27_lib to manifest loggers.
  • Added a note documenting that the entry_id unique-base fallback is only defensive/test fallback behavior.
  • Updated the PR description to match the actual dependency version and current one-platform scope.

I also checked the library for panel-name support. The discovery result exposes panel_name, but the public runtime PanelInfo snapshot does not. I opened mitchmitchell/elke27#1 to track exposing the panel display name in PanelInfo so Home Assistant can use it for runtime device metadata in a follow-up.

Focused validation after merging current origin/dev:

  • .venv/bin/python -m ruff check homeassistant/components/elke27 tests/components/elke27
  • .venv/bin/python -m pytest tests/components/elke27 -q
  • .venv/bin/python -m script.hassfest --integration-path homeassistant/components/elke27 -p config_schema,quality_scale,services,translations,json,manifest

All focused checks passed.

@mitchmitchell

Copy link
Copy Markdown
Author

Updated the PR to consume the library panel-name snapshot change:

  • Bumped the dependency to elke27==0.3.7.
  • device_info_for_entry now prefers coordinator.data.panel.panel_name for the panel device name, with the existing hub name and entry title fallbacks preserved.
  • Added test coverage for the snapshot panel-name path and the hub-name fallback.
  • Updated the PR description to point at the v0.3.7 release notes.

Validation after merging current origin/dev:

  • .venv/bin/python -m ruff check homeassistant/components/elke27 tests/components/elke27
  • .venv/bin/python -m pytest tests/components/elke27 -q
  • .venv/bin/python -m script.hassfest --integration-path homeassistant/components/elke27 -p config_schema,quality_scale,services,translations,json,manifest

All focused checks passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32e3cabe2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread homeassistant/components/elke27/hub.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants