Victron - checking mqtt connection fails to Cerbo?

Hi,
this will be only for Victron users I think.
Checking to ioBroker works fine, checking to Cerbo not? hmmm...
all the same, both Broker, just different IP's


[{"id":"570d4cc3075a1235","type":"function","z":"eb90043507471fd3","name":"function 1","func":"//node.warn(msg);\nmsg.payload=msg.mqttCheck.connected;\nglobal.set(\"IOBROCKER\",msg.payload);\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":760,"wires":[["29477b43e4751e19","23ac7562c63e060e","6617b0118aa20554"]]},{"id":"21abb6759719d4c6","type":"inject","z":"eb90043507471fd3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"60","payloadType":"num","x":90,"y":760,"wires":[["8e89d05a61029721","46d38e7090959db3"]]},{"id":"29477b43e4751e19","type":"ui_led","z":"eb90043507471fd3","order":7,"group":"87bec2adb627ff2b","width":0,"height":0,"label":"ioBroker","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":670,"y":760,"wires":[]},{"id":"8e89d05a61029721","type":"mqtt-check","z":"eb90043507471fd3","host":"192.168.0.20","port":"1883","username":"","password":"","name":"ioBroker","x":260,"y":760,"wires":[["570d4cc3075a1235"]]},{"id":"46d38e7090959db3","type":"mqtt-check","z":"eb90043507471fd3","host":"192.168.0.191","port":"1883","username":"","password":"","name":"Cerbo ESS","x":270,"y":900,"wires":[["2dbf4c3aaca5b3a4"]]},{"id":"2dbf4c3aaca5b3a4","type":"function","z":"eb90043507471fd3","name":"function 2","func":"//node.warn(msg);\nmsg.payload=msg.mqttCheck.connected;\nglobal.set(\"CerboESS\",msg.payload);\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":900,"wires":[["8f22968f2c24f30d","4bda5d99696cc99d","7698da355613f91c"]]},{"id":"8f22968f2c24f30d","type":"ui_led","z":"eb90043507471fd3","order":7,"group":"87bec2adb627ff2b","width":0,"height":0,"label":"Cerbo ESS","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":670,"y":900,"wires":[]},{"id":"4bda5d99696cc99d","type":"debug","z":"eb90043507471fd3","name":"debug 9","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":680,"y":940,"wires":[]},{"id":"23ac7562c63e060e","type":"debug","z":"eb90043507471fd3","name":"debug 10","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":680,"y":800,"wires":[]},{"id":"6617b0118aa20554","type":"function","z":"eb90043507471fd3","name":"daten speichern","func":"msg.topic=\"ioBroker_Alive\";\nmsg.payload=msg.payload;\nglobal.set(msg.topic,msg.payload);\nreturn;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":720,"wires":[[]]},{"id":"7698da355613f91c","type":"function","z":"eb90043507471fd3","name":"daten speichern","func":"msg.topic=\"CerboESS_Alive\";\nmsg.payload=msg.payload;\nglobal.set(msg.topic,msg.payload);\nreturn;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":860,"wires":[[]]},{"id":"87bec2adb627ff2b","type":"ui_group","name":"Verbindungen","tab":"59dfca41f4417c9d","order":4,"disp":true,"width":"6","collapse":false,"className":""},{"id":"59dfca41f4417c9d","type":"ui_tab","name":"CERBO BAT","icon":"dashboard","disabled":false,"hidden":true}]

only allowed of 2 attachements ....

function node:

Code is always best pasted as text (in a code block) as it is searchable and anyone willing to help doesn't have to retype it

I use "performatted text" how do I get just one line out?

For code?
In the Export dialog, click the "JSON" tab and "compact" button.

1 Like

no one here on Victron, maybe the mqtt-check must set something different?

Maybe/maybe not.

It is not clear what you are asking I'm afraid.

What is it you are trying to do?

What is "Cebro"?

What kind of node are those bright green nodes?

Are you getting data? Is it not what it is supposed to be?

Where is node-red running? On a raspberry pi? On a hardware device? In docker? Windows? Linux? What versions?

Are you seeing errors in the console? Show us if you are.


If you simply want to publish/subscribe to MQTT, use the built in MQTT nodes.

if you do not have Victron devices, you will not be able to comprehend the problem

If you don't answer the questions, will anyone comprehend? :person_shrugging:

I can try to help (I have 25y+ industrial engineering, system integration, industrial protocols, programming multiple languages/hardware/robots/modbus/PLCs etc etc) but if you dont want help from someone that doesn't know victron, then thats fine also.

Well, that mqtt-check Library is more than 4 years old. maybe/definitely things have changed inside NR since then.
Edit: or its a problem with the mqtt Broker installation on the Cerbo...just remember that the broker has been changed to fastmq in the latest firmware.

But I can confirm your Issue...a connection to a victron Cerbo GX, although native mqtt nodes work fine, gives a false response with that mqtt-check library.

...you need to contact the developer of that library in order to have it fixed.

Edit: IMHO the status of the NR mqtt-node should be checked and not just a seperate connection to a remote Broker....that library is useless, as you can see NR itsself works fine with a Cerbo GX.

1 Like

You gave me a clue that the OP didnt bother to - in that the green node is a node called node-red-contrib-mqtt-connection-check

Had the OP bothered to answer any of the questions I would have told them it uses a severely outdated version of mqtt (which likely has CVEs against it) and that all it does internally is make a new connection to the broker.

The problems it has are numerous - for example many mqtt brokers expect a client ID (this does not permit that) or they are expecting MQTT v5 connection (again it does not support it), or they require SSL (guess what, it doesnt support SSL) - I could go on!

If the OP wants to know if the connection is good, they can use a status node pointed at a regular MQTT node. If the OP wants an end-to-end check that the MQTT broker is alive, then simply subscribe to a topic then publish to the same topic - if you get a reply, it is connected. there are other solutions too, but thats all I have the energy to state right now.

so in essence, this issue had nothing at all to do with victron! Go OP.

2 Likes

Exactly...maybe this is more of what OP is looking for: Best way to check the connected state of an MQTT node before publishing? - #6 by Colin

2 Likes