question

yuharla avatar image
yuharla asked

Switch On/Off Multiplus with MQTT and Venus Gx

hello everybody,

I have actually an multiplus 12/1600/70-16 plug to my Venus GX.

I want to switch ON/OFF the multiplus thank a request MQTT.

Actually i read all data from MQTT. but i don't find information to switch on/off the multiplus with a MQTT command line.

Somebody can help me?

Multiplus-IIVenus GX - VGXMQTT
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
gone-sailing avatar image
gone-sailing answered ·

I've done this. The topic is W/<portal ID>/vebus/257/Mode to set the state. There are 4 states that you set with a json object with value an attribute e.g. {"value":1}, 1=Charger Only;2=Inverter Only;3=On;4=Off. To read the current state you need to subscribe to N/<portal ID>/vebus/257/Mode and then send a read request by posting an empty message to topic R/<portal ID>/vebus/257/Mode.

Update:
Anybody reading this should familiarise themselves with Victron's dbus-mqtt gateway by reading this: https://github.com/victronenergy/dbus-mqtt

6 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

lasho avatar image lasho commented ·
Hi @gone-sailing , On my side I have managed to get this working from my laptop. But it seems when using this via an MQTT Client on my android phone, it doesn't seem to update the value accordingly. From "On" to "Charger Only" (Value 1), it doesn't seem to update.


Strange enough, I can subscribe to a topic and read the value easily from the same android phone. I am wondering what am i missing. Would you perhaps know?


Thanks

0 Likes 0 ·
gone-sailing avatar image gone-sailing lasho commented ·
There is no logical reason why the Mqtt broker on the GX device would treat your android device any different to your laptop. It’s more like a programming error. Are you sure you used the correct topic and payload?
0 Likes 0 ·
lasho avatar image lasho gone-sailing commented ·

Hi @gone-sailing , thanks for the response.


I have attached screenshots of my writes/published code.

My request looks something like this:

topic: W/<portal_id>/vebus/276/Mode

Publish: W/<portal_id>/vebus/276/Mode' -m '{"value":1}'

I have tried with "R" and with "N" as a topic. Not really sure if that makes a difference, don't understand it too well. From Windows (gitbash), my mosquitto_pub.exe command is as follows:

./mosquitto_pub.exe -t 'W/<portal_id>/vebus/276/Mode' -m '{"value":1}' -h mqtt73.victronenergy.com -u USER -P PASSWORD--cafile "<PATH_TO_CA_FILE>" -p 8883

I'm not sure what is the payload you mentioned, could this be perhaps what I'm missing?

Any help is appreciated.

MSG_OK.jpgPUBLISH_VALUE_1.jpgVALUE_AFTER.jpgWRITE_DETAILS.jpg

0 Likes 0 ·
msg-ok.jpg (37.2 KiB)
publish-value-1.jpg (49.2 KiB)
value-after.jpg (31.7 KiB)
write-details.jpg (57.0 KiB)
gone-sailing avatar image gone-sailing lasho commented ·

The payload (as I would call it) is the actual message you are sending to the topic. From the command line you specify it with the -m option. The contents of your message is {"value":1}
Looking at your screenshot write-details.jpg, where the app want you to specify the topic name you have include the topic name followed by -m and the message. I very much doubt that is what the Android app is expecting. There must be another field somewhere on that page where you can enter the message to send. You do not use the -m with the app, that is just an option for the command line tool.

0 Likes 0 ·
gone-sailing avatar image gone-sailing lasho commented ·

Your subscribe topic is not correct either. Topic's starting with R are where you send read requests, the actual values are returned in the topics starting with N. Come to think of it, unless your app will periodically send the keep alive messages that Victron's dbus-mqtt api requires, you will only receive updates for about the first minute.

You really need to read this: https://github.com/victronenergy/dbus-mqtt

0 Likes 0 ·
lasho avatar image lasho gone-sailing commented ·

Hi Guys, @gone-sailing / @andre.holgersson@callisto.nu .

Thanks for the assistance, managed to successfully publish and get the value updated as expected.

As you mentioned, my publish topic was incorrect. The "-m '{"value":1}" piece of code is not supposed to be in the publish field in the app. Instead it needs to be inside a "payload" or "value" field somewhere in the app.

In my case it was in a "value" field (as it was a toggle switch tile as shown in the screenshot in my previous post).

I can now start looking at updating other values like Battery SOC etc.

Many many thanks for valuable information, much appreciated guys :-)

0 Likes 0 ·
andreholgersson avatar image
andreholgersson answered ·

Have you tried to encapsulate the value in double quotes? Like this: '{"value":"1"}'

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

lasho avatar image lasho commented ·
Hi @andre.holgersson@callisto.nu ,


Thanks for the response. Yes, tried adding double quotes as well as played around with the spacing and double quotes. Still doesn't seem to accept the updated value.
Am I supposed to receive a JSON response after the update to confirm the value is changed or does an update return no response?

Thanks again.

0 Likes 0 ·