Node-red error with update

I just updated the emoncms plugin for NR and get a HTTP error. Looking at the debug it appears it’s looking for a time " “WARN: Time object undefined, no time set”" . The question is how do add time ?
The payload contains the temperature so I guess I need a function to add Date as well??..

Dave.

Hi Dave, See the Update to node-red-nodes-emoncms node thread, @borpin might be able to help.

Hi Paul, yes I looked at that thread but didn’t help much. The node still updates emoncms. I have removed the node and reinstalled it and restarted node red and still the same.

No didn’t suspect you would find the answer in the current content, but Brian has recently made some changes to the node-red-node-emoncms node and has said

I do not know if this is definitely related, but since you say it was working prior to updating, it just might be possible.

Hi @myozone, this is just a warning, the node should still show success and the data should be in emoncms but it has used the time received as the date stamp.

What method are you using for the data input?

Time can either be set by setting msg.time as a name:value pair in JSON format.

I thought about adding an option in the node to adjust the log level.

Hi Brian Yes indeed, data is showing up on emoncms. here’s the main bit of the flow

[{“id”:“775bcf3f.21d1a”,“type”:“inject”,“z”:“666b367.66293c8”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:“1”,“crontab”:"",“once”:false,“x”:109.89582824707031,“y”:194.88888549804688,“wires”:[[“e673d793.e0cce8”]]},{“id”:“e673d793.e0cce8”,“type”:“rpi-ds18b20”,“z”:“666b367.66293c8”,“topic”:"",“array”:false,“name”:"",“x”:268.8958282470703,“y”:194.88888549804688,“wires”:[[“dd72415c.887ba”]]},{“id”:“dd72415c.887ba”,“type”:“smooth”,“z”:“666b367.66293c8”,“name”:"",“action”:“mean”,“count”:“30”,“round”:“2”,“x”:425.8957977294922,“y”:195.88888549804688,“wires”:[[“c13431bc.35573”]]},{“id”:“c13431bc.35573”,“type”:“delay”,“z”:“666b367.66293c8”,“name”:"",“pauseType”:“rate”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“15”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:true,“x”:588.8957977294922,“y”:195.88888549804688,“wires”:[[“b2a80e03.67de7”]]},{“id”:“b2a80e03.67de7”,“type”:“emoncms”,“z”:“666b367.66293c8”,“name”:“Emoncms Push”,“emonServer”:“914138e7.e0c9c”,“nodegroup”:“7”,“datatype”:“legacy”,“x”:785.8957977294922,“y”:194.88888549804688,“wires”:[]},{“id”:“914138e7.e0c9c”,“type”:“emoncms-server”,“z”:"",“server”:“https://emoncms.org”,“name”:""}]

pretty basic really temp from a DS1820 on the PI.

I could not import the node for some reason (you probably use a node I do not have installed). The key bit though is above. You are using one of the legacy data structures. From my perspective that is good as it should have ‘just worked’.

if you want, modify the payload so that it is a proper JSON structure. If you add a time:value pair to the JSON structure the warning will go.

I’ll consider downgrading the message to info, so it only goes in the log.

My first attempt at working on a node!

I just tried paste the flow back in to test it and it screws up NR - I got it going with the backup json. Well done on your first node BTW. Daft question how do I format it to a JSON structure please ? - I’m still very new to NR, oh yes the only node that’s in that flow is the DS1820 temp node

[{“id”:“4e148a39.af13f4”,“type”:“inject”,“z”:“2ae4c949.b508e6”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:“1”,“crontab”:"",“once”:false,“x”:97,“y”:226,“wires”:[[“60585acf.564194”]]},{“id”:“60585acf.564194”,“type”:“rpi-ds18b20”,“z”:“2ae4c949.b508e6”,“topic”:"",“array”:false,“name”:"",“x”:256,“y”:226,“wires”:[[“5216d51c.24b05c”,“313d4fcd.bc3b1”]]},{“id”:“313d4fcd.bc3b1”,“type”:“smooth”,“z”:“2ae4c949.b508e6”,“name”:"",“action”:“mean”,“count”:“30”,“round”:“2”,“x”:545,“y”:188,“wires”:[[“e2af45f3.6a4a08”,“bd5c97ba.82ce98”,“f738ccb6.129e8”,“ef9a9f6c.425d2”,“135b89f8.d25f36”]]},{“id”:“f738ccb6.129e8”,“type”:“delay”,“z”:“2ae4c949.b508e6”,“name”:"",“pauseType”:“rate”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“15”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:true,“x”:578,“y”:232,“wires”:[[“670d8c71.271e94”,“56b9c9b6.dc9388”,“f42980d3.0b6c”,“9c1c7424.fb8558”]]},{“id”:“f42980d3.0b6c”,“type”:“emoncms”,“z”:“2ae4c949.b508e6”,“name”:“Emoncms Push”,“emonServer”:“914138e7.e0c9c”,“nodegroup”:“7”,“datatype”:“legacy”,“x”:1064,“y”:176,“wires”:[]},{“id”:“914138e7.e0c9c”,“type”:“emoncms-server”,“z”:"",“server”:“https://emoncms.org”,“name”:""}]

I think this would be a good idea. I find the debug window very useful when developing functions, and as it stands my debug window is being flooded with “warn” messages making it very unusable as it stands. Is there a quick fix in the node files to make the info rather than warn messages?

UPDATE I’ve temporerrily fixed my issue by commenting out the lines in the .js file where there are “warn” messages. Seems to have done the job for now. :wink:

1 Like

I had the same warning. To solve it, I adapted the function formating the payload before sending to EMoncms :

tempc = msg.payload.tempc;
hum = msg.payload.humidity;
msg = {temp_ext:parseInt(tempc),HR_ext:parseInt(hum)};
mytime = new Date().toISOString();
return {payload:msg, time: mytime};

In the function, msg.payload is the incoming payload from weather underground. It is the input of the so called “weather” node on the following figure :

Hi @borpin

The upgrade to the new emoncs node (and also latest node-red version) caused that my CPU temp is no longer reported to emoncs.org.
I managed to fix this by changing the Data Type of the emoncms node from “Legacy processing” into “Valid JSON object”.

But as I you can see in the screenshot below:


There are still 2 minor issues:

  1. The Warning “WARN: Time object undefined, no time set” that is reported. So as is already said in the messages above, this should not be reported as a warning.
  2. I also do not understand why the node status is showing “http issue” and also why at the bottom right it is saying "warning: “ERROR: Http response”.

Especially any advice for point 2 would be welcome.
kr
Jan.

Yes I need to do that. It is confusing - I thought I was helping :frowning_face:

I think I need to handle the 200 response however, I have seen a 200 response when things are not OK! I’ll have a look again.

The theory is that if legacy processing is selected, the node behaves exactly as before. I’m not sure why this is not working. Did you change your data structure at all or just change the data type.

Do you get the HTTP error if legacy processing is selected?

Hi @borpin,
Thanks for the very fast response.
The inputs are properly updated every 5 minutes as I can see on Emoncms - user login

As requested my emoncms node configuration:
image

image
As you can see I have masked the API key.

many thanks
Jan

Ah interesting. It is for emoncms.org. That has not updated the Input API AFAIK and that is why it would fail in some circumstances although legacy processing should act the same as before. @TrystanLea @glyn.hudson @Gwil can you offer any insight? I only actually considered a local install when making these changes :frowning_face:

Just tested it with Data Type “Legacy Processing” and it is indeed correctly updating the inputs on emoncms.org,
… but I am still getting the same “http issue” status and warning: “ERROR: Http response” as with Data Type “Valid JSON Object”.
@borpin

Ok, that is good. I’ll look at handling the response differently.

Oh and I will also need to disable the full json option for emoncms.org until the API is updated.

1 Like

FYI: I fixed the issue by editing 88-emoncms.js in folder ~/.node-red/node_modules/node-red-node-emoncms.
As suggested above: I disabled the warnings and node.status update at following 2 locations (see lines 79-80 and 120-122)

It is masking it rather than fixing it as if you do get an HTTP error, you will never know :frowning:

The other issue is that you can get a 200 response but the data is not received correctly.

Strictly it is a warning rather than an error response.

Brian, I have also upgraded and see the same.

Could you make the http issue warning something like the RED message on electricity meters. This alternates with the reading and goes off after a while.

How about ‘http 200 issues noticed’ and only leave it there if there have been issues in the last hour. Maybe you could count the number and report that? Also, not sure if you can do this but could you use a grey font so that it appears less serious?

Simon

1 Like

What exactly is the issue here Brian, I thought a http 200 response was confirmation that all is well.
Or is it something else like a 202, 203, 204 ect error, saying it’s been received, but there was a problem?
I haven’t had chance to look at the error, or the node’s code in any detail, but a ‘200’ response is normally directed to the msg.payload (if the node has an output), and other error codes are reported.
Such as https://github.com/node-red/node-red/blob/master/nodes/core/io/21-httpin.js#L317-L342

Paul