Skip to content

Core Classes

classDiagram

  Notification "1" *-- "*" Envelope
  Notification "1" *-- "1" ConditionVariables
  Envelope "1" ..> "1" DeliveryMethod
  Context "1" o-- "0..*" Scenario
  Context "1" o-- "0..*" Snooze
  Context "1" *-- "1" Snoozer

custom_components.supernotify.delivery_method.DeliveryMethod

Base class for delivery methods.

Sub classes integrste with Home Assistant notification services or alternative notification mechanisms.

METHOD DESCRIPTION
deliver

Delivery implementation

initialize

Async post-construction initialization

option

Get an option value from delivery config or method default options

recipient_target

Pick out delivery appropriate target from a single person’s (recipient) config

select_target

Confirm if target appropriate for this delivery method

simplify

Simplify text for delivery methods with speaking or plain text interfaces

validate_action

Override in subclass if delivery method has fixed action or doesn’t require one

validate_deliveries

Validate list of deliveries at startup for this method

deliver(envelope) abstractmethod async

Delivery implementation


envelope (Envelope): envelope to be delivered

initialize() async

Async post-construction initialization

option(option_name, delivery_config)

Get an option value from delivery config or method default options

recipient_target(recipient)

Pick out delivery appropriate target from a single person’s (recipient) config

select_target(target)

Confirm if target appropriate for this delivery method


target (str): Target, typically an entity ID, or an email address, phone number

simplify(text, strip_urls=False)

Simplify text for delivery methods with speaking or plain text interfaces

validate_action(action)

Override in subclass if delivery method has fixed action or doesn’t require one

validate_deliveries() async

Validate list of deliveries at startup for this method

custom_components.supernotify.notification.Notification

Bases: 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

default_media_from_actions

If no media defined, look for iOS / Android actions that have media defined

initialize

Async post-construction initialization

record_resolve

Debug support for recording detailed target resolution in archived notification

apply_enabled_scenarios()

Set media and action_groups from scenario if defined, first come first applied

base_filename()

ArchiveableObject implementation

contents(minimal=False)

ArchiveableObject implementation

default_media_from_actions()

If no media defined, look for iOS / Android actions that have media defined

initialize() async

Async post-construction initialization

record_resolve(delivery_name, category, resolved)

Debug support for recording detailed target resolution in archived notification

custom_components.supernotify.envelope.Envelope

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 service_data dict to pass to underlying notify service

grab_image

Grab an image from a camera, snapshot URL, MQTT Image etc

