Notification with Time stamp

Had a hard time searching for this, since the notifications do work correctly when I test, just not when its apart of the automation in node-red.

{“message”:“Home was armed Away at {{now().strftime(’%I:%M%p’)}}”}

If I run that in the services to send a push notification to my phone it comes in correctly.
Home was armed Away at 08:32AM
image

image

However once ran in node-red it doesn’t attach the time.

image

image

I was using this same method for things like when the garage door opened and closed as well and things were working fine. I’m sure there was a breaking change on one of the last updates I did. I’ll admit I dont always thoroughly read the changes, :smile: Love all the work done to HA, been using it for almost 2 years now.

Thank you in advance for any suggestions on what I should look for.

You’ll probably get more help if edit your post and you put it in the node red category.

https://community.home-assistant.io/c/third-party/node-red

1 Like

thanks tom_I will do

By default you can’t use jinja2 templates, HA templates, in call-service nodes anymore. Because it tries to process it as a mustache template.

Two possible solutions:

  1. Redefine the open and closing tags for mustache templates in the string.
{"message":"{{=<% %>=}}Home was armed Away at {{now().strftime('%I:%M%p')}}"}
  1. Use a node before the call-service node to define the timestamp you want. The moment node works well for this.
{"message":"Home was armed Away at {{payload}}"}

6 Likes

Awesome thank you so much!