New To Node Red - Trying to educate myself

Hello to the group. This is my first post. Apologies if this has been raised in the past.
I am attempting to develop a flow to download temperature/humidity data. I plan to access this device remotely (but that is my next challenge).

The device I use has a IP address on my LAN (192.168.2.XX). I am able to reach the device and download data contained in a table as per the attachment. I am particularly interested in obtaining the Temperature/humidity elements that are returned as I would like them to be available on dashboard graphs (which I have not yet created) .

Here is the flow that I have created:

[{"id":"ce3b141a.0d9448","type":"http request","z":"7daf9964.08de08","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"192.168.2.XX","tls":"","persist":false,"proxy":"","authType":"","x":550,"y":80,"wires":[["effd10c9.a31e8"]]},{"id":"738b5395.db4dbc","type":"inject","z":"7daf9964.08de08","name":"Cotty Equipment TEH Sensor","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":80,"wires":[["ce3b141a.0d9448"]]},{"id":"86eccf56.5ab64","type":"debug","z":"7daf9964.08de08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":240,"wires":[]},{"id":"effd10c9.a31e8","type":"html","z":"7daf9964.08de08","name":"","property":"payload","outproperty":"payload","tag":"div#content","ret":"text","as":"single","x":150,"y":260,"wires":[["95969e04.d38a5"]]},{"id":"95969e04.d38a5","type":"json","z":"7daf9964.08de08","name":"","property":"payload","action":"","pretty":false,"x":360,"y":260,"wires":[["86eccf56.5ab64"]]}]

I am not able to figure out how to extract the Temperature/Humidity data so that I can have it displayed on a dashboard.(again have not started to develop the dashboard for this project). I clearly am not using the correct labels in my HTML node.

Using the inspect feature this is what the table info coding looks like.

Should you require additional information or detail please let me know.

Any guidance / assistance would be greatly appreciated. I also apologize in advance if my post is not consistent with how it is supposed to be done as this is my first post.

Thank you all in advance.

Serge

Hi Serge, welcome to Node-RED and the forum.

Right off I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

https://nodered.org/docs/user-guide/messages

Next, when you posts flows, in order to make code more readable and importable it is important to surround your code with three backticks
```
like this
```

You can edit and correct your post by clicking the pencil icon.

See this post for more details - How to share code or flow json

Don’t worry about your first post, we’ve all been there and we all started at the beginning. The more you play and experiment, the more you will learn.

Once you have watched the videos and read the other material, see what you can do and if you are stuck, ask your questions.

The text you require is in td elements the html selector should be something like this div#content>table>tr>td looking at the child elements within the div
here is an example

[{"id":"1a4f63c1.d441f4","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":1760,"wires":[["3a5e042b.78470c"]]},{"id":"3a5e042b.78470c","type":"template","z":"c791cbc0.84f648","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div id=\"content\"><table>\n    <tr>\n        <td >25</td>\n    </tr>\n    <tr>\n        <td>34</td>\n    </tr>\n</table></div>","output":"str","x":320,"y":1780,"wires":[["bd532b63.0523c"]]},{"id":"bd532b63.0523c","type":"html","z":"c791cbc0.84f648","name":"","property":"payload","outproperty":"payload","tag":"div#content>table>tr>td","ret":"text","as":"single","x":560,"y":1800,"wires":[["72cdbe7f.04fa88","bd565711.dbaed"]]},{"id":"72cdbe7f.04fa88","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":1660,"wires":[]},{"id":"bd565711.dbaed","type":"ui_gauge","z":"c791cbc0.84f648","name":"","group":"b9d366f18ff7ae74","order":16,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{msg.payload[0]}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"16","seg2":"32","className":"","x":630,"y":1840,"wires":[]},{"id":"b9d366f18ff7ae74","type":"ui_group","name":"test","tab":"ffba43d73860d25d","order":1,"disp":true,"width":12,"collapse":false},{"id":"ffba43d73860d25d","type":"ui_tab","name":"Level","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

Also the example shows how to display in gauge node to.

Thank you for your prompt response zenofmud. Greatly appreciated.
I will definitely go through the Node-Red Essentials playlist this afternoon.
Thank you as well for your suggestions and comments on how to post to the forum. I have edited my post to include ''' ''' around my flow. :slight_smile:

I will definitely get back to the group with any additional questions.

Serge

Thank you E1cid. Indeed the html selector you provided does do exactly what I was looking for.
Have not tried your example flow but will try it out.

Much to learn of course. Appreciate your prompt feedback.

Thanks again.

Serge

You still haven't got it right yet. You need to use three back-ticks ``` to surround your code.
Read the link that @zenofmud posted as that shows how to do it.

Thank you dyanmicdave. I believe I have it corrected now.

Serge,

It was still wrong. I have edited it so it can import. You have to have the three back tic's on a seperate line before and after. Go take a look so you can see how I did it.

Oops. Sorry I messed up again.
I will review the tutorials before trying to post another flow. Thank you zenofmud/all for your patience.

Serge

So have you been able to access the data you need?

Hello zenofmud. Thank you for following up. I greatly appreciate it.

I have actually gone through the Node Red Essential videos. Lots of very useful information to say the lease. I have managed to learn a few things since yesterday so that is very gratifying, albeit I still have a lot to learn.

I have developed a flow to extract the array information from my temp/humidity sensor. I have then added a change node and am able to extract one of the specific array elements that I am looking for (temperature for the time being). I see that the temperature information is being extracted correctly using the debug node. I have been researching and reading (since yesterday evening) trying to get the temperature data to display on a gauge/line chart on my dashboard without success. I am clearly missing something. The flow below is for a gauge on the dashboard (under development).

Below is my flow:

[{"id":"e1ef4d7c.c6d8","type":"tab","label":"TEH Jan 23 2022","disabled":false,"info":""},{"id":"ef0954c8.3c5568","type":"http request","z":"e1ef4d7c.c6d8","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"192.168.2.25","tls":"","persist":false,"proxy":"","authType":"","x":390,"y":60,"wires":[["9dc2f90.9eeab08"]]},{"id":"d23907b9.ebf978","type":"inject","z":"e1ef4d7c.c6d8","name":"Cotty Equipment TEH Sensor","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":80,"wires":[["ef0954c8.3c5568"]]},{"id":"9dc2f90.9eeab08","type":"html","z":"e1ef4d7c.c6d8","name":"","property":"payload","outproperty":"payload","tag":"div#content>table>tr>td","ret":"text","as":"single","x":610,"y":80,"wires":[["344176eb.92109a"]]},{"id":"13d3b069.f844b","type":"ui_gauge","z":"e1ef4d7c.c6d8","name":"TEMP / Humidity","group":"45aae4ff.3bdc5c","order":0,"width":0,"height":0,"gtype":"gage","title":"TEMPERATURE","label":"Degrees C","format":"{{Value}}","min":"0","max":"45","colors":["#b50021","#e6e600","#38ca4d"],"seg1":"","seg2":"","className":"","x":590,"y":220,"wires":[]},{"id":"80ae0741.237018","type":"debug","z":"e1ef4d7c.c6d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[1]","targetType":"msg","x":460,"y":320,"wires":[]},{"id":"344176eb.92109a","type":"change","z":"e1ef4d7c.c6d8","name":"TEMP","rules":[{"t":"set","p":"payload[1]","pt":"msg","to":"msg.payload[1]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":170,"y":220,"wires":[["80ae0741.237018","13d3b069.f844b"]]},{"id":"45aae4ff.3bdc5c","type":"ui_group","z":"","name":"Graph","tab":"34ff870f.364f18","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"34ff870f.364f18","type":"ui_tab","z":"","name":"Cotty Temp Humidity Sensor","icon":"dashboard","disabled":false,"hidden":false}]

I am certain that it may be something straightforward, but I am not seeing why the data does not display on my dashboard gauge.

Guidance / assistance would be appreciated.

Serge

Your change node is messed up
move msg.payload[1]
to msg.payload
should work for you.

But as i showed in my earlier example you don't have to move or set or even use the change node. You can access the value direct in the gauge node. using
{{msg.payload[1]}} instead of {{value}}

E1cid - thank you very much for your prompt response and suggestion. It is now working. :slight_smile:

Many thanks for your help / guidance.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.