question

crichmon avatar image
crichmon asked

What data is available from Smart Shunt

I've got a Smart Shunt hooked to an RPi running VenusOS 3.31. I'm working setting up mqtt, but I don't know where to find the list of mqtt topics available.

In python, using the paho.mqtt.client, I've got this code:
while True:

my_comms.mqtt_client.publish("R/%s/keepalive" % unit_ID)

time.sleep(2)

my_comms.mqtt_client.subscribe("#", qos=2)

This is what I'm getting:

router1_/home/crichmon/python> lib/victron_mqtt.py

victron_mqtt INFO Main of victron_mqtt

hostname: router1

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/system/0/Serial : b'{"value":"b827ebbc2c00"}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/system/0/Timers/TimeOff : b'{"value":343900}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/heartbeat : b'{"value":1717355223}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/heartbeat : b'{"value":1717355226}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/heartbeat : b'{"value":1717355229}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/heartbeat : b'{"value":1717355232}'

victron_mqtt INFO mqtt_message: N/b827ebbc2c00/system/0/Timers/TimeOff : b'{"value":343910}'

etc.

I saw in one post about providing a list of topics to pass with the keepalive message, but again, no idea what to put in the list for the Smart Shunt, or any of the other Victron products. I'll also be getting an mppt charge controller and an inverter at some point.

Thx, Chris

SmartShunt
2 |3000

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

1 Answer
crichmon avatar image
crichmon answered ·

So, after messing around with this for quite a while, I found what looked like a list of mqtt topics in /opt/victronenergy/vrmlogger/datalist.py
Then more messing around with the payload for the keepalive, I've boiled it down to requesting just: topics.append("battery/+"), which still results in a flood of several hundred unique parameters and values (many with null or 0 as values). So, with some filtering of the results I think I have the list of valid values from the Smart Shunt. So, problem solved for me at the moment. I can share the code, but on it's own, the small library is out of context.

If this sort of thing was previously documented, I couldn't find it, but I did reference:
https://community.victronenergy.com/questions/141467
https://community.victronenergy.com/questions/141235
to give credit where credit is due.

Chris

PS: this is what I'm left with:
$topic_regex [battery]
 matched: battery        : N/b827ebbc2c00/battery/288/Dc/0/Power                   b'{"value":-1.3320000171661377}'
 matched: battery        : N/b827ebbc2c00/battery/288/ProductName                  b'{"value":"SmartShunt
 matched: battery        : N/b827ebbc2c00/battery/288/Connected                    b'{"value":1}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/AutomaticSyncs       b'{"value":1}'
 matched: battery        : N/b827ebbc2c00/battery/288/Mgmt/ProcessVersion          b'{"value":"3.82"}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/LastDischarge        b'{"value":-2.5999999046325684}'
 matched: battery        : N/b827ebbc2c00/battery/288/Dc/0/Current                 b'{"value":-0.10000000149011612}'
 matched: battery        : N/b827ebbc2c00/battery/288/FirmwareVersion              b'{"value":1046}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/DeepestDischarge     b'{"value":-65.19999694824219}'
 matched: battery        : N/b827ebbc2c00/battery/288/ConsumedAmphours             b'{"value":-2.700000047683716}'
 matched: battery        : N/b827ebbc2c00/battery/288/Serial                       b'{"value":"HQ2227KKW6P"}'
 matched: battery        : N/b827ebbc2c00/battery/288/DeviceInstance               b'{"value":288}'
 matched: battery        : N/b827ebbc2c00/battery/288/CustomName                   b'{"value":""}'
 matched: battery        : N/b827ebbc2c00/battery/288/ProductId                    b'{"value":41865}'
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/DeviceInstance     b'{"value":288}'
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/ProductId          b'{"value":41865}'
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/ServiceName        b'{"value":"com.victronenergy.battery.ttyUSB0"}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/TotalAhDrawn         b'{"value":-67.9000015258789}'
 matched: battery        : N/b827ebbc2c00/battery/288/Soc                          b'{"value":99.0999984741211}'
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/ProductName        b'{"value":"SmartShunt
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/CustomName         b'{"value":""}'
 matched: battery        : N/b827ebbc2c00/battery/288/TimeToGo                     b'{"value":863999.9375}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/MaximumVoltage       b'{"value":14.699999809265137}'
 matched: battery        : N/b827ebbc2c00/battery/288/Mgmt/ProcessName             b'{"value":"vedirect-dbus"}'
 matched: battery        : N/b827ebbc2c00/battery/288/Mgmt/Connection              b'{"value":"USB"}'
 matched: battery        : N/b827ebbc2c00/battery/288/Devices/0/FirmwareVersion    b'{"value":1046}'
 matched: battery        : N/b827ebbc2c00/battery/288/History/MinimumVoltage       b'{"value":13.25}'
 matched: battery        : N/b827ebbc2c00/battery/288/Dc/0/Voltage                 b'{"value":13.319999694824219}'


2 |3000

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