RFC 0013: Rules¶
2026-11-08 · Jey Burrows · Status: draft
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.notifycall.
Delegation¶
Configuration¶
- All
- Selection
- As defined in RFC0007
- AI Tasks
entity_id- LLM entity, empty for defaultinstruction- 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 mediastructured_data- the expected response schemastate- (evaluateonly) condition variables that are provided to conditions.instruction-generate_dataandgenerate_imagewill 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_variablethat matches the preset schema for delivery selection, delivery changes, media and action groups. They don't use the scenario's per-deliveryenabled, 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_datacalled, to provide same output as script, in the preset schemaai_task.evaluatewith various flavoursyes/nogo ahead with notificationchoicefor prioritychoicefor delivery methodschoicefor targetsai_task.generate_imageto generate amediaattachmentai_task.clear_imageincorporated 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.
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