221 files

This commit is contained in:
Home Assistant Version Control
2026-10-10 15:24:58 +00:00
parent ae12b88c7d
commit bfafb4c28a
221 changed files with 73725 additions and 3277 deletions
+26 -32
View File
@@ -12,8 +12,9 @@ from homeassistant.config_entries import (
ConfigFlow,
ConfigFlowResult,
)
from homeassistant.loader import async_get_integration
from .const import DOMAIN
from .const import DOMAIN, NEWSLETTER_URL, REPOSITORY_URL, SPONSOR_URL
class UptimeConfigFlow(ConfigFlow, domain=DOMAIN):
@@ -42,15 +43,32 @@ class UptimeConfigFlow(ConfigFlow, domain=DOMAIN):
if self._disabled_entry is not None:
return self.async_show_menu(
step_id="already_configured",
menu_options=["enable_existing"],
menu_options=["enable_existing", "keep_sleeping"],
)
return self.async_abort(reason="already_spooked")
integration = await async_get_integration(self.hass, DOMAIN)
if user_input is not None:
return await self.async_step_choice_restart()
return self.async_create_entry(
title="Your homie",
data={},
description="spooked",
description_placeholders={
"documentation_url": str(integration.documentation),
"newsletter_url": NEWSLETTER_URL,
"repository_url": REPOSITORY_URL,
"sponsor_url": SPONSOR_URL,
},
)
return self.async_show_form(step_id="user", data_schema=vol.Schema({}))
return self.async_show_form(
step_id="user",
data_schema=vol.Schema({}),
description_placeholders={
"issue_tracker_url": str(integration.issue_tracker),
},
)
async def async_step_already_configured(
self,
@@ -63,7 +81,7 @@ class UptimeConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_show_menu(
step_id="already_configured",
menu_options=["enable_existing"],
menu_options=["enable_existing", "keep_sleeping"],
)
async def async_step_enable_existing(
@@ -83,33 +101,9 @@ class UptimeConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="enable_failed")
async def async_step_choice_restart(
async def async_step_keep_sleeping(
self,
_: dict[str, Any] | None = None,
) -> ConfigFlowResult:
"""Handle the user's choice.
Allows the user to choose to restart now or later.
"""
return self.async_show_menu(
step_id="choice_restart",
menu_options=["restart_now", "restart_later"],
)
async def async_step_restart_later(
self,
_: dict[str, Any] | None = None,
) -> ConfigFlowResult:
"""Handle restart later case."""
return self.async_create_entry(title="Your homie", data={})
async def async_step_restart_now(
self,
_: dict[str, Any] | None = None,
) -> ConfigFlowResult:
"""Handle restart now case.
Sets a flag, so the integraton setup knows it can go ahead and restart.
"""
self.hass.data[DOMAIN] = "Boo!"
return await self.async_step_restart_later()
"""Leave the existing disabled Spook config entry alone."""
return self.async_abort(reason="kept_sleeping")