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

**URL:** <https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986>\
**Category:** General\
**Created:** [17 November 2018 21:39 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986 "2018-11-17T21:39:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2018 21:39 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/1 "2018-11-17T21:39:11Z")

</div>

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.

```auto
[{"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:

```auto
"/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?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 November 2018 22:05 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/2 "2018-11-17T22:05:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2018 22:07 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/3 "2018-11-17T22:07:44Z")

</div>

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:

```auto
[{"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"]]}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 November 2018 22:11 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/4 "2018-11-17T22:11:13Z")

</div>

> [@Trying\_to\_learn](#):
>
> es, but that part is done in the CHANGE node.

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 November 2018 22:14 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/5 "2018-11-17T22:14:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2018 22:15 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/6 "2018-11-17T22:15:10Z")

</div>

Well, this is what I am seeing.

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

 ![Screenshot%20from%202018-11-18%2009-12-32](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/ab42e80113607500312e2c0922ef747f8ed0281a.png)

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2018 22:17 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/7 "2018-11-17T22:17:19Z")

</div>

Um.....

Where is the moment node?

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

```auto
//msg.payload = new.Datre().toString();
msg.payload = new Date();
return msg;

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 November 2018 22:32 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/8 "2018-11-17T22:32:53Z")

</div>

> [@Trying\_to\_learn](#):
>
> I am getting the time from the Function node:

What type of node are you feeding that into?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 November 2018 22:37 UTC](https://discourse.nodered.org/t/solved-rpz-w-and-camera-missing-something/4986/9 "2018-11-17T22:37:11Z")

</div>

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?
