Hello @tux21,
This looks good, so we can continue
However, I have a few questions, if I look to your screenshots.
1. In the 1st screenshot, I see that you have 2 MQTT Client Gateways with LAN interface installed.
The first one, with IDX 9 and called "victron" is connected with the MQTT broker on IP Address 192.168.31.68.
I assume that this is the Victron broker. But Domoticz is not directly communicating with this broker.
You can use it, but you have also a second interface, called "mqtt", with IP Address 192.168.31.148.
Is there a MQTT broker running on this address? If Yes, which one (Mosquitto?)
2. In your 2nd screenshot, I see the published topics on the Victron broker.
What does domoticz show? Click on the arrow, so that the tree opens.
3. In the 3rd screenshot I see a Victron node presenting the Battery Voltage (as a number).
It presents the Voltage with 15 (!) digits after the decimal point. I suggest that we reduce this to 2 digits.
Otherwise it will not look nice in the Domoticz widget.
Below you will find an example, how to handle this battery voltage.
You can do the same with the other Victron nodes, but keep in mind that some might not work.
See the links in the previous posts.
Okay, let 's start.
1. Create a new "Hardware" device, called e.g. Victron of the type "Dummy (Does nothing, use for virtual switches only)".
2. Create a new device of the type "Voltage" and give it a name, you like, e.g. "Victron Battery".
3. If you go to:
https://piandmore.wordpress.com/2019/02 ... -domoticz/ or
https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s, you will find that the required syntax for a "Voltage" sensor is:
{"command":"udevice", "idx":1234, "svalue":"3.45"}
The voltage sensor will show voltage of something. You can add digits after the decimal if needed.
As you will see the value is presented after "svalue". This is a string.
So we have to convert the Voltage (number) to a string.
2. Drag and drop a "Function" node to the canvas and connect the input of the "Function" to the output of the "Victron" node.
The contents of the "Function"node is as follows:
Code: Select all
msg.payload = {"command":"udevice","idx":12,"nvalue":0,"svalue":msg.payload.toFixed(2).toString()};
return msg;
The elements in this object are:
- "command":"udevice" ; This is a default value and may be left out.
- "idx":12; This is the IDX of the device, you created previously. Change it to your device number.
- "nvalue":0; Just for completeness. May be removed.
- "svalue":msg.payload.toFixed(2).toString(); The important part.
Function toFixed(2) is responsible for 2 digits after the decimal point. You can change the number, if you want more or less digits.
Function toString() converts the numerical value to the string value.
Let 's look to the result. (I simulate the Victron node with the "Inject" node)

- Screenshot_victron1.png (33.42 KiB) Viewed 6575 times
This will result in Domoticz to:

- Screenshot_victron2.png (39.25 KiB) Viewed 6575 times
You have to configure your MQTT out node to your settings (It depends on which one, you use)
The message should be published to domoticz/in

- Screenshot_victron3.png (20.58 KiB) Viewed 6575 times
Please find the complete flow (excluding the Inject node) below:
Code: Select all
[{"id":"db4f012.1fb0f","type":"debug","z":"4137f1f8.cf269","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":120,"wires":[]},{"id":"16dc3c48.4c0c1c","type":"function","z":"4137f1f8.cf269","name":"","func":"msg.payload = {\"command\":\"udevice\",\"idx\":12,\"nvalue\":0,\"svalue\":msg.payload.toFixed(2).toString()};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":180,"wires":[["332aeeb.adb9092","f803b251.5c6ff8"]]},{"id":"332aeeb.adb9092","type":"debug","z":"4137f1f8.cf269","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":120,"wires":[]},{"id":"f803b251.5c6ff8","type":"mqtt out","z":"4137f1f8.cf269","name":"To Domoticz","topic":"domoticz/in","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":1230,"y":180,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
If everything is functioning correct remove the (green) debug nodes.
Regards and let me know.