1 """Dataclass storing integration data in hass.data[DOMAIN]."""
3 from dataclasses
import dataclass, field
6 from aiohttp.hdrs
import METH_POST
10 async_register
as webhook_register,
11 async_unregister
as webhook_unregister,
16 from .const
import DOMAIN, WEBHOOK_URL
17 from .coordinator
import NotificationCoordinator
19 _LOGGER = logging.getLogger(__name__)
24 """Class storing integration data."""
26 notify_coordinator: NotificationCoordinator = field(
27 default_factory=NotificationCoordinator
32 """Return True if instance was initialized and is ready for use."""
36 """Return whether this instance can be deinitialized."""
37 return not self.notify_coordinator.has_coordinators()
40 """Initialize NASwebData instance."""
49 self.notify_coordinator.handle_webhook_request,
50 allowed_methods=[METH_POST],
56 """Deinitialize NASwebData instance."""
62 """Return webhook url for Push API."""
63 hass_url =
get_url(hass, allow_external=
False)
bool is_initialized(self)
bool can_be_deinitialized(self)
None deinitialize(self, HomeAssistant hass)
str get_webhook_url(self, HomeAssistant hass)
None initialize(self, HomeAssistant hass)
str get_url(HomeAssistant hass, *bool require_current_request=False, bool require_ssl=False, bool require_standard_port=False, bool require_cloud=False, bool allow_internal=True, bool allow_external=True, bool allow_cloud=True, bool|None allow_ip=None, bool|None prefer_external=None, bool prefer_cloud=False)