[solved] RPZ (W) and camera. Missing something

#1

SOLVED

Sorry.

Forgot to set filemode to 1

Sorry folks. I'm stuck with this.

This is the crux of the flow:
The idea is that the picture is taken with the name being determined by the date.
So a picture taken now (Local time: 2018/11/18 08:37:00) would be something like:
20181118-083700.jpg

But it isn't.

I am setting up the variables for the name and sending it to the camera node as documented.

[{"id":"f0954cb4.ac8a98","type":"inject","z":"d57de863.41484","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":120,"wires":[["8eb6bc88.a38f6"]]},{"id":"8eb6bc88.a38f6","type":"switch","z":"d57de863.41484","name":"Check if this is the one","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","outputs":1,"x":320,"y":200,"wires":[["76de7ecd.99f2e"]]},{"id":"76de7ecd.99f2e","type":"function","z":"d57de863.41484","name":"Time Stamp","func":"//msg.payload = new.Datre().toString();\nmsg.payload = new Date();\nreturn msg;\n","outputs":1,"noerr":0,"x":510,"y":200,"wires":[["903f31a1.8bbdf8","583464b7.480ff4"]]},{"id":"903f31a1.8bbdf8","type":"moment","z":"d57de863.41484","name":"Time format","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYYMMDD-HHmmss.png","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":690,"y":200,"wires":[["6510828d.aaae54"]]},{"id":"6510828d.aaae54","type":"change","z":"d57de863.41484","name":"","rules":[{"t":"set","p":"filepath","pt":"msg","to":"/home/pi/Pictures/Local_Camera/","tot":"str"},{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":260,"wires":[["86adab98.09c0f","ed9b32bf.7cfd78","ca3dda73.a1df68"]]},{"id":"ca3dda73.a1df68","type":"camerapi-takephoto","z":"d57de863.41484","filemode":"2","filename":"","filedefpath":"1","filepath":"","fileformat":"jpeg","resolution":"5","rotation":"0","fliph":"0","flipv":"0","brightness":"50","contrast":"0","sharpness":"0","imageeffect":"none","name":"","x":370,"y":260,"wires":[["e90f6be1.bc247","87bbd11b.e59a08","6c63e369.b7f124"]]}]

But I am getting this as the filename:

"/home/pi/Pictures/pic_529b13a1-bd03-4ac4-baea-11854bf0ff17.jpg"

I am probably missing an elephant - somewhere.

Someone mind taking a peep at the flow?

0 Likes

#2

The first thing I notice is that in the moment node you have not told it which property to write the time string to. I imagine you want it in msg.payload.

0 Likes

#3

Yes, but that part is done in the CHANGE node.

And what I didn't do was set the filemode value to tell the camera node to accept the file name from the message.

This is the new CHANGE node:

[{"id":"6510828d.aaae54","type":"change","z":"d57de863.41484","name":"","rules":[{"t":"set","p":"filepath","pt":"msg","to":"/home/pi/Pictures/Local_Camera/","tot":"str"},{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"filemode","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":260,"wires":[["86adab98.09c0f","ca3dda73.a1df68"]]}]
0 Likes

#4

So what do you think is in msg.payload on the way into the Change node?

0 Likes

#5

Hmm, you appear to be benefiting from a bug in the moment node. You have told it to output to msg but it has written it to msg.payload.

0 Likes

#6

Well, this is what I am seeing.

(Remember I didn't have the "filemode" set to 1 in the CHANGE node before this.

(
Re: your last post:
I seem to be good at finding bugs.
)

0 Likes

#7

Um.....

Where is the moment node?

I am getting the time from the Function node:
(code)

//msg.payload = new.Datre().toString();
msg.payload = new Date();
return msg;
0 Likes

#8

What type of node are you feeding that into?

0 Likes

#9

Oops. Ok. Sorry. Got another problem that has just bitten me on the back-side and driving me nuts.

Weirdly though now you have made me look at that node:
I don't remember the moment node having the red boxes around the input and output fields when I originally installed it.

I may not be a good programmer, but I don't leave red boxes blank, as they usually mean ERROR!

Maybe this is because of recent updates?

0 Likes