Skip to content

Core Classes

Info

See the Class Diagram for how these relate to each other.

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_dry_run

Which deliveries a notification would use right now, and who it would reach, without sending it

async_send_message

Send a message via chosen transport, returning the notification, if one could be made

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, delivery_control=None)

Initialize the service.

async_dry_run(message='', title=None, target=None, data=None) async

Which deliveries a notification would use right now, and who it would reach, without sending it

async_send_message(message='', title=None, target=None, context=None, **kwargs) async

Send a message via chosen transport, returning the notification, if one could be made

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.archive.NotificationArchive

custom_components.supernotify.context.Context

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.

async_real_user_ids

Active, non-system HA user ids mapped to their login username - for discovering

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 domain (e.g. "notify") registered by a specific integration.

find_config_entry_data

Return the data of the first enabled, non-ignored config entry for domain, if any.

group_members

Fully expanded members of a group.* helper or a platform group (media_player, light... groups

hass_avail

Guard for HA functionality, largely for tests or docgen

http_session

Client aiohttp session for async web requests

is_own_device

True if device_id is this integration's own 'SuperNotify' device (see ha_device_info)

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.

resolve_target_selectors

Resolve HA area/floor/label selectors to the entities they reference, through the same

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.

async_real_user_ids() async

Active, non-system HA user ids mapped to their login username - for discovering recipients that have no Person record (see CONF_USER_ID in const.py), excluding internal accounts like Supervisor/Home Assistant Content that aren't real people.

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.

group_members(entity_id, _seen=None)

Fully expanded members of a group.* helper or a platform group (media_player, light... groups created by the group integration expose members in an entity_id state attribute). None if not a group.

Other entities, e.g. scene.* or min/max sensor.*, also expose an entity_id attribute, so anything outside the group domain is only treated as a group if the entity registry says its platform is group.

hass_avail(property)

Guard for HA functionality, largely for tests or docgen

http_session()

Client aiohttp session for async web requests

is_own_device(device_id)

True if device_id is this integration's own 'SuperNotify' device (see ha_device_info)

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.

resolve_target_selectors(area_ids=None, floor_ids=None, label_ids=None)

Resolve HA area/floor/label selectors to the entities they reference, through the same core helper as HA entity actions, so groups are expanded and entities inherit the area of their device.

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.