hey folks,
I’m trying to add a timestamp to a slack notification. For some reason, this errors:
{
"message": "Sunset! Lights on {{ now().strftime("%H:%M") }}"
}
If I paste:
{{ now().strftime("%H:%M") }}
Into the Templates GUI, it works perfectly. But if I do it in the automation, it doesnt work.
Any tips?
Here is one of mine that works:
- service: notify.david_ios_notify
data_template:
message: Created backup named "Automated Backup {{ now().strftime('%Y-%m-%d') }}"
Just be aware, in your example, you can’t use double quotes outside as well as inside…
so try:
{
"message": "Sunset! Lights on {{ now().strftime('%H:%M') }}"
}
1 Like
myle
(StePhan McKillen (Other kiwi Here))
3
here is a automation I wrote this morning
- id: scentsy_wax Timer
alias: Scentsy Wax Timer
trigger:
- entity_id: switch.scentsy_wax
platform: state
to: "on"
condition: []
action:
- data_template:
title: "Home Assistant"
message: "Scentsy Wax we turn off @ {{ (as_timestamp(now()) + 60*15) | timestamp_custom('%H:%M') }}"
service: notify.stephan_phone
- delay: '00:15:00'
- data:
entity_id: switch.scentsy_wax
service: switch.turn_off