Can you try to delete the self/NewPositionTest topic completely and publish again ?
I don't think you have answered that question. My supposition is that something is subscribed to that topic and is republishing NaN to it whenever it sees your publish.
Yeah, that is a good point actually.
Do you know how many devices are ..... connected to your network?
To follow Colin's idea, you reduce the number of devices down to where you maybe stop seeing the NaN
. That would support that theory.
Colin,
No application or machine is subscribe to local mqtt server.
I'm still in development so I don't have any app or client subscribed.
On my LAN there are 12 devices connect.
On my mqtt server only 2 but only in publish and they publish on a different topic stating with 'sensors/...'
Max
Yes, and I get that it is in development.
But if you can find who (or what) is causing this problem, you will be in good grace with the people who wrote it.
Just for the sake of trying: Only have what are needed for that part of the system to work on the network.
See if you do/don't get the NaN
problem.
If you do: well, game over. You can't do anything.
But if you don't:
Start connecting devices one by one and see when you get the NaN
error.
Shouldn't take too long to do.
@spidgrou I have two theories
- (like @colin's) is that something on your network or - if your MQTT device is connected to the outside world - on the outside world, is subscribed to your topic and returning a NaN
- at some point you published a
NaN
and it is retained and every time you publish to that topic, the retained message is being returned along with a current correct value.
You said: [quote="spidgrou, post:42, topic:31301"]
If I publish to the topic "vessels/xxxx" everything works well.
So it seems that only under "xxx/self/" I have a problem, that is the place where all the messages come from SignalK.
[/quote]
- Do you have a SignalK device as part of your system?
a) If so, is the SignalK device your MQTT broker?
b) If not, what device is your MQTT broker? - does the SignalK device connect to the outside world?
- In your topics you use
xxxx
andxxx
are those literal x's or is that where you put a unique ID that has been assigned to you?
Hi to everybody.
So this morning I did some more tests.
This is my setup:
- Raspberry Pi 3B+ with installed:
OpenPlotter 2.3.0
SignalK 1.32.0
Node-RED 1.1.2
MQTT Server unknown
2 serial connection from boat instruments
With this setup I switch off my lan and my router.
I configured the Raspberry as AP and I connect with my Win10PC to it.
No other device connected, everything shutting down.
All external devices with Mqtt publish are shutting down
There are no subscribtion to the Rasp Mqtt Server.
Test1:
[{"id":"69f2f30b.8bfd1c","type":"debug","z":"63b05b24.a7ac54","name":"Publish","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":180,"wires":[]},{"id":"e739c3f.162d74","type":"json","z":"63b05b24.a7ac54","name":"","property":"payload","action":"","pretty":false,"x":710,"y":140,"wires":[["8983dea4.522c5"]]},{"id":"8983dea4.522c5","type":"function","z":"63b05b24.a7ac54","name":"","func":"\n\nlat = msg.payload.latitude;\nvar convertLat = Math.abs(lat);\nvar LatDeg = Math.floor(convertLat);\nvar LatMin = ((convertLat - LatDeg) * 60).toFixed(3);\nvar LatCardinal = ((lat > 0) ? \"N\" : \"S\");\nnewlat = LatCardinal + \" \" + LatDeg + \"Ā°\" + LatMin;\n\nlon = msg.payload.longitude;\nvar convertLon = Math.abs(lon);\nvar LonDeg = Math.floor(convertLon);\nvar LonMin = ((convertLon - LonDeg) * 60).toFixed(3);\nvar LonCardinal = ((lon > 0) ? \"E\" : \"W\");\nnewlon = LonCardinal + \" \" + LonDeg + \"Ā°\" + LonMin;\n\nmsg.payload = { \n \"longitude\" : newlon,\n \"latitude\" : newlat\n}\nmsg.topic = \"pippo/pippozzo/pippuzzo\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":900,"y":140,"wires":[["69f2f30b.8bfd1c","75ea23e4.be5b1c"]]},{"id":"75ea23e4.be5b1c","type":"mqtt out","z":"63b05b24.a7ac54","name":"NewPosition","topic":"","qos":"0","retain":"false","broker":"a6ffbe0b.cb31d","x":1170,"y":120,"wires":[]},{"id":"e335a63e.d514f8","type":"inject","z":"63b05b24.a7ac54","name":"test","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"vessels/self/navigation/position","payload":"{\"longitude\":174.32633333333334,\"latitude\":-35.72366666666667}","payloadType":"str","x":460,"y":140,"wires":[["e739c3f.162d74"]]},{"id":"fe809ed0.c0201","type":"mqtt in","z":"63b05b24.a7ac54","name":"","topic":"pippo/pippozzo/pippuzzo","qos":"2","datatype":"auto","broker":"a6ffbe0b.cb31d","x":520,"y":240,"wires":[["596bb7ba.002ad8"]]},{"id":"596bb7ba.002ad8","type":"debug","z":"63b05b24.a7ac54","name":"Subscribe","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":260,"wires":[]},{"id":"a6ffbe0b.cb31d","type":"mqtt-broker","z":"","name":"Y2K","broker":"localhost","port":"1883","clientid":"NodeRedY2K","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
As before when I publish to a different topic that not include "vessels/self" it works fine, no NaN follow.
Test2:
[{"id":"7064e47b.6904dc","type":"debug","z":"63b05b24.a7ac54","name":"Publish","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":960,"y":460,"wires":[]},{"id":"6a5d904e.2f6cf","type":"json","z":"63b05b24.a7ac54","name":"","property":"payload","action":"","pretty":false,"x":510,"y":420,"wires":[["78b6d6c5.a6a908"]]},{"id":"78b6d6c5.a6a908","type":"function","z":"63b05b24.a7ac54","name":"","func":"\n\nlat = msg.payload.latitude;\nvar convertLat = Math.abs(lat);\nvar LatDeg = Math.floor(convertLat);\nvar LatMin = ((convertLat - LatDeg) * 60).toFixed(3);\nvar LatCardinal = ((lat > 0) ? \"N\" : \"S\");\nnewlat = LatCardinal + \" \" + LatDeg + \"Ā°\" + LatMin;\n\nlon = msg.payload.longitude;\nvar convertLon = Math.abs(lon);\nvar LonDeg = Math.floor(convertLon);\nvar LonMin = ((convertLon - LonDeg) * 60).toFixed(3);\nvar LonCardinal = ((lon > 0) ? \"E\" : \"W\");\nnewlon = LonCardinal + \" \" + LonDeg + \"Ā°\" + LonMin;\n\nmsg.payload = { \n \"longitude\" : newlon,\n \"latitude\" : newlat\n}\nmsg.topic = \"vessels/self/NewPositionTest\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":700,"y":420,"wires":[["7064e47b.6904dc","b540a74f.a290a8"]]},{"id":"b540a74f.a290a8","type":"mqtt out","z":"63b05b24.a7ac54","name":"NewPosition","topic":"","qos":"0","retain":"false","broker":"a6ffbe0b.cb31d","x":970,"y":400,"wires":[]},{"id":"397c53e9.db0d0c","type":"inject","z":"63b05b24.a7ac54","name":"test","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"vessels/self/navigation/position","payload":"{\"longitude\":174.32633333333334,\"latitude\":-35.72366666666667}","payloadType":"str","x":260,"y":420,"wires":[["6a5d904e.2f6cf"]]},{"id":"2d83f944.5113e6","type":"mqtt in","z":"63b05b24.a7ac54","name":"","topic":"vessels/self/NewPositionTest","qos":"2","datatype":"auto","broker":"a6ffbe0b.cb31d","x":330,"y":520,"wires":[["94eae700.95a4c8"]]},{"id":"94eae700.95a4c8","type":"debug","z":"63b05b24.a7ac54","name":"Subscribe","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":960,"y":540,"wires":[]},{"id":"a6ffbe0b.cb31d","type":"mqtt-broker","z":"","name":"Y2K","broker":"localhost","port":"1883","clientid":"NodeRedY2K","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
If I publish to a topic under "vessel/self/" there is a NaN that follow as the day before.
Test3:
I disconnect also the serial connection, so SignalK does not receive any information from outside.
Same result with NaN
Thanks
Max
As annoying as that is, it is good as it has established a better understanding of: from where the problem is.
So try to look at this as a good thing, as much as it kind of isn't.
Presumably nothing on the PC is publishing to that broker is it?
Otherwise I have to admit that is is becoming more and more difficult to think of any cause other than an issue with the mqtt broker. Are you able to install mosquitto on the pi and use that instead? On raspbian that is just a matter of installing it using apt
. You would also need to disable the current broker or tell mosquitto to use a non-standard port (which is simple).