Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templates in message field of notifications do not work anymore #1037

Closed
2 tasks done
c-lega opened this issue Oct 3, 2024 · 16 comments
Closed
2 tasks done

Templates in message field of notifications do not work anymore #1037

c-lega opened this issue Oct 3, 2024 · 16 comments
Labels
bug Something isn't working work-in-progress

Comments

@c-lega
Copy link

c-lega commented Oct 3, 2024

Checklist

  • I am using the latest version of Alarmo (latest version can be found here)
  • I checked for similar existing requests (both open and closed) before posting.

Alarmo Version

v1.10.4

HA Version

2024.10.0

Bug description

I have many notifications triggered by all kind of alarm events. As there are many, I used a template to include the time it occurred in the message of the notification. That is not working anymore (not sure since when, but it's been at least a week or so - and I update almost instantly any update available).
Now I only can used a couple of wildcards and my templates do not work. BTW I have an Android device.

Steps to reproduce

Create a new notification, set target to a mobile device, set message to any template (I sue: "{{now().strftime('%m/%d/%Y - %H:%M:%S')}}", and then press "TRY IT->"
You'll see the notification in the device contains the template itself instead of the expected output.

Relevant log output

No response

@c-lega c-lega added the bug Something isn't working label Oct 3, 2024
@hanshanderson
Copy link

hanshanderson commented Oct 4, 2024

I can confirm the same issue, starting with the update to HA 2024.10.0

@Al3xand3R360
Copy link

Same issue here since update to HA2024.10

@Gifford47
Copy link

Same issue on 2024.10.1.

@elbel86
Copy link

elbel86 commented Oct 6, 2024

Same issue here on 2024.10.1

@nielsfaber
Copy link
Owner

At this point I have no idea what caused this functionality to break or how to fix it.
It seems that a change in the latest HA release introduced this bug, but there is no mentioning of this in the release notes of HA.
The templates are processed on the side of HA, Alarmo simply forwards the message text when executing the service.
I will have to dive deeper into the recent code changes in HA to see if I can find the cause. Unfortunately this may take some time.
If anyone can find some relevant information, please share.

@uvjim
Copy link

uvjim commented Oct 6, 2024

I don't believe this is affecting only Alarmo. I have templates set on the notify group I use; they have also stopped working. I remember reading a warning in the logs (can't find it now) about templates being deprecated. So not sure if that may have an affect. Templates seem to work if I use them in a normal automation with notify though.

update: found the message I was talking about home-assistant/core#72287

It may not have anything to do with this, so apologies for the noise if it doesn't.

@kevinsaucier
Copy link

kevinsaucier commented Oct 11, 2024

Just chiming in here with the same issue. From info on the post above, seems like HA expects the integration to process the Template and pass plain text to Notify. Odd, though, as I can call the exact same service from the Developer window and it works as expected, unless the Developer window is processing the template before actually calling Notify.

Alexa Media is a custom component. It needs to process the templates before calling the notify service. You need to report that to the custom component author.

So, this works in Developer/Actions but doesn't work with 'Try It' from Alarmo. Hmmmmm....

service: notify.notify_kevin
data:
  message: Alarm Armed to Home {{ states('sensor.date_time') }}
  title: Don't Open the Doors!
  data:
    ttl: 0
    channel: ha_info
    actions:
      - action: Disarm Alarmo
        title: Disarm Alarmo
      - action: Turn off Inside Lights
        title: Turn off Inside Lights

Also tried this, with the same results (thought maybe it had something to do with the change of Service to Action):

action: notify.notify_kevin
data:
  message: Alarm Armed to Home {{ states('sensor.date_time') }}
  title: Don't Open the Doors!
  data:
    ttl: 0
    channel: ha_info
    actions:
      - action: Disarm Alarmo
        title: Disarm Alarmo
      - action: Turn off Inside Lights
        title: Turn off Inside Lights

@thenextbutton
Copy link

Good Evening, apologies if this does not add anything to the conversation I was wondering what are the thoughts on this one?

I have experienced the same when upgrading to 2024.10 and have rolled back

I have the title for notifications set to {{ now().strftime('%H:%M %a %d %b %Y') }} on 2024.9 it fills in the information on 2024.10 I get the raw data.

Thanks in advance.

@Schermbecker
Copy link

Seems to be the same topic as seen here:
#989

@nielsfaber
Copy link
Owner

Just a small update: I am working on this issue, so far it looks fixable from the side of Alarmo.

@cmd85
Copy link

cmd85 commented Oct 19, 2024

Just a small update: I am working on this issue, so far it looks fixable from the side of Alarmo.

Thank you, was just about trying to start fixing workarounds in automations or rollback but I can wait if its being looked at, no real hurry =)

Im using this style which worked to recently: {{now().strftime("%H:%M:%S")}}

@nielsfaber
Copy link
Owner

After research I found out that support for templates in notifications is intentionally removed in the HA 2024.10 release, see home-assistant/core#122820.
The PR description states that templates can only be used in scripts/automations from now on, not in other integrations.
This was marked as breaking change but not mentioned in the release notes of HA.

I will keep digging and see if I can make some workaround, but I have to say I'm very surprised by this PR as well as the lack of communication of the change.

@Schermbecker
Copy link

@nielsfaber thank you so much for your effort!
Alarmo is a great tool, I love it 😍

Alarmo provides properties "bypassed_sonsors" and "open_sensors" in its actions. I print this information into the appropriate notifications.

To do so I use template scripting just for an IF statement - to insert an additional label in case there are open or bypassed sensors.

Now (without the IF) the labels are always inserted, even if the properties are empty. So no big issue at all.

@nielsfaber
Copy link
Owner

This issue should be resolved in the v1.10.6 release.

@c-lega
Copy link
Author

c-lega commented Oct 24, 2024

@nielsfaber Thank you!... +1 for your effort!...
It works, but had to recreate all actions due to a bug that just confirmed... it doesn't let you modify and the save (or even "Try it" after initial save).

@thenextbutton
Copy link

Thank you so much for resolving this. Much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working work-in-progress
Projects
None yet
Development

No branches or pull requests