Regex in automation action not working

I cannot figure out why my automation is failing to load correctly. When using the developer tools services feature it works flawlessly but when I try to save as an action in automation the image value is changed to null as in image: null

service: notify.mobile_app_myphone
data:
message: Test
data:
image: {{ “/media/temp.jpg” |regex_replace(find=“media/”, replace=“media/local/”, ignorecase=False) }}

I need this because the folder_watcher states the true path but notify add /local.

Please help!

Are you sure your result look look like:

"/media/local/temp.jpg"

not:

"/local/media/temp.jpg"

?

Try the following:

service: notify.mobile_app_myphone
data:
  message: Test
  data_template:
    image: "{{ '/media/temp.jpg' |regex_replace(find='media/', replace='local/media/', ignorecase=False) }}"

And please use the “formatted text”-option to post code in future :wink:

What the heck? Yeah what is posted there definitely would not have worked correctly. I did confirm that what I have entered is correct.

service: notify.mobile_app_jjwa40
data:
 message: Test
 data:
   image: {{ "/media/temp.jpg" |regex_replace(find="media/", replace="media/local/", ignorecase=False) }}

Additionally I created a template as a means to work around the problem. The template has the correct defined path but when I attempt to leverage the template in the notify automation action the notification never sends.

Weird I’m looking at my original post and it is not backwards like you have it. Maybe its because I didn’t format the text.