Skip to content

RFC 0013: Rules

2026-11-08 · Jey Burrows · Status: draft

Discussion Thread

Provide a UI-first alternative to scenarios, that offer the core most useful functionality without the full flexibility of scenarios where that's beyond UI ability.

Allow the output of scenarios (delivery selection, delivery options, action groups, media) to be set from fixed text, templates, or delegated to a script or AI task. There will be distinct subtype of rules, with UI tailored for each. Scripts can also be provided by script Blueprints.

Rules are created as config entries, like Transport and Recipient, and have the same naming scheme as them to work around HA UI limitations with large numbers of config entries.

Undelegated

Two types

  • advanced ones with free text YAML for delivery and media, and selectors for action groups
  • Consider supporting only presets (see RFC0014 - Presets) although with a UX penalty that two steps are required for a rule (and possibly more presets created than necessary, for one off rules), but with benefit of simpler form. This may be solved within ConfigFlow by allowing a new preset to be created inside the rule.
  • simpler ones that have some pre-canned action-like outcomes, such as override priority and delivery selection, suppressing the notification altogether, overriding message/spoken_message/title/targets. These should use the same UI elements as the supernotify.notify call.

Delegation

Configuration

  • All
  • Selection
  • AI Tasks
  • entity_id - LLM entity, empty for default
  • instruction - the prompt embedded in the rule, default provided by Supernotify
  • Scripts
  • Script entity
  • Additional variables
    • Variable name and text or template value
  • Reuse standard script config flow as used by automations

Inputs

  • AI tasks will be provided with
  • attachments - optionally any attached media
  • structured_data - the expected response schema
  • state - (evaluate only) condition variables that are provided to conditions.
  • instruction - generate_data and generate_image will be provided with condition variables as addition to the instruction, and also Supernofify specific skill guidance
  • Scripts will get the condition variables as input variables, and the configured additional variables

Outputs

  • Scripts provide a response_variable that matches the preset schema for delivery selection, delivery changes, media and action groups. They don't use the scenario's per-delivery enabled, where leaving the key out and leaving its value empty do opposite things - see Selecting versus Changing Deliveries.
  • These are each optional, and it can return any empty JSON or null value in which case no overrides take place
  • A delivery change on its own never selects a delivery, so a script or model that only meant to change a tune can't send anywhere new
  • Script output can be everything scenario can do, including switching off deliveries and wildcarding
    • The message/spoken_message/title and priority may also be overridden in for deliveries
  • Scripts may do other automation calls too, albeit not suggested or recommended by Supernotify
  • AI Tasks
  • ai_task.generate_data called, to provide same output as script, in the preset schema
  • ai_task.evaluate with various flavours
    • yes/no go ahead with notification
    • choice for priority
    • choice for delivery methods
    • choice for targets
    • ai_task.generate_image to generate a media attachment
    • ai_task.clear_image incorporated into housekeeping

Precedence

Rules may overlap or override other rules, or with original things like scenarios and deliveries.

A rank is required as an option for everything that has to be chosen from, with scenarios defaulting to higher privilege than rules. Ideally users could visually drap and drop the order, though that would await a Home Assistant change.

This will require a change to When Scenarios Disagree

AI Guard Rules

  • AI Task Failure
  • Basic behaviour is as if the rule didn't exist at all
  • Enhancements
    • Fallback rule or preset defined on the AI rule
  • Slow tasks
  • Timeout to cut off how long a task can take
  • Enhancements
    • Timeouts set by priority or time sensitivity

Phasing

1 - Basic AI Rule

Add a rule, with the RFC0007 streamlined selector, and action for ai_task.generate_data. Use this in practice to get feedback on AI use in general, before adding the other flavours of AI Task, or RFC0012

2 - Decision Model

Add a rule, with the RFC0007 streamlined selector, and action for ai_task.evaluate to select priority (treating 'no-go' as a priority). Use this in practice to get feedback on decision vs chat models.

3 - Presets

Rules with streamlined selectors and regular presets for control.

See RFC0014 - Presets

4 - Scripts

Rules with streamlined selectors and outcomes delegated to scripts.

Out of Phase Scope

These may not be required, or will be follow-on RFCs:

  • ai_task.generate_image
  • Other selectors