Issue with http poll and nest request node

330 views
Skip to first unread message

James Mitchelmore

unread,
Apr 5, 2017, 9:34:39 AM4/5/17
to Node-RED
Hello,

I'm doing some development with nest and node-red and have come up against what looks like a bug.  This is my first time with node-red so it may be my fault...

I have my nest account setup and functioning correctly.  When I inject a trigger as shown below I get the correct output in the debug window.

However, when I poll via http I get no response and the web browser eventually times out.

Connecting the http input and http response output via a template works correctly so the only thing that I can sumise is that the input of the nest response node does not 'support' the http poll.  Does that sound likely?

Any help gratefully received.

Regards
James

Auto Generated Inline Image 1

Nick O'Leary

unread,
Apr 5, 2017, 10:06:56 AM4/5/17
to Node-RED Mailing List
For an HTTP flow to work, the msg.res property sent by the HTTP In node must make it all the way to the HTTP Response node.

If either the Nest node or your Function node is returning a new message object, rather than reuse the received message, then the property will not get through. You'll see a warning log message from the HTTP Response node if it receives a message without a msg.res property.

If you add a Debug node set to log the complete message object, check to see if that property exists.

Nick

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/84b581d8-4f06-4ada-b7a0-a5518f27fcba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Mitchelmore

unread,
Apr 6, 2017, 6:28:41 AM4/6/17
to Node-RED
Thanks Nick,

Yes, it looks like the nest node is not passing that property.  Can you suggest another way to acheive this?

Regards
James

Joey Langan

unread,
Apr 6, 2017, 10:25:19 AM4/6/17
to Node-RED
James,

I am not familiar with the NEST API or the NEST node that you are showing, but have one question.  It looks like you are using an HTTP input node to set up service that is listening for NEST to send some sort of message/update.  Where/how do you tell NEST to callback to your HTTP (input) service? 

Joey

James Mitchelmore

unread,
Apr 6, 2017, 11:21:11 AM4/6/17
to Node-RED
Hi Joey,

The nest node produces an output when triggered which can be read in the debug node.  I have used a formula node to filter out the information I need, then the intention was that this would get passed back via the http response node.  Is that what you meant?

Thanks
James

steve rickus

unread,
Apr 6, 2017, 11:54:49 AM4/6/17
to Node-RED
I can see starting at line #30 in the nest.js source code that the newmsg object being returned only passes along the topic from the original http in node:

            node.on("input", function(msg) {
                var outmsg = { 
                    topic: msg.topic
                };


Ideally, as Nick said, the node's author would add msg.res (and maybe other fields?) to this init step. Alternately, you could modify your own copy of the nest.js -- just to get it working for now -- realizing that any npm updates will over-write this change.

I can think of a couple other ways to preserve that information, but they would probably be ugly work-arounds:
1. use change nodes before and after the nest node to move msg.res to msg.topic (and vice versa)
2. use parallel paths to a function or join node that builds one msg from the nest node msg.payload, and the original msg.res property
--
Steve

Nick O'Leary

unread,
Apr 6, 2017, 3:05:57 PM4/6/17
to Node-RED Mailing List
An issue should be raised against the nest node to get it to fix this behaviour.

Nick

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

James Mitchelmore

unread,
Apr 6, 2017, 4:50:12 PM4/6/17
to Node-RED
Thanks Nick,

I have just posted it as an issue on GitHub linking to this thread for details.

Hopefully that will help resolve.

James


Joey Langan

unread,
Apr 9, 2017, 8:34:55 AM4/9/17
to Node-RED
James,

Just curious, what are you trying to do with this flow? I've looked at the nest nodes and I ask as i think there are some work arounds that you can do, but wanted to understand the context more before suggesting anything.

Thanks,
Joey

to...@thevalyreangroup.com

unread,
Apr 12, 2017, 8:57:05 AM4/12/17
to Node-RED
James,

It looks like you're trying to trigger the NEST node manually, whether thats from an inject node or HTTP node.  However, the NEST node has a builtin "streaming" function that enables the node to poll Nest every n seconds and receive updates when necessary.  Take a look at my working flow below.

James Mitchelmore

unread,
Apr 19, 2017, 4:28:49 AM4/19/17
to Node-RED

Thanks Guys and apologies for the delayed response.

The intention was to have my automation system (Loxone) poll an http URL and have a the necessary data returned from the poll. 

I have played with the streaming option but it appears to return data in a different style than polling it manually.  Will need to investigate further.

Will report back!

Thanks
James

Rene

unread,
Feb 23, 2018, 5:03:24 AM2/23/18
to Node-RED
Hello, James,

i'm trying to connect my Nest Protect's to Loxone via Node RED, just like you. Have you already been able to implement this successfully? Maybe anybody else?

I can't get any further with the streaming option. Polling is no problem on my setup, but too slow in an emergency situation.

What must i change to get streaming working (screenshots attached)?

Thanks in advance,
Rene
flow.png
function.png

James Mitchelmore

unread,
Feb 23, 2018, 5:51:00 AM2/23/18
to Node-RED

Hello Rene,

I initialliy had streaming working but then had issues parsing the necessary information as it returned the data in a different format to polling.

I had left the project for a while but funnily enough went back to it last week. I've just had another look to remind myself where I got to...

With the nest node set to streaming, when manually triggered it produces a result, after that it returns 'null' on anywhere between 5-30 second intervals.  My feeling is that it won't return any actual data until soemthing changes on the nest side but I'm not able to test that just now.

Hope that helps in some way.  Interested how you get on.

Cheers
James


Rene

unread,
Feb 26, 2018, 3:25:51 AM2/26/18
to Node-RED
Hi James,

i'm having the same problem. I tried to convert the payload to json (see https://github.com/hjespers/node-red-contrib-nest/issues/6) with the same result - manually triggered -> result in json, but null messages afterwords).

How did you set up your http nodes? I'd like to try to give the nest return message directly to Loxone as virtual http input, without the function node.

Rene

unread,
Mar 27, 2018, 1:58:50 AM3/27/18
to Node-RED
Now it's working for me! 😉
flow.png
convert to json.png
change payload.png
function.png

James Mitchelmore

unread,
Mar 27, 2018, 5:30:02 AM3/27/18
to Node-RED
Good news! Thanks for the update.  Will try to replicate on my system later.

Regards
James
Reply all
Reply to author
Forward
0 new messages