mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-07-27 17:26:48 +00:00
fix(repairs): force statistics-review issue visible on mode change
async_create_issue preserves dismissed_version when called with the same issue_id. This means that if a user had previously dismissed the repair issue, changing the currency mode again would set the flag but the issue would stay hidden (because it still has a dismissed_version). Fix: use delete + create in the options flow when mode_changed=True. This resets dismissed_version so the new instance is always visible. The __init__.py path (HA restart with flag set) continues to use plain async_create_issue so that a restart alone does not un-dismiss an issue the user already acknowledged. Released-Bug: no
This commit is contained in:
parent
5b5d5e73b0
commit
e6ec54d8c5
1 changed files with 4 additions and 1 deletions
|
|
@ -517,11 +517,14 @@ class TibberPricesOptionsFlowHandler(OptionsFlow):
|
||||||
mode_changed = old_mode is not None and new_mode is not None and old_mode != new_mode
|
mode_changed = old_mode is not None and new_mode is not None and old_mode != new_mode
|
||||||
|
|
||||||
if mode_changed:
|
if mode_changed:
|
||||||
# Set persistent flag so repair issue reappears after dismiss + HA restart
|
# Set persistent flag so repair issue reappears after HA restart
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
self.config_entry,
|
self.config_entry,
|
||||||
data={**self.config_entry.data, DATA_STATISTICS_REVIEW_REQUIRED: True},
|
data={**self.config_entry.data, DATA_STATISTICS_REVIEW_REQUIRED: True},
|
||||||
)
|
)
|
||||||
|
# delete + create resets dismissed_version, forcing the issue into view
|
||||||
|
# even if the user had dismissed a previous instance of this issue.
|
||||||
|
ir.async_delete_issue(self.hass, DOMAIN, issue_id)
|
||||||
ir.async_create_issue(
|
ir.async_create_issue(
|
||||||
self.hass,
|
self.hass,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue