Skip to content

Conversation

philippwaller
Copy link
Contributor

@philippwaller philippwaller commented Aug 19, 2025

Proposed change

Expose showAutomationEditor(data?: Partial<AutomationConfig>, expanded?: boolean) as a public method on the ha-panel-custom. This allows custom panels (iframes) to open the Automation Editor prefilled with data.

Add a new event for show-automation-editor. This allows custom cards & panels to open the Automation Editor prefilled with data.

Until now, only the core UI could open the automation editor prefilled. Custom panels (iframes) had no way to do this, because the editor initialization (initialAutomationEditorData) was only accessible inside the main app. By exposing showAutomationEditor, embedded panels can now trigger the same flow and hand over prefilled data.

Use case:
For the KNX integration we provide a Telegram Monitor. This tool shows how KNX devices on the network exchange messages with each other (e.g., a wall switch sending a telegram to a light actuator). We want to add a feature that lets the user create an automation directly from such a telegram, like so:

create_automation_from_group_monitor.mov

Type of change

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

Example configuration

Additional information

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

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

@Copilot Copilot AI review requested due to automatic review settings August 19, 2025 23:03
Copilot

This comment was marked as outdated.

@philippwaller philippwaller marked this pull request as draft August 19, 2025 23:05
@philippwaller philippwaller requested a review from Copilot August 19, 2025 23:10
Copilot

This comment was marked as outdated.

@philippwaller philippwaller marked this pull request as ready for review August 19, 2025 23:45
@MindFreeze
Copy link
Member

I wonder if should just expose this on the hass object so it is available everywhere

@philippwaller
Copy link
Contributor Author

I wonder if should just expose this on the hass object so it is available everywhere

Thanks a lot for the feedback!
I actually followed the approach used for navigate, which is also exposed to custom panels for the same reason. Since this change is only relevant for external panels, I felt it was more consistent to keep it at the panel level.

@MindFreeze
Copy link
Member

The frontend team discussed this and we agreed that this should be exposed but as an event similar to more-info. This way it can be used by custom cards as well.

Side note: the navigate method seems to not be needed anymore as it always uses the main window now

@philippwaller
Copy link
Contributor Author

Great! I’ve just updated the PR to expose it as an event.

@philippwaller philippwaller changed the title expose showAutomationEditor functionality in ha-panel-custom Add show-automation-editor event for custom cards & panels Aug 20, 2025
@MindFreeze MindFreeze requested a review from Copilot August 21, 2025 05:12
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 adds support for custom cards and panels to open the Home Assistant Automation Editor with prefilled data by introducing a new show-automation-editor event. Previously, only the core UI could programmatically open the automation editor with initial data, limiting the functionality available to custom integrations and panels.

Key changes:

  • Creates a new mixin that handles show-automation-editor events and delegates to the existing showAutomationEditor function
  • Adds the mixin to the base HassElement class to make the functionality available throughout the application
  • Defines proper TypeScript interfaces for the event parameters

Reviewed Changes

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

File Description
src/state/hass-element.ts Imports and applies the new AutomationEditorMixin to the base HassElement class
src/state/automation-editor-mixin.ts New mixin that listens for show-automation-editor events and handles them
src/data/automation.ts Adds TypeScript interface definitions for the new event and its parameters

Copy link
Member

@MindFreeze MindFreeze left a comment

Choose a reason for hiding this comment

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

Thank you!

@MindFreeze MindFreeze merged commit feed58c into home-assistant:dev Aug 21, 2025
15 checks passed
@philippwaller philippwaller deleted the feat/expose_show_automation_editor branch August 21, 2025 09:43
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.

2 participants