Alert data: template not parsed but in automation it works
MXMLN-sec opened this issue · 1 comments
The problem
When using a template for any value within the data:
section (eg. critical) the template will not be parsed.
My goal is to achieve a regular app notification when a door has been opened, but when the door has not been closed for a given time Home Assistant should send a critical notification instead.
This time based logic as a template has not been applied in the example below since it should be an easy way to test. So due to the fact the template will not be parsed I always receive a regular non critical notification.
While trying the same template in an automation the template will be parsed correctly and I receive a critical notification.
I'm using the Companion App for iOS.
What version of Home Assistant Core has the issue?
2024.7.1
What was the last working version of Home Assistant Core?
?
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
alert
Link to integration documentation on our website
https://www.home-assistant.io/integrations/alert/
Diagnostics information
No response
Example YAML snippet
# not working alert with template in critical data section:
alert:
door_open:
name: "Door open"
entity_id: binary_sensor.front_door
state: "on"
repeat:
- 5
skip_first: false
title: "Front door opened"
message: "Front door was opened"
done_message: "Front door has been closed"
notifiers:
- mobile_app_iphone
data:
push:
sound:
name: "default"
critical: "{{ is_state('binary_sensor.front_door', 'on') | int }}"
volume: 0.0
# working automation with template in critical data section
alias: Test notify template for critical notification
trigger: []
action:
- service: notify.mobile_app_iphone
data:
title: Test Message
message: This is a test message
data:
push:
sound:
name: "default"
critical: "{{ is_state('binary_sensor.front_door', 'on') | int }}"
volume: 0
mode: single
Anything in the logs that might be useful for us?
No response
Additional information
As far as I can understand the problem lies somewhere near the fact that CONF_DATA
is declared as dict
and not as cv.template
in homeassistant/components/alert/__init__.py
with all the following necessary template specific coding.
vol.Optional(CONF_TITLE): cv.template,
vol.Optional(CONF_DATA): dict,
Unfortunately I’m not a developer, more like a hobby coder and I don’t have enough time to work into this the way I would love to.
Hey there @home-assistant/core, @frenck, mind taking a look at this issue as it has been labeled with an integration (alert
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of alert
can trigger bot actions by commenting:
@home-assistant close
Closes the issue.@home-assistant rename Awesome new title
Renames the issue.@home-assistant reopen
Reopen the issue.@home-assistant unassign alert
Removes the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-information
Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-information
Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
alert documentation
alert source
(message by IssueLinks)