Date format in exec node

#1

Good afternoon

I don't know why but after my latest update I have an issue with the exec node I'm using in order to get some data.

The most simple is running just the command "date", previously was working fine and if I test on a raspberry console returns me "mi� jul 4 19:58:07 CEST 2018" frankly speaking the part of "mi�" es new, never had this before-
If I get the out of the exec node in node red with a debug I get:

image

Previously was running fine and on the other raspberry that I have for testing purposes it returns me directly the date/time as expected which I can directly pull to a text node.

How can I fix this? I guess there is some change done on the exec node at some point right?

Thanks in advance

0 Likes

#2

Which output of the exec node is that on? Can you export the exec node and paste it here.

0 Likes

#3

very strange...... as example one of the 3, the most simple

[{"id":"5d519dd4.aaf954","type":"inject","z":"38ad6844.92e088","name":"","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"x":273,"y":1489,"wires":[["b4a5ebb1.096c08"]]},{"id":"b4a5ebb1.096c08","type":"exec","z":"38ad6844.92e088","command":"date ","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":true,"name":"","x":553,"y":1489,"wires":[["b0503f8f.af7e2","641e44a.e8144bc"],[],[]]},{"id":"641e44a.e8144bc","type":"debug","z":"38ad6844.92e088","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":1500,"wires":[]},{"id":"b0503f8f.af7e2","type":"ui_text","z":"38ad6844.92e088","group":"6977e773.ba2438","order":1,"width":0,"height":0,"name":"","label":"Fecha","format":"{{msg.payload}}","layout":"row-spread","x":936,"y":1478,"wires":[]},{"id":"6977e773.ba2438","type":"ui_group","z":"","name":"system","tab":"5f054619.865f78","order":2,"disp":true,"width":"7","collapse":false},{"id":"5f054619.865f78","type":"ui_tab","z":"","name":"SYSTEM","icon":"fa-cog","order":11}]

Exactly the same flow on a previous raspi returns me as expected on debug image

Running the command in a console does not gives me the "mi�"

0 Likes

#4

So it isn’t the flow it is something about the pi. Have you updated using the bash <curl script? If so post the node red log on restart and on clicking the button.
You posted a flow with a text node attached, but presumably you are seeing the problem in the debug node. Previously you posted some debug showing a buffer but it shouldn’t be a buffer it should be a string. I am wondering about the version of node.js which is why I would like to see the log.

0 Likes

#5

Yes the buffer shown is from the debug, but is displayed similar on the text node, I will cross check my node.js version and will post, the latest raspbian does not has pre-installed node-red however all the rest of my flows are working fine, and I have a lot of stuff…

I installed from 0 using curl script yes.

0 Likes

#6

pi@raspberrypi:~ $ node -v
v8.11.3

0 Likes

#7

That’s ok. Can you post the log then.

0 Likes

#8

I don't have any error, the point is that the exec node returns me this buffer instead of the expected string with the date as I see if I run the command on a console, so on dashboard shows me the buffer

image
image

I don't understand why...

0 Likes

#9

Oh, sorry, I missed the fact that it shows the wrong thing in the console. Nothing to do with node-red then, but an issue with the pi. You haven’t got a funny language setup accidentally have you? Something like that.

Run sudo raspi-config and check the localisation options.

0 Likes

#10

Before posting I had already ran raspy-config and checked my locales and all apparently was ok, also rebooted with no success, maybe is linked to that odd "mi�”, I will try to google it a bit more.

I don’t know what u mean about funny lang, I think not in this case.

Thanks anyway colin

0 Likes

#11

The exec node does look to see if the response is a UTF8 string and if so returns a string - and if not sends it as-is which will be a buffer. So maybe Wed(nesday) in your locale has an accent that makes it not UTF8 ?
You can always use a following function node to .toString() it forcibly if you wish.

0 Likes

#12

bravo dceejay!!! You are the one, curiously I had already checked but when you told abouit the accent… make me think about it, and yes, doing sudo raspi-config I configured the locales for sudo that is not the user that runs node-red…

I had to enable VNC and graphical again and change it from desktop to be able to change the locale of pi and now is solved.

Thanks a lot guys

0 Likes