tags: - developer - classes description: Core class descriptions for the core classes of Supernotify for Home Assistant
Core Classes¶
Info
See the Class Diagram for how these relate to each other.
custom_components.supernotify.transport.Transport ¶
Base class for delivery transports.
Sub classes integrste with Home Assistant notification services or alternative notification mechanisms.
| METHOD | DESCRIPTION |
|---|---|
deliver | Delivery implementation |
initialize | Async post-construction initialization |
simplify | Simplify text for delivery transports with speaking or plain text interfaces |
validate_action | Override in subclass if transport has fixed action or doesn't require one |
deliver(envelope, debug_trace=None) abstractmethod async ¶
Delivery implementation
envelope (Envelope): envelope to be delivered
debug_trace (DebugTrace): debug info collector
initialize() async ¶
Async post-construction initialization
simplify(text, strip_urls=False) ¶
Simplify text for delivery transports with speaking or plain text interfaces
validate_action(action) ¶
Override in subclass if transport has fixed action or doesn't require one
custom_components.supernotify.notification.Notification ¶
Bases: ArchivableObject
flowchart TD
custom_components.supernotify.notification.Notification[Notification]
custom_components.supernotify.archive.ArchivableObject[ArchivableObject]
custom_components.supernotify.archive.ArchivableObject --> custom_components.supernotify.notification.Notification
click custom_components.supernotify.notification.Notification href "" "custom_components.supernotify.notification.Notification"
click custom_components.supernotify.archive.ArchivableObject href "" "custom_components.supernotify.archive.ArchivableObject"
| METHOD | DESCRIPTION |
|---|---|
apply_enabled_scenarios | Set media and action_groups from scenario if defined, first come first applied |
base_filename | ArchiveableObject implementation |
contents | ArchiveableObject implementation |
initialize | Async post-construction initialization |
media_requirements | If no media defined, look for iOS / Android actions that have media defined |
record_result | Debugging (and unit test) support for notifications that failed or were skipped |
apply_enabled_scenarios() ¶
Set media and action_groups from scenario if defined, first come first applied
base_filename() ¶
ArchiveableObject implementation
contents(minimal=False, **_kwargs) ¶
ArchiveableObject implementation
initialize() async ¶
Async post-construction initialization
media_requirements(data) ¶
If no media defined, look for iOS / Android actions that have media defined
Example is the Frigate blueprint, which generates image, video etc in the data section, that can also be used for email attachments
record_result(delivery, envelope=None, targets=None, suppression_reason=None) ¶
Debugging (and unit test) support for notifications that failed or were skipped
custom_components.supernotify.envelope.Envelope ¶
Bases: DupeCheckable
flowchart TD
custom_components.supernotify.envelope.Envelope[Envelope]
custom_components.supernotify.common.DupeCheckable[DupeCheckable]
custom_components.supernotify.common.DupeCheckable --> custom_components.supernotify.envelope.Envelope
click custom_components.supernotify.envelope.Envelope href "" "custom_components.supernotify.envelope.Envelope"
click custom_components.supernotify.common.DupeCheckable href "" "custom_components.supernotify.common.DupeCheckable"
Wrap a notification with a specific set of targets and service data possibly customized for those targets
| METHOD | DESCRIPTION |
|---|---|
__eq__ | Specialized equality check for subset of attributes |
__repr__ | Return a concise string representation of the Envelope. |
core_action_data | Build the core set of |
grab_image | Grab an image from a camera, snapshot URL, MQTT Image etc |
hash | Alpha hash to reduce noise from messages with timestamps or incrementing counts |
__eq__(other) ¶
Specialized equality check for subset of attributes
__repr__() ¶
Return a concise string representation of the Envelope.
The returned string includes the envelope's message, title, and delivery name in the form: Envelope(message=
Primarily intended for debugging and logging; note that attribute values are inserted directly and may not be quoted or escaped.
core_action_data(force_message=True) ¶
Build the core set of service_data dict to pass to underlying notify service
grab_image() async ¶
Grab an image from a camera, snapshot URL, MQTT Image etc
hash() ¶
Alpha hash to reduce noise from messages with timestamps or incrementing counts
custom_components.supernotify.scenario.Scenario ¶
| METHOD | DESCRIPTION |
|---|---|
attributes | Return scenario attributes |
contents | Archive friendly view of scenario |
evaluate | Evaluate scenario conditions |
trace | Trace scenario condition execution |
validate | Validate Home Assistant conditiion definition at initiation |
attributes(include_condition=True, include_trace=False) ¶
Return scenario attributes
contents(minimal=False, **_kwargs) ¶
Archive friendly view of scenario
evaluate(condition_variables) ¶
Evaluate scenario conditions
trace(condition_variables) async ¶
Trace scenario condition execution
validate(valid_action_group_names=None) async ¶
Validate Home Assistant conditiion definition at initiation
custom_components.supernotify.model.Target ¶
custom_components.supernotify.model.DeliveryConfig ¶
custom_components.supernotify.model.TransportConfig ¶
custom_components.supernotify.snoozer.Snooze ¶
custom_components.supernotify.model.ConditionVariables dataclass ¶
Variables presented to all condition evaluations
Attributes¶
applied_scenarios (list[str]): Scenarios that have been applied
required_scenarios (list[str]): Scenarios that must be applied
constrain_scenarios (list[str]): Only scenarios in this list, or in explicit apply_scenarios, can be applied
notification_priority (str): Priority of the notification
notification_message (str): Message of the notification
notification_title (str): Title of the notification
occupancy (list[str]): List of occupancy scenarios
custom_components.supernotify.people.PeopleRegistry ¶
| METHOD | DESCRIPTION |
|---|---|
mobile_devices_for_person | Auto detect mobile_app targets for a person. |
mobile_devices_for_person(person_entity_id) ¶
Auto detect mobile_app targets for a person.
Targets not currently validated as async registration may not be complete at this stage
person_entity_id (str): _description_
list: mobile target actions for this person