-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Allow inverting switch_as_x cover, lock, valve #19324
Conversation
// Change invert setting | ||
const origEntityId = this.entry.options?.switch_as_x?.entity_id; | ||
// remove current helper | ||
await deleteConfigEntry(this.hass, this.helperConfigEntry.entry_id); |
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.
The core PR needs an update to allow setting this via an option flow.
Although entity registry has undelete which preserves UUID and entity_id, user configuration such as icon override is not kept.
if (!origEntityId) { | ||
// should not happen, guard for types | ||
} else { | ||
const configFlow = await createConfigFlow(this.hass, "switch_as_x"); | ||
const configFlowResult = (await handleConfigFlowStep( | ||
const configFlow = await createOptionsFlow( |
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.
Can we do the same for changing the switch as type? (Can be a different PR)
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.
I would prefer not, because when changing the switch as type we want to delete the entity registry item etc.
invert: this._switchAsInvert, | ||
target_domain: this._switchAsDomain, | ||
} | ||
)) as DataEntryFlowStepCreateEntry; | ||
if (configFlowResult.result?.entry_id) { |
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.
We don't have to do this in this case? As the entity id stays the same there is no need to open a different more info dialog?
src/translations/en.json
Outdated
"invert_switch_as_cover_description": "Show as open when the switch is off", | ||
"invert_switch_as_lock_description": "Show as locked when the switch is off", | ||
"invert_switch_as_valve_description": "[%key:ui::dialogs::entity_registry::editor::invert_switch_as_cover_description%]", |
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.
"invert_switch_as_cover_description": "Show as open when the switch is off", | |
"invert_switch_as_lock_description": "Show as locked when the switch is off", | |
"invert_switch_as_valve_description": "[%key:ui::dialogs::entity_registry::editor::invert_switch_as_cover_description%]", | |
"invert" : { | |
"label": "Invert state", | |
"descriptions": { | |
"cover": "Show as open when the switch is off", | |
"lock": "Show as locked when the switch is off", | |
"valve": "Show as open when the switch is off", | |
} | |
} |
Proposed change
Allow inverting switch_as_x cover, lock, valve
Core PR: home-assistant/core#107535
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: