mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add repair abort flow to demo integration (#82614)
This commit is contained in:
parent
a856abf47f
commit
d0390860fb
@ -230,6 +230,15 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
translation_key="bad_psu",
|
||||
)
|
||||
|
||||
async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"cold_tea",
|
||||
is_fixable=True,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="cold_tea",
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
@ -29,6 +29,16 @@ class DemoFixFlow(RepairsFlow):
|
||||
return self.async_show_form(step_id="confirm", data_schema=vol.Schema({}))
|
||||
|
||||
|
||||
class DemoColdTeaFixFlow(RepairsFlow):
|
||||
"""Handler for cold tea."""
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, str] | None = None
|
||||
) -> data_entry_flow.FlowResult:
|
||||
"""Handle the first step of a fix flow."""
|
||||
return self.async_abort(reason="not_tea_time")
|
||||
|
||||
|
||||
async def async_create_fix_flow(
|
||||
hass: HomeAssistant,
|
||||
issue_id: str,
|
||||
@ -39,5 +49,9 @@ async def async_create_fix_flow(
|
||||
# The bad_psu issue doesn't have its own flow
|
||||
return ConfirmRepairFlow()
|
||||
|
||||
if issue_id == "cold_tea":
|
||||
# The cold_tea issue have it's own flow
|
||||
return DemoColdTeaFixFlow()
|
||||
|
||||
# Other issues have a custom flow
|
||||
return DemoFixFlow()
|
||||
|
@ -23,6 +23,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"cold_tea": {
|
||||
"title": "The tea is cold",
|
||||
"fix_flow": {
|
||||
"step": {},
|
||||
"abort": {
|
||||
"not_tea_time": "Can not re-heat the tea at this time"
|
||||
}
|
||||
}
|
||||
},
|
||||
"transmogrifier_deprecated": {
|
||||
"title": "The transmogrifier component is deprecated",
|
||||
"description": "The transmogrifier component is now deprecated due to the lack of local control available in the new API"
|
||||
|
@ -11,6 +11,15 @@
|
||||
},
|
||||
"title": "The power supply is not stable"
|
||||
},
|
||||
"cold_tea": {
|
||||
"fix_flow": {
|
||||
"abort": {
|
||||
"not_tea_time": "Can not re-heat the tea at this time"
|
||||
},
|
||||
"step": {}
|
||||
},
|
||||
"title": "The tea is cold"
|
||||
},
|
||||
"out_of_blinker_fluid": {
|
||||
"fix_flow": {
|
||||
"step": {
|
||||
@ -33,6 +42,9 @@
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {}
|
||||
},
|
||||
"options_1": {
|
||||
"data": {
|
||||
"bool": "Optional boolean",
|
||||
|
@ -192,6 +192,20 @@ async def test_issues_created(mock_history, hass, hass_client, hass_ws_client):
|
||||
"translation_key": "bad_psu",
|
||||
"translation_placeholders": None,
|
||||
},
|
||||
{
|
||||
"breaks_in_ha_version": None,
|
||||
"created": ANY,
|
||||
"dismissed_version": None,
|
||||
"domain": "demo",
|
||||
"is_fixable": True,
|
||||
"issue_domain": None,
|
||||
"issue_id": "cold_tea",
|
||||
"learn_more_url": None,
|
||||
"severity": "warning",
|
||||
"translation_key": "cold_tea",
|
||||
"translation_placeholders": None,
|
||||
"ignored": False,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
@ -280,5 +294,19 @@ async def test_issues_created(mock_history, hass, hass_client, hass_ws_client):
|
||||
"translation_key": "bad_psu",
|
||||
"translation_placeholders": None,
|
||||
},
|
||||
{
|
||||
"breaks_in_ha_version": None,
|
||||
"created": ANY,
|
||||
"dismissed_version": None,
|
||||
"domain": "demo",
|
||||
"is_fixable": True,
|
||||
"issue_domain": None,
|
||||
"issue_id": "cold_tea",
|
||||
"learn_more_url": None,
|
||||
"severity": "warning",
|
||||
"translation_key": "cold_tea",
|
||||
"translation_placeholders": None,
|
||||
"ignored": False,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user