I’m using the template node function in node red to create dynamic notifications and I’m wondering if there is a built-in timestamp function I call.
Current json:
{
"data": {
"message":"I saw something at the {{ data.old_state.attributes.friendly_name }}, I'll just record this. - {{ now().strftime('%I:%M:%S %p') }}" }
}
However the {{ now().strftime('%I:%M:%S %p') }}
function doesn’t seem to work within the template function. Any thoughts?
Thanks,
{{ as_timestamp(now())|timestamp_custom('%I:%M:%S %p') }}
oakbrad
(Oakbrad)
May 21, 2018, 12:59am
3
I’ve found this node really useful for dealing with timestamps in Node-Red
{
"data": {
"message":"I saw something at the {{ data.old_state.attributes.friendly_name }}, I'll just record this. - {{ as_timestamp(now())|timestamp_custom('%I:%M:%S %p') }}" }
}
Tried your suggestion and it still doesn’t seem to evaluate it.
The result is just:
data: object
message: "I saw something at the Front Door, I’ll just record this. - "
Never mind. I really don’t know node red.
The node-red-contrib-moment module seems to do the trick. I just run the event through it and store it in a new data.time
value to read out on the far end.