I have a notification that is not passing the critical event sound or icon but is passing the title, message & badge correctly:
action:
- service: notify.mobile_app_vic_iphone
data_template:
title: "Water Sensor Alert"
message: "Water detected from {{ trigger.to_state.attributes.friendly_name }}"
data:
push:
badge: 1
sound:
name: default
critical: 1
volume: 1.0
The following works as expected:
action:
- service: notify.mobile_app_vic_iphone
data:
title: "Water Sensor Alert"
message: "Water detected from TESTING STATIC DATA"
data:
push:
badge: 1
sound:
name: default
critical: 1
volume: 1.0
From Discord discussion: The "sound dictionary" may be affected and "it seems the contents of {data: {push:{*}}} aren't passed through when data_template is used"
For benefit of Robbie, we did a fair amount of testing of this on Discord. I can produce this, you don't need to use a template anywhere bust as soon as you switch to data_template it seems critical: 1 is ignored
Perhaps I shouldn't be writing this, as I really don't have a clue; merely guessing. But have you tried adding extra data's?
action:
- service: notify.mobile_app_vic_iphone
data_template:
title: "Water Sensor Alert"
message: "Water detected from {{ trigger.to_state.attributes.friendly_name }}"
data:
push:
data:
badge: 1
sound:
data:
name: default
critical: 1
volume: 1.0
I might be wrong, but seem to recall an instance where I experienced a surprising difference between data and template_data, and that it, for some reason, was fixed when I added additional data's for each sub-dictionary, so to say?
Or, have you tried replacing the subsequent data's to data_template's even though no template is actually used?
Trying @krissen's suggesting result in no notification and the following error in logs for me:
apns.payload.aps.sound.name must be a non-empty string
Moving name into the sound dictionary and leaving the rest in a new data sub-dictionary just results in a normal notification as before
Related issues: #432 and https://github.com/home-assistant/home-assistant/issues/24480
Root issue appears to be https://github.com/home-assistant/home-assistant/issues/15976
Temporary fix applied on the server side to coerce critical to an int but that may break setups where people say true or false instead of 1 or 0.
Paulus points out you can also put some stuff in data and other stuff in data_template. But it is expected behavior for data_template to aggressively coerce everything to strings.
Expected behavior will be fixed via https://github.com/home-assistant/home-assistant/pull/29353!
Most helpful comment
Expected behavior will be fixed via https://github.com/home-assistant/home-assistant/pull/29353!