-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix device actions in step-flow-form #24539
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
base: dev
Are you sure you want to change the base?
Fix device actions in step-flow-form #24539
Conversation
@@ -103,6 +104,7 @@ export abstract class HaDeviceAutomationPicker< | |||
.label=${this.label} | |||
.value=${value} | |||
@selected=${this._automationChanged} | |||
@closed=${stopPropagation} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An unrelated bug that causes the config flow form to close every time you select a device action in the action selector.
… fix-device-actions-in-config-flow
src/panels/config/automation/action/types/ha-automation-action-device_id.ts
Outdated
Show resolved
Hide resolved
I think we should add lazy loaded context provides, so that the context provider can be on the I'll look in to that |
Proposed change
The action selector has some issues when used in a dialog (like a config flow), as device actions implictly rely on consuming the
fullEntitiesContext
provided by ha-panel-config.When in a step flow dialog, the dialog is not under the DOM of that ha-panel-config, so the expected entity registry is undefined, leading to significant problems with device actions/conditions/triggers. The frontend just throws exceptions and gets bugged out if you try to use them.
To workaround this, in the action selector I check if the expected entityRegistry is not provided, and create a new producer for it in the action selector if missing, so that the child elements that expect it to exist can function.
Sadly, after making these fixes, using device actions in config flows still does not actually work 😅 . The frontend parts seem to work, but anytime you save and actually trigger the device actions via this method (like with a Template Button), core throws backend errors and says it can't understand the entity_id. But I think that's likely a core bug; so we can fix this first, and then move the investigation there. (Assuming we want device actions to work here).
This could also be an issue if any config flows use Trigger selectors or Condition selectors, though I'm not aware of any that do, so far I've only seen Action selectors used on templates, so I am limiting the fix to that.
Type of change
Example configuration
Additional information
https://community.home-assistant.io/t/error-in-describing-condition-e-is-not-iterable/832113/9
template switch helper "e is not iterable" on "actions to turn on" or "..off" core#139631
Checklist
If user exposed functionality or configuration variables are added/changed: