tags: - developer - classes description: Class descriptions for classes in Supernotify for Home Assistant
Core Classes¶
Info
See the Class Diagram for how these relate to each other.
custom_components.supernotify.archive.NotificationArchive ¶
custom_components.supernotify.context.Context ¶
custom_components.supernotify.engine.SupernotifyEngine ¶
Owns the Context/registries/transports and actually delivers notifications.
This is the shared engine behind every entrypoint - notify.supernotify (via the SuperNotificationService legacy shim), supernotify.notify, and the NotifyEntity platform (RecipientNotifyEntity) - so it deliberately has no dependency on BaseNotificationService or anything else specific to the legacy notify platform. If/when HA core drops BaseNotificationService, only SuperNotificationService and its wiring in init.py need to go; this class and everything else built on it are unaffected.
| METHOD | DESCRIPTION |
|---|---|
__init__ | Initialize the service. |
async_send_message | Send a message via chosen transport. |
on_mobile_action | Listen for mobile actions relevant to snooze and silence notifications |
refresh_entities | Re-publish the current state of every entity SuperNotify provides. |
reset_overrides | Put everything switched on or off at runtime back to its configured enabled state, |
__init__(hass, deliveries=None, template_path=None, media_path=None, media_url_prefix=None, archive=None, housekeeping=None, recipients_discovery=True, mobile_discovery=True, recipients=None, mobile_actions=None, scenarios=None, links=None, transport_configs=None, cameras=None, dupe_check=None, snooze=None, scenario_control=None) ¶
Initialize the service.
async_send_message(message='', title=None, target=None, context=None, **kwargs) async ¶
Send a message via chosen transport.
on_mobile_action(event) ¶
Listen for mobile actions relevant to snooze and silence notifications
Example Action: event_type: mobile_app_notification_action data: foo: a origin: REMOTE time_fired: "2024-04-20T13:14:09.360708+00:00" context: id: 01HVXT93JGWEDW0KE57Z0X6Z1K parent_id: null user_id: a9dbae1a5abf33dbbad52ff82201bb17
refresh_entities() ¶
Re-publish the current state of every entity SuperNotify provides.
Entities are only refreshed once added to Home Assistant, so this is a safe no-op for any whose platform hasn't loaded (e.g. in tests that build SupernotifyEngine directly without a config entry). Must run in the event loop, as it writes entity state.
reset_overrides(kinds=OVERRIDE_KINDS) ¶
Put everything switched on or off at runtime back to its configured enabled state, returning the names reset for each kind.
Walks the scenarios, recipients, deliveries and transports themselves rather than their switches, so one whose switch is disabled in the entity registry is reset too.
custom_components.supernotify.hass_api.HomeAssistantAPI ¶
| METHOD | DESCRIPTION |
|---|---|
async_get_camera_image | Fetch a still image directly from a camera entity, via HA's own camera component API, |
async_get_image_entity_image | Fetch a still image directly from an image entity, via HA's own image component API. |
build_mobile_app_cache | All enabled mobile apps |
create_job | Wrap a blocking function call in a HomeAssistant awaitable job |
entity_ids_for_platform | entity_ids in |
find_config_entry_data | Return the data of the first enabled, non-ignored config entry for domain, if any. |
hass_avail | Guard for HA functionality, largely for tests or docgen |
http_session | Client aiohttp session for async web requests |
load_storage | Load integration state previously persisted to Home Assistant's .storage/ area, |
platform_for_entity | The integration that registered this entity (RegistryEntry.platform), if any. |
save_storage | Persist integration state to Home Assistant's .storage/ area, via HA's own Store |
async_get_camera_image(entity_id, timeout=10) async ¶
Fetch a still image directly from a camera entity, via HA's own camera component API, rather than triggering the camera.snapshot service and polling the filesystem for the resulting file to appear.
async_get_image_entity_image(entity_id, timeout=10) async ¶
Fetch a still image directly from an image entity, via HA's own image component API.
build_mobile_app_cache() ¶
All enabled mobile apps
create_job(func, *args) ¶
Wrap a blocking function call in a HomeAssistant awaitable job
entity_ids_for_platform(domain, platform, device_model_select=None) ¶
entity_ids in domain (e.g. "notify") registered by a specific integration.
Reads the entity registry directly (not the state machine), so a freshly registered entity counts even before it has reported a first state.
device_model_select optionally filters by the backing device's model (e.g. {"exclude": ["Speaker Group"]}), same include/exclude rule shape used elsewhere.
find_config_entry_data(domain) ¶
Return the data of the first enabled, non-ignored config entry for domain, if any.
hass_avail(property) ¶
Guard for HA functionality, largely for tests or docgen
http_session() ¶
Client aiohttp session for async web requests
load_storage(key, version=1) async ¶
Load integration state previously persisted to Home Assistant's .storage/ area, via HA's own Store helper, or None if nothing has been persisted yet for this key.
platform_for_entity(entity_id) ¶
The integration that registered this entity (RegistryEntry.platform), if any.
save_storage(key, data, version=1) ¶
Persist integration state to Home Assistant's .storage/ area, via HA's own Store helper. Fire-and-forget: the write happens in a tracked background task rather than blocking the caller, since this is called from both sync and async contexts.