New User, odd stiuation

hello again, more questions,

now they are communicating, the "string" of information is less compadible with my switch thing i had setup before.

[{"id":"f8a45b09.c7ce3","type":"change","z":"63556fbb.5ffe8","name":"Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature_C","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":60,"wires":[["66c26dbb.42a1d4"]]},{"id":"74a6788f.78fd68","type":"change","z":"63556fbb.5ffe8","name":"Humi","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humidity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":120,"wires":[["f99809b9.92dd7"]]},{"id":"f99809b9.92dd7","type":"function","z":"63556fbb.5ffe8","name":"Round","func":"msg.payload = Number(msg.payload.toFixed(0));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":890,"y":120,"wires":[["6dfe61a4.8375e","8dcabbb9.be269"]]},{"id":"66c26dbb.42a1d4","type":"function","z":"63556fbb.5ffe8","name":"Round","func":"msg.payload = Number(msg.payload.toFixed(0));\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":890,"y":60,"wires":[["8dcabbb9.be269","6dfe61a4.8375e"]]}]

on the remote side i get an output of 21, and 54. temp/humi.

when i use the same on the server to pull out the data i want from the string i get

2021-05-18, 11:20:35 a.m.[node: ab8ab462.05b1e](http://192.168.1.15:1880/#)Marcus Room : msg.payload1 : undefined

2021-05-18, 11:20:35 a.m.[node: ab8ab462.05b1e](http://192.168.1.15:1880/#)Marcus Room : msg.payload1 : undefined

2021-05-18, 11:20:35 a.m.[node: ab8ab462.05b1e](http://192.168.1.15:1880/#)

Marcus Room : msg.payload1 : undefined

undefined

the colors on the debug screen are different as well.

{ temperature_C: 21.06, humidity: 52.386141050827035, pressure_hPa: 1015.4996487140004, model: "BME280" }

temp, humi, and pressure are purple with blue data and red model. on server side it's all red.

does that do something to the data being sent?

Hi, 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

i'm really sorry, you need to dumb that down, cause that means nothing to me. even the other link, i have no
"The easiest way to do that is to click the 'Preformatted Text' button in the toolbar:

image

Then paste in your code or flow json.

thing where i can add the

`like this`

to any of this code or nodes.

(like i have no idea how you put 3 "`" in this fourm with out making stuff red.

in your round function you have

msg.payload = Number(msg.payload.toFixed(0));

that should be

msg.payload = Number(msg.payload).toFixed(0);

What I think you are saying it the data on the "server side is all red" is that it is a string
where as on the other side it is an object.

Set the MQTT In nodes to parse JSON

image

That will turn the "all red" (string) into "purple with blue data and red model" (an object)


when you have an object it is easy to grab the values...

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

the round functiuon i had was working. that was also me exploring other ways to fix the underlying issue of unsuable data on my server side.

image

i don't have those options.

When you next type a reply to a message in the forum look 1 cm above where you are typing.

That ā†‘ is the MQTT Out node.

I said...

@Cyprus125 sorry to say this, but you really need to read the stuff we write mate. :confused:

1 Like

the title if this thread is i'm a new user. i don't understand what you are saying. i can't find the options you guys are saying. i'm bashing my head againt the keyboard woundering why i'm trying to get this. i'm greatful for the help.

"Set the MQTT In nodes to parse JSON" didn't explain output side, or in my understanding on my server.

I know, i seen

You are welcome.

Just asking that you slow down a bit & read the stuff we post please.

As a beginner, I feel you will benefit from 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.

1 Like

so changing that fixed the colors in my debug window, but still leaves me undefined data on the end of my switch nodes.

2021-05-18, 12:13:08 p.m.node: 80b45df7.c1c3eMaster Bedroom : msg.payload : Object

{ temperature_C: 21.33, humidity: 50.766390783699855, pressure_hPa: 1015.1776177171702, model: "BME280" }

2021-05-18, 12:13:08 p.m.node: fb4ab453.a47c7Master Bedroom : msg.payload0 : undefined

undefined

2021-05-18, 12:13:08 p.m.node: fb4ab453.a47c7Master Bedroom : msg.payload0 : undefined

undefined

2021-05-18, 12:13:08 p.m.node: fb4ab453.a47c7

Master Bedroom : msg.payload0 : undefined

undefined

I dont have your full flow so I can only guess

Should that not be msg.payload?

1 Like

yes it is.

ok so see, i would have never looked then there cause while back i trying to trouble shoot my issues, i added 3 debugs and named them all different so i could differentiate the 3 outputs in my debug screen.

sadly i'm a tech by trade, so i'm use to troubleshooting stuff. but when i'm troubleshooting Greek and don't speak it i've been having my fair share of issues.

and with all that head scratching and the pacents of you amazing people i have something i can now try and produce a nice spash page for my home website.

i'm sorry i don't understand alot, and and soooooo very greatfull for people like your selves in this world.

2 Likes

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