__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=,title=,delivery=<delivery_name>).</p> <p>Primarily intended for debugging and logging; note that attribute values are inserted directly and may not be quoted or escaped.</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.envelope.Envelope.core_action_data class="doc doc-heading"> <code class="highlight language-python"><span class=n>core_action_data</span><span class=p>()</span></code> <a href=#custom_components.supernotify.envelope.Envelope.core_action_data class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Build the core set of <code>service_data</code> dict to pass to underlying notify service</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.envelope.Envelope.grab_image class="doc doc-heading"> <code class="highlight language-python"><span class=n>grab_image</span><span class=p>()</span></code> <span class="doc doc-labels"> <small class="doc doc-label doc-label-async"><code>async</code></small> </span> <a href=#custom_components.supernotify.envelope.Envelope.grab_image class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Grab an image from a camera, snapshot URL, MQTT Image etc</p> </div> </div> </div> </div> </div> <div class="doc doc-object doc-class"> <h2 id=custom_components.supernotify.scenario.Scenario class="doc doc-heading"> <code>custom_components.supernotify.scenario.Scenario</code> <a href=#custom_components.supernotify.scenario.Scenario class=headerlink title="Permanent link">¶</a></h2> <div class="doc doc-contents first"> <table> <thead> <tr> <th><span class=doc-section-title>METHOD</span></th> <th><span>DESCRIPTION</span></th> </tr> </thead> <tbody> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="attributes(include_condition=True, include_trace=False) (custom_components.supernotify.scenario.Scenario.attributes)" href=#custom_components.supernotify.scenario.Scenario.attributes>attributes</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Return scenario attributes</p> </div> </td> </tr> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="contents(minimal=False) (custom_components.supernotify.scenario.Scenario.contents)" href=#custom_components.supernotify.scenario.Scenario.contents>contents</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Archive friendly view of scenario</p> </div> </td> </tr> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="evaluate(condition_variables=None) async (custom_components.supernotify.scenario.Scenario.evaluate)" href=#custom_components.supernotify.scenario.Scenario.evaluate>evaluate</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Evaluate scenario conditions</p> </div> </td> </tr> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="trace(condition_variables=None, config=None) async (custom_components.supernotify.scenario.Scenario.trace)" href=#custom_components.supernotify.scenario.Scenario.trace>trace</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Trace scenario delivery</p> </div> </td> </tr> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="validate(valid_deliveries=None, valid_action_groups=None) async (custom_components.supernotify.scenario.Scenario.validate)" href=#custom_components.supernotify.scenario.Scenario.validate>validate</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Validate Home Assistant conditiion definition at initiation</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.scenario.Scenario.attributes class="doc doc-heading"> <code class="highlight language-python"><span class=n>attributes</span><span class=p>(</span><span class=n>include_condition</span><span class=o>=</span><span class=kc>True</span><span class=p>,</span> <span class=n>include_trace</span><span class=o>=</span><span class=kc>False</span><span class=p>)</span></code> <a href=#custom_components.supernotify.scenario.Scenario.attributes class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Return scenario attributes</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.scenario.Scenario.contents class="doc doc-heading"> <code class="highlight language-python"><span class=n>contents</span><span class=p>(</span><span class=n>minimal</span><span class=o>=</span><span class=kc>False</span><span class=p>)</span></code> <a href=#custom_components.supernotify.scenario.Scenario.contents class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Archive friendly view of scenario</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.scenario.Scenario.evaluate class="doc doc-heading"> <code class="highlight language-python"><span class=n>evaluate</span><span class=p>(</span><span class=n>condition_variables</span><span class=o>=</span><span class=kc>None</span><span class=p>)</span></code> <span class="doc doc-labels"> <small class="doc doc-label doc-label-async"><code>async</code></small> </span> <a href=#custom_components.supernotify.scenario.Scenario.evaluate class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Evaluate scenario conditions</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.scenario.Scenario.trace class="doc doc-heading"> <code class="highlight language-python"><span class=n>trace</span><span class=p>(</span><span class=n>condition_variables</span><span class=o>=</span><span class=kc>None</span><span class=p>,</span> <span class=n>config</span><span class=o>=</span><span class=kc>None</span><span class=p>)</span></code> <span class="doc doc-labels"> <small class="doc doc-label doc-label-async"><code>async</code></small> </span> <a href=#custom_components.supernotify.scenario.Scenario.trace class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Trace scenario delivery</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.scenario.Scenario.validate class="doc doc-heading"> <code class="highlight language-python"><span class=n>validate</span><span class=p>(</span><span class=n>valid_deliveries</span><span class=o>=</span><span class=kc>None</span><span class=p>,</span> <span class=n>valid_action_groups</span><span class=o>=</span><span class=kc>None</span><span class=p>)</span></code> <span class="doc doc-labels"> <small class="doc doc-label doc-label-async"><code>async</code></small> </span> <a href=#custom_components.supernotify.scenario.Scenario.validate class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Validate Home Assistant conditiion definition at initiation</p> </div> </div> </div> </div> </div> <div class="doc doc-object doc-class"> <h2 id=custom_components.supernotify.snoozer.Snooze class="doc doc-heading"> <code>custom_components.supernotify.snoozer.Snooze</code> <a href=#custom_components.supernotify.snoozer.Snooze class=headerlink title="Permanent link">¶</a></h2> <div class="doc doc-contents first"> <table> <thead> <tr> <th><span class=doc-section-title>METHOD</span></th> <th><span>DESCRIPTION</span></th> </tr> </thead> <tbody> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="__eq__(other) (custom_components.supernotify.snoozer.Snooze.__eq__)" href=#custom_components.supernotify.snoozer.Snooze.__eq__>__eq__</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Check if two snoozes for the same thing</p> </div> </td> </tr> <tr class=doc-section-item> <td><code><a class="autorefs autorefs-internal" title="__repr__() (custom_components.supernotify.snoozer.Snooze.__repr__)" href=#custom_components.supernotify.snoozer.Snooze.__repr__>__repr__</a></code></td> <td class=doc-function-details> <div class=doc-md-description> <p>Return a string representation of the object.</p> </div> </td> </tr> </tbody> </table> <div class="doc doc-children"> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.snoozer.Snooze.__eq__ class="doc doc-heading"> <code class="highlight language-python"><span class=fm>__eq__</span><span class=p>(</span><span class=n>other</span><span class=p>)</span></code> <a href=#custom_components.supernotify.snoozer.Snooze.__eq__ class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Check if two snoozes for the same thing</p> </div> </div> <div class="doc doc-object doc-function"> <h3 id=custom_components.supernotify.snoozer.Snooze.__repr__ class="doc doc-heading"> <code class="highlight language-python"><span class=fm>__repr__</span><span class=p>()</span></code> <a href=#custom_components.supernotify.snoozer.Snooze.__repr__ class=headerlink title="Permanent link">¶</a></h3> <div class="doc doc-contents "> <p>Return a string representation of the object.</p> </div> </div> </div> </div> </div> <div class="doc doc-object doc-class"> <h2 id=custom_components.supernotify.ConditionVariables class="doc doc-heading"> <code>custom_components.supernotify.ConditionVariables</code> <span class="doc doc-labels"> <small class="doc doc-label doc-label-dataclass"><code>dataclass</code></small> </span> <a href=#custom_components.supernotify.ConditionVariables class=headerlink title="Permanent link">¶</a></h2> <div class="doc doc-contents first"> <p>Variables presented to all condition evaluations</p> <h4 id=custom_components.supernotify.ConditionVariables--attributes>Attributes<a class=headerlink href=#custom_components.supernotify.ConditionVariables--attributes title="Permanent link">¶</a></h4> <div class="language-text highlight"><pre><span></span><code>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 </code></pre></div> <div class="doc doc-children"> </div> </div> </div> </article> </div> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../..", "features": ["content.code.copy", "content.code.select", "content.code.annotate"], "search": "../../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script> <script src=../../assets/javascripts/bundle.f55a23d4.min.js></script> <script src=../../assets/mkdocs_pagetree_plugin.js></script> </body> </html>