Skip to content

Add Satel Integra config flow #138946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: dev
Choose a base branch
from

Conversation

Tommatheussen
Copy link
Contributor

@Tommatheussen Tommatheussen commented Feb 20, 2025

Breaking change

Adds Config flow to the Satel Integra integration, existing YAML config is imported.

Proposed change

  • Moved constant value to const file
  • Added config flow to configure connection
  • Added subentry flows to configure partitions, zones and outputs (previously configured in YAML)
  • Added YAML import
  • Added test for the config and subentry flow

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • 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.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed config-flow This integration migrates to the UI by adding a config flow deprecation Indicates a breaking change to happen in the future integration: satel_integra new-feature Quality Scale: legacy labels Feb 20, 2025
@joostlek
Copy link
Member

Can you give an example current YAML configuration? I need a little more information to be able to review this :)

@Tommatheussen
Copy link
Contributor Author

Sure, here is the YAML config for my existing installation:

satel_integra:
  partitions:
    01:
      name: huis
  zones:
    01:
      name: toilet downstairs
      type: window
    02:
      name: frontdoor
      type: door
    03:
      name: office
      type: window
    04:
      name: sliding door
      type: door
    05:
      name: backdoor
      type: door
    06:
      name: bedroom 1 left
      type: window
    07:
      name: bedroom 1 middle
      type: window
    08:
      name: bedroom 1 right
      type: window
    09:
      name: bedroom 2
      type: window
    10:
      name: bedroom 3
      type: window
    11:
      name: bathroom
      type: window
    12:
      name: attic left
      type: window
    13:
      name: attic right
      type: window

I only have a basic installation with contact sensors and 1 partition (monitored location), the code should also work with the outputs (sirens, door latches etc) and multiple partitions but I haven't been able to test that on my actual system.

@joostlek
Copy link
Member

How do you now map zones and partitions to HA?

@Tommatheussen
Copy link
Contributor Author

Each partition maps to a control panel, zones and outputs maps to individual binary sensors. Switchable outputs map to switches. I'm using the Options flow to allow users to set up each entry 1 by 1

@joostlek
Copy link
Member

Right, because currently we now also have config sub entries, which can create "sub" children, and I think that could work here

@Tommatheussen
Copy link
Contributor Author

I think I looked at config sub entries when I was working on this, but back then it was just added to HA. Are there are example integrations that can be set up like that already so I can take a look at how they work?

@joostlek
Copy link
Member

I know ntfy uses it, and mqtt but mqtt probably isn't a good example for this

@Tommatheussen Tommatheussen marked this pull request as draft May 26, 2025 17:21
@Tommatheussen
Copy link
Contributor Author

Marking as draft again for now until I've been able to fully test at home and adjusted tests

@Tommatheussen
Copy link
Contributor Author

Adjusted to subentries now, my production imported YAML now looks like this:
image
Each entry type can be added from the menu
image

@Tommatheussen Tommatheussen marked this pull request as ready for review May 28, 2025 08:55
@Tommatheussen
Copy link
Contributor Author

I'm not sure we want to change the title so it also reflects the entry type (partition, zone etc) and it's mapped number on the Satel system, that might help with knowing which entry is which later on

@frenck frenck requested a review from Copilot June 26, 2025 21:28
Copy link
Contributor

@Copilot 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.

Pull Request Overview

This PR introduces a full UI config flow for the Satel Integra integration, migrating from YAML-only configuration to Home Assistant’s config entries with subentries for partitions, zones, outputs, and switchable outputs. Key changes include:

  • Moving hardcoded values into const.py, implementing ConfigFlow and ConfigSubentryFlow in config_flow.py
  • Updating platform modules (binary_sensor.py, switch.py, alarm_control_panel.py) to use async_setup_entry and subentries
  • Adding YAML import support with deprecation issue warnings and tests for the config flow

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/components/satel_integra/test_config_flow.py New tests covering user/import/option/subentry flows
homeassistant/components/satel_integra/const.py Centralized new constants and dataclass definitions
homeassistant/components/satel_integra/config_flow.py Added main config flow, import, options, subentries
homeassistant/components/satel_integra/switch.py Migrated switch platform to async_setup_entry
homeassistant/components/satel_integra/binary_sensor.py Migrated binary sensor platform to async_setup_entry
homeassistant/components/satel_integra/alarm_control_panel.py Migrated alarm panel platform to async_setup_entry
homeassistant/components/satel_integra/init.py Added YAML import task and entry setup/unload logic
homeassistant/components/satel_integra/strings.json New translation keys for config/subentries/issues
homeassistant/components/satel_integra/manifest.json Updated manifest with codeowners, config_flow, single config entry
requirements_test_all.txt Added satel-integra==0.3.7 for test environment
Comments suppressed due to low confidence (5)

homeassistant/components/satel_integra/binary_sensor.py:66

  • Typo in variable name 'ouput_type'; rename to 'output_type' for clarity and consistency.
        ouput_type = subentry.data[CONF_ZONE_TYPE]

homeassistant/components/satel_integra/alarm_control_panel.py:49

  • [nitpick] Variable 'zone_name' is misleading in this context since it represents a partition name; consider renaming to 'partition_name' for clarity.
        zone_name = subentry.data[CONF_NAME]

homeassistant/components/satel_integra/config_flow.py:222

  • [nitpick] Consider using a consistent error key such as 'cannot_connect' for abort reasons to align with other flow errors and translation keys.
        return self.async_abort(reason="Failed to connect")

homeassistant/components/satel_integra/strings.json:150

  • Add a translation entry for the 'deprecated_yaml' translation_key under 'issues' so the deprecation warning has a matching title and description.
  "issues": {

homeassistant/components/satel_integra/switch.py:24

  • [nitpick] No tests cover the switch platform setup; consider adding tests to verify entities are created correctly for switchable outputs.
async def async_setup_entry(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed config-flow This integration migrates to the UI by adding a config flow deprecation Indicates a breaking change to happen in the future integration: satel_integra new-feature Quality Scale: legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants