201 lines
5.8 KiB
YAML
201 lines
5.8 KiB
YAML
- alias: Email triage - classify new
|
|
description: ''
|
|
triggers:
|
|
- event_type: imap_content
|
|
event_data:
|
|
initial: true
|
|
trigger: event
|
|
actions:
|
|
- action: imap.fetch
|
|
data:
|
|
entry: '{{ entry }}'
|
|
uid: '{{ uid }}'
|
|
response_variable: mail
|
|
- variables:
|
|
email_payload: "{{ {\n \"sender\": trigger.event.data.sender | default(\"\"\
|
|
),\n \"subject\": mail.subject | default(\"\"),\n \"date\": (trigger.event.data.date|string)\
|
|
\ | default(\"\"),\n \"body\": mail.text | default(\"\")\n} | to_json }}"
|
|
- action: rest_command.llm_email_triage
|
|
response_variable: triage
|
|
data:
|
|
email_payload: '{{ email_payload }}'
|
|
- variables:
|
|
triage_obj: '{{ triage[''content''][''message''][''content''] | from_json }}'
|
|
- variables:
|
|
cat: '{{ (triage_obj.category | lower) | default(''unknown'') }}'
|
|
counters:
|
|
personal: counter.emails_personal
|
|
transaction: counter.emails_transaction
|
|
calendar: counter.emails_calendar
|
|
newsletter: counter.emails_newsletter
|
|
promo: counter.emails_promo
|
|
alert: counter.emails_alert
|
|
receipt: counter.emails_receipt
|
|
support: counter.emails_support
|
|
unknown: counter.emails_unknown
|
|
- data:
|
|
entity_id: '{{ counters.get(cat, ''counter.email_unknown'') }}'
|
|
action: counter.increment
|
|
- action: notify.mobile_app_cph2671
|
|
data:
|
|
title: '[{{ triage_obj.priority }}] {{ mail.subject }}'
|
|
message: '{{ triage_obj.summary }}'
|
|
data:
|
|
actions:
|
|
- action: ARCHIVE
|
|
title: Archive
|
|
- action: SNOOZE_1H
|
|
title: Snooze 1h
|
|
action_data:
|
|
entry_id: '{{ entry }}'
|
|
uid: '{{ uid }}'
|
|
mode: parallel
|
|
variables:
|
|
uid: '{{ trigger.event.data.uid }}'
|
|
entry: '{{ trigger.event.data.entry_id }}'
|
|
- alias: Fader to Light brightness
|
|
description: ''
|
|
triggers:
|
|
- entity_id: media_player.pc_goxlr_sample
|
|
attribute: volume_level
|
|
trigger: state
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{ trigger.to_state.attributes.volume_level | float\n \
|
|
\ != trigger.from_state.attributes.volume_level | float }}"
|
|
actions:
|
|
- target:
|
|
entity_id: light.office_light
|
|
data:
|
|
brightness_pct: '{% set vol = state_attr(''media_player.pc_goxlr_sample'', ''volume_level'')
|
|
| float(0) %} {{ (vol * 100) | round(0) }}
|
|
|
|
'
|
|
action: light.turn_on
|
|
mode: restart
|
|
- alias: Weather Primary Condition Light
|
|
description: ''
|
|
triggers:
|
|
- trigger: time
|
|
at:
|
|
entity_id: sensor.cph2671_next_alarm
|
|
offset: -00:00:10
|
|
conditions:
|
|
- condition: zone
|
|
entity_id: person.adamconway
|
|
zone: zone.home
|
|
actions:
|
|
- action: weather.get_forecasts
|
|
metadata: {}
|
|
data:
|
|
type: daily
|
|
target:
|
|
entity_id: weather.pirateweather
|
|
response_variable: wx
|
|
- variables:
|
|
condition: '{{ (wx[''weather.pirateweather''][''forecast''][0].condition if
|
|
wx and wx.get(''weather.pirateweather'') else ''unknown'') | lower }}'
|
|
rgb_map:
|
|
sunny:
|
|
- 255
|
|
- 213
|
|
- 0
|
|
clear:
|
|
- 255
|
|
- 213
|
|
- 0
|
|
partlycloudy:
|
|
- 255
|
|
- 236
|
|
- 140
|
|
cloudy:
|
|
- 255
|
|
- 255
|
|
- 255
|
|
overcast:
|
|
- 235
|
|
- 235
|
|
- 235
|
|
rainy:
|
|
- 64
|
|
- 156
|
|
- 255
|
|
pouring:
|
|
- 32
|
|
- 128
|
|
- 255
|
|
snowy:
|
|
- 200
|
|
- 240
|
|
- 255
|
|
fog:
|
|
- 240
|
|
- 240
|
|
- 240
|
|
windy:
|
|
- 255
|
|
- 245
|
|
- 200
|
|
- action: input_text.set_value
|
|
metadata: {}
|
|
data:
|
|
value: '{{ condition }}'
|
|
target:
|
|
entity_id: input_text.weather_primary_condition
|
|
- variables:
|
|
rgb: "{{ rgb_map.get(states('input_text.weather_primary_condition'),\n \
|
|
\ [255,255,255]) }}\n"
|
|
- action: light.turn_on
|
|
metadata: {}
|
|
data:
|
|
brightness_pct: 80
|
|
rgb_color: '{{ rgb }}'
|
|
target:
|
|
device_id: 7443cc0d215861e4624f05e2ea6c3fb5
|
|
mode: single
|
|
- alias: LLM weather forecast notification
|
|
description: ''
|
|
triggers:
|
|
- trigger: time
|
|
at:
|
|
entity_id: sensor.cph2671_next_alarm
|
|
offset: -00:00:10
|
|
conditions:
|
|
- condition: zone
|
|
entity_id: person.adamconway
|
|
zone: zone.home
|
|
actions:
|
|
- action: weather.get_forecasts
|
|
metadata: {}
|
|
data:
|
|
type: daily
|
|
target:
|
|
entity_id: weather.pirateweather
|
|
response_variable: wx
|
|
- action: conversation.process
|
|
metadata: {}
|
|
data:
|
|
agent_id: conversation.google_generative_ai_gemini_2_5_flash_2
|
|
text: "{# pull the first (today) block #}\n{% set today_fc = wx['weather.pirateweather']['forecast'][0]\n\
|
|
\ if wx and wx.get('weather.pirateweather') else {} %}\n\n\
|
|
For this task, you are a meteorologist and you are responsible for providing\
|
|
\ the user information about the weather for the day. This information will\
|
|
\ be provided in the form of a notification on their phone, so keep it brief.\
|
|
\ You will provide information on the highest and lowest temperatures, and\
|
|
\ also provide guidance on what clothes they should wear for the day, such\
|
|
\ as whether a coat is required or not. For example, a cold day may require\
|
|
\ a hoodie and a jacket, or a hot but rainy day may require a rain coat. The\
|
|
\ weather data is as follows {{ today_fc | to_json }}"
|
|
response_variable: wresponse
|
|
- action: input_text.set_value
|
|
metadata: {}
|
|
data:
|
|
value: '{{ wresponse.response.speech.plain.speech }}'
|
|
target:
|
|
entity_id: input_text.clothes_suggestion
|
|
- action: notify.mobile_app_cph2671
|
|
metadata: {}
|
|
data:
|
|
message: '{{ wresponse.response.speech.plain.speech }}'
|
|
mode: single
|