Canedje
December 30, 2020, 5:11pm
1
I do try to add an timestamp to an snapshot file using the snapshot service.
I do use:
{
"entity_id": "camera.garageachter",
"filename": "/config/www/snapshots/snapshot_camera_{{now().strftime('%H:%M %d-%m-%Y')}}.jpg"
}
But it is only making a filename without the date stamp
What am I doing wrong
krskrab
December 30, 2020, 5:47pm
2
_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
Canedje
December 30, 2020, 6:11pm
3
Thanks for the answer, but stil no time stamp
Do I need to activate the now() stamp?
Canedje
December 30, 2020, 6:28pm
6
Thanks again.
This is working, but in NodeRED It is not
krskrab
December 30, 2020, 6:30pm
7
Maybe it will work after restart
Canedje
December 30, 2020, 6:40pm
8
I really don’t understand.
This is the way I do, there is a file created, but without timestamp:
where data is:
{
"filename": "/config/www/snapshots/snapshot_camera_test_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg",
"entity_id": "camera.garageachter"
}
If I try your way at the services part in HA it is creating the right file
krskrab
December 30, 2020, 7:07pm
9
timestamp: this is a variable value
Unfortunately, I don’t use NordRed
Canedje
December 30, 2020, 7:09pm
10
Thanks any how for the help
Kermit
December 30, 2020, 7:32pm
11
by default NR using mustache templates not jinja2 like HA. If you want to be able to a jinja template to HA you’ll need to check the Use alternative template tags for the Data field
or you can do it directly in NR with the data type of the data field set to J: Expression
{
"entity_id": "camera.garageachter",
"filename": "/config/www/snapshots/snapshot_camera_" & $moment().format("YYYMMDD-hhmmss") &".jpg"
}
Canedje
December 30, 2020, 7:36pm
12
Thanks. I did find a solution by adding time stamp to the payload with an date/time formatter node:
and added at the data part:
{
"filename": "/config/www/snapshots/snapshot_camera_{{payload}}.jpg",
"entity_id": "camera.garageachter"
}
I will try your solution also
because it is one node less
EDIT: I tried your J: Expression solution. Thats working
I didn’t get it running with “alternative template tags” activated.
Thanks for the answer
1 Like
BullFrog
(BullFrog)
August 28, 2023, 4:02pm
13
Can someone share the full node? Try to make it work but I get snapshot_.jpg