Gps dashboard for live location

Thanks @Steve finally got it right.Now to show on map connecting it to a worldmap node.



@steve what all properties need to be set inorder to see it on map pls guide me through?
i opened a new tab for viewing it -http://127.0.0.1:1880/worldmap
but in that it shows some different location

@steve am i doing something wrong because this mesaage is showing along with other messages in debug sidebar
image

image
i have selected as string.should i change it to something else?

Please show us how you have configured the Change node.

The error tells us you are trying to set a property under msg.payload.name - but we can see that msg.payload.name is a String type and Strings cannot have properties.

I am sending u my flow flows.json (5.1 KB)

Do you understand what the flow is doing? Take a step back and step through what you have.

When a message arrives at the MQTT node you are splitting the flow into two for some reason. That means you now have two messages to deal with.

The top branch you pass to a Function node which parses msg.payload as a JSON string, and then sets msg.payload to the data property and passes it on.

The next two nodes, base64 and buffer-parser are doing some decoding of that data. I assume that's right as I don't know what the value it receives is.

You then pass it to a change node that sets msg.payload.name to the value "apple" and passes it to the worldmap node. Given you've shown that works, then great.

However, you have, for some reason, added a second Function node connected to the MQTT node. That Function node is parsing msg.payload and setting msg.payload to the value of the name property of the received MQTT message. You then pass that to the Change node which tries to set msg.payload.name of the string value and you get the error.

The issue is you have split the flow at the very start. Rather than have one message passing through, you have two messages.

I assume your goal is to use the name property in the original MQTT message as the name property you pass to the worldmap node alongside the values from the data property.

If so, then delete that second Function node and change the top Function node to:

var t=JSON.parse(msg.payload);
msg.name = t.name;
msg.payload=t.data;
return msg;

Then modify the Change node to set msg.payload.name to the value of msg.name.


Now this is the output after modification

Look again at the Change node.

It looks like you have it configured to set msg.name. That is wrong. You want it to be setting msg.payload.name to the value of msg.name - I suspect you have got those two the wrong way around.

Now i have made corrections pls check

Why have you added an extra wire from the Function node to the Change node? That was not something I said to do. Delete that wire.

yes deleted but output is still the same without name property in it

Please add a Debug node wired to the Buffer Parser node output, and configure the node to "show complete msg object" - then show us the output. Make sure you full expand the message in the debug sidebar so we can see all of it.



here you go

Before we go any further... please look at your original screenshot
image
neither of those values look very reasonable - either 0,0 is in the middle of the ocean off Africa... and lon cannot be greater that 180 so anything with e+28 will be wrong. So you need to fix your conversion or original data.


i have placed gps in the right place.and it is showing the correct coordinates now on mobile app.Now it will not be a problem for us.

OK - I can understand the 0,0 if you have no signal (eg indoors) - but the 1.5 e+28 makes no sense.
Those latest ones are even worse -
image
Again they will never appear on a map.

So yes -- I think the change node is probably now ok - (if you now move the debug to after the change node to check) and we should have a payload with a lat lon and name... - but until the decoder sends out sensible values they will never plot ok.

@dceejay i have placed gps on terrace and checked the coordinates it show correct.


but these are latest values in node red which do not match
lon--2.5547601597923975e-24
lat--2.3314581873174617e-17

indeed - so the buffer parser is wrong. Was it ever working ?
I thought that was your other thread ?

i don't understand about other thread?so you are saying buffer parser is not working properly but all others including you said to use it.do u have some fix?

The buffer parser "was" setup and working as follows...

According to the PDF with sample data you could so this...

which matches this...
image

using buffer parser set as per the info you provided...

Link to thread

however

The values still need some math as per the PDF
For example, you can clearly see from the screenshots above, we correctly make the values
lat: 5007.4965 and lon:838.1157 just like in the screenshot of your documentation
NOTE however that is not the end of the work - you need to apply the maths it states to turn those into usable coordinates.

So, to progress this, you could add a function node AFTER the buffer-parser and perform the necessary maths on msg.payload.lat and msg.payload.lon to make usable coordinates.

the buffer parser is a good node - but has to be configured correctly to decode your binary data - from your other thread- - Creation of Function Node

(edit) _ Ah Steve arrived... thanks... -- ^^^

PS - maybe don't need a function... just use your new scaling capability to / 100 ?

1 Like