Examples and use cases¶
All examples come from the examples/ folder. Every card below is loaded into a real Home Assistant and photographed automatically, every automation is loaded and checked, so code and picture always match.
Use cases¶
| Use case | How |
|---|---|
| Wall display or tablet in the hallway or kitchen | A Markdown card with the markdown attribute, see Dashboard. An interval of 30 or 60 minutes keeps it current; unchanged data does not call the AI. |
| TTS after the alarm | An automation calls ai_briefing.generate and passes briefing.plain_text to tts.speak, see Read aloud. |
| Push notification to a phone | An automation sends plain_text with the Companion app, see Push notification. |
Dashboard¶
Briefing with the time it was generated¶

# Briefing with the time it was generated
type: markdown
content: >-
{{ state_attr('sensor.ai_briefing_bedroom', 'markdown') }}
<font size="1" color="gray">{{ as_timestamp(state_attr('sensor.ai_briefing_bedroom', 'generated_at')) | timestamp_custom('%H:%M') }}</font>
Briefing plus a button to generate it again¶

# Briefing plus a button to generate it again
type: vertical-stack
cards:
- type: markdown
content: "{{ state_attr('sensor.ai_briefing_linda', 'markdown') }}"
- type: button
entity: button.ai_briefing_linda_generate
name: Generate again
show_state: false
tap_action:
action: toggle
Plain text without a card frame¶
A greeting at the top of a wall display:

# Plain variant without a card frame, e.g. as a greeting at the top of a dashboard
type: markdown
text_only: true
content: "{{ state_attr('sensor.ai_briefing_bedroom', 'markdown') }}"
With text_only: true the card hides its frame and background, placing the heading and body text directly on the dashboard.
Diagnostics: data block and prompt¶

# Diagnostics: read the data block and the prompt
# "Check data block" rebuilds both without calling the AI. Enable the button
# and the prompt sensor first, they are disabled by default.
type: vertical-stack
cards:
- type: entities
entities:
- button.ai_briefing_bedroom_check_data_block
- sensor.ai_briefing_bedroom_last_run
- type: markdown
title: Data block
content: >-
```text
{{ state_attr('sensor.ai_briefing_bedroom_prompt', 'data_block') }}
```
- type: markdown
title: Full prompt
content: >-
```text
{{ state_attr('sensor.ai_briefing_bedroom_prompt', 'prompt') }}
```
Automations¶
Read aloud¶
Generate the briefing every weekday morning and read it out loud:
# Generate the briefing every weekday morning and read it out loud
- alias: Read morning briefing aloud
triggers:
- trigger: time
at: "07:00:00"
conditions:
- condition: time
weekday: [mon, tue, wed, thu, fri]
actions:
- action: ai_briefing.generate
target:
entity_id: sensor.ai_briefing_bedroom
response_variable: briefing
- action: tts.speak
target:
entity_id: tts.home_assistant_cloud
data:
media_player_entity_id: media_player.bedroom_speaker
# plain_text has no Markdown or emojis, ready for text-to-speech
message: "{{ briefing.plain_text }}"
Or five minutes after the alarm of a phone with the Home Assistant Companion app (Android provides the next alarm sensor):
# Read Linda's briefing aloud five minutes after the alarm of her phone
# (next alarm sensor of the Home Assistant Companion app)
- alias: Read Linda's briefing after the alarm
triggers:
- trigger: time
at:
entity_id: sensor.lindas_phone_next_alarm
offset: "00:05:00"
actions:
- action: ai_briefing.generate
target:
entity_id: sensor.ai_briefing_linda
response_variable: briefing
- action: tts.speak
target:
entity_id: tts.home_assistant_cloud
data:
media_player_entity_id: media_player.bedroom_speaker
message: "{{ briefing.plain_text }}"
Both use briefing.plain_text so heading hashes, bold asterisks and emojis are not read out loud. Generating on demand always calls the AI; to save calls, read the existing text with state_attr('sensor.ai_briefing_bedroom', 'plain_text') instead.
Push notification¶
Send each new text to a phone:
# Send every new briefing for Linda as a push notification
- alias: Send Linda's briefing to her phone
triggers:
# "to: null" ignores changes of attributes only, e.g. a new last_error
- trigger: state
entity_id: sensor.ai_briefing_linda
to: null
conditions:
# No notification when the text is restored after a restart
- condition: template
value_template: >-
{{ trigger.from_state is not none
and trigger.from_state.state not in ['unknown', 'unavailable']
and trigger.to_state.state not in ['unknown', 'unavailable'] }}
actions:
- action: notify.mobile_app_lindas_phone
data:
title: AI Briefing
message: "{{ trigger.to_state.attributes.plain_text }}"