Do you ever wanted to get a one time reminder when a specific state is matched?
Using the following scripts you can use Assist in combination with an LLM to create such a one time conditioned event by saying e.q.
- Remind me of getting some milk when PersonX is home
- Help me to remember to change the batteries, when motion is detected in the living room
- Notify me that our guests have arrived when the guest mode is activated
To accomplish this i’m using the following script for the automation:
sequence:
- wait_template: |
{{ is_state(boolean_entity, 'on') == boolean_status_on }}
continue_on_timeout: false
enabled: true
timeout: "48:00:00"
- action: notify.telegram_my_chat
metadata: {}
data:
message: "{{ message }}"
fields:
boolean_entity:
selector:
entity:
domain:
- input_boolean
- binary_sensor
description: An entity of type input_boolean or binary_sensor
required: true
name: Boolean Entity
boolean_status_on:
selector:
boolean: {}
required: true
default: true
name: Boolean Status On
description: >-
Specifies whether the value of boolean should be on (true) or off (false)
to execute the subsequent action.
message:
selector:
text: null
name: message
description: The message to be transmitted once the condition is met
required: true
alias: When-Then-Automation
description: >-
Backend helper script for Assist notification requests that should only be triggered when a specific Boolean value is met.
icon: mdi:arrow-decision-auto
mode: parallel
max: 10
The script takes the entityid, the condition to met and the message.
It then waits for the condition beeing met (currently set to at most 48h and max 10 running scripts in parallel)
It sends the given message after the condition is met.
If you let the LLM use this script you will face two problems:
- The LLM will not (always) be able to identify the correct entityid to pass
- It will get stuck, waiting for the condition beeing met before responding.
To workaround this limitation i build a second script specifically for the LLM (it can only access the second one):
sequence:
- variables:
entityid: >-
{% set input = bool_entity %}
{% set match = states | selectattr('name','equalto', input) | list |
first %}
{{ match.entity_id if match else None }}
- action: script.turn_on
metadata: {}
target:
entity_id: script.when_then_automation
data:
variables:
boolean_status_on: "{{ boolean_status_on | bool }}"
boolean_entity: "{{ entityid }}"
message: "{{ message }}"
fields:
bool_entity:
selector:
text: {}
description: >-
The name of the Boolean entity of type input_boolean or binary_sensor that
triggers the action.
required: true
name: Bool Entity
boolean_status_on:
selector:
boolean: {}
required: true
default: true
name: Boolean Status On
description: >-
Specifies whether the value of boolean should be on (true) or off (false)
to execute the subsequent action.
message:
selector:
text: null
name: message
description: The message to be transmitted once the condition is met
required: true
alias: When-Then-Automation-Assist
description: >-
Help script for Assist Notification requests that should only be triggered when a specific Boolean value is met. For example, notify me as soon as the front door is open or remind me to go shopping as soon as I enter the living room today.
icon: mdi:arrow-decision-auto
mode: queued
max: 10
The script takes the entity name, the condition to met and the message.
It then searches all entitys for a match to get the entityid.
It then calls the 1. script without waiting for the response.
Currently known simplifications and limitations:
- Different receipients: It is possible of course to set another input value to differentiate different chats e.q. (I just simplified the code for better readability)
- Matching not only on/off values: Currently the script is limited to on/off states. I’m currently working on another approach making use of a todo list to save more complex if-then conditions. If your interested in the solution if its done let me know

If you have further questions let me know