Getting date time stamp logged

I have an Aqara movement sensor inside my front porch of the house and wish it to detect movement and report the date time of the detection and notify my phone.

I have created two helpers, one for movement detection and the other for the date time stamp. The date time stamp is not working.

First helper

That is working fine in the automation

however I can not get the date time to work and come through in the notification

Date Time helper

Here is this bit second bit of the automation

And here is the error log


Ideally I wish the notification to say “Front porch movement detected at 22.17hrs 12/04/2024”

Looks like I am not getting the date time saved and written in. What am I doing wrong?

Please see this post How to help us help you - or How to ask a good question - Configuration - Home Assistant Community (

Specifically, number 11.