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:
Julian Pawlowski 2026-04-15 09:47:30 +00:00
parent 5b5d5e73b0
commit e6ec54d8c5

View file

@ -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
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.config_entry,
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(
self.hass,
DOMAIN,