question

sim-1 avatar image
sim-1 asked

"Virtual" Device, Data Fed via ModbusTCP/MQTT

Hi,

I have a SmartSolar PV controller connected to Venus Pi via VE.direct. I also have a control system that has MODBUS TCP client coded and I successfully communicate with Venus to read battery volts. This system also activates supplemental battery charger which provides data via proprietary protocol.

Goal: Consolidate the energy used by battery charger in one place with the data of the SmartSolar (PV power and load usage).

Is there a way to add a virtual device in Venus, preferably with holding (read and write) MODBUS registers that I can "feed" from my control system? I don't think my control system has a module to be MODBUS master, but if there was would that work?

Alternative could be via MQTT, but I am yeat to experiment with that.

Venus OS
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
matt1309 avatar image
matt1309 answered ·

Hi @Sim

I think this is what you're after:

howto add a driver to Venus · victronenergy/venus Wiki · GitHub

Here's an example script: velib_python/dbusdummyservice.py at master · victronenergy/velib_python · GitHub


I believe if you use a existing dbus path from below link that it setups up MQTT topics correctly for you.

dbus · victronenergy/venus Wiki · GitHub


I've never tried ModbusTCP but i imagine it's handled the same. Adding completely custom device might be a bit more involved, but i think it does cover that in the "how to add a driver to venus" link i shared above however I've never tried that.

I have used this for method for getting an old radio oil tank sensor into venus. I have a raspberry pi capture the radio frequency of the oil sensor then send it via mqtt into venus os which has a virtual tank sensor script installed using the method described above. The only change i needed to make to dummy script was service name change to

com.victronenergy.tank.tty01


2 |3000

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

Related Resources