In this post I will show how I control external relays from the Venus GX.
I use the Sonoff 4CH Pro with the Tasmota firmware for my installation.
As an example I have created a python script that turns on Relay 2 on the Sonoff if the battery voltage drops below 24.5V. The ip_address in the script is that of the Sonoff.
The attached video shows this in action when I turn on a load to force the voltage below 24.5V.
Python script:
#!/usr/bin/python -u from functools import partial import dbus from dbus.mainloop.glib import DBusGMainLoop import gobject import urllib2 ip_address = "192.168.1.9" def track(conn, value): if value["Value"] < 24.5: response = urllib2.urlopen('http://%s/cm?cmnd=Power2%%20ON' % ip_address) def main(): DBusGMainLoop(set_as_default=True) conn = dbus.SystemBus() conn.add_signal_receiver(partial(track, conn), dbus_interface='com.victronenergy.BusItem', signal_name='PropertiesChanged', path="/Dc/Battery/Voltage", bus_name="com.victronenergy.system") gobject.MainLoop().run() if __name__ == "__main__": main()
Hope this was useful.
Video: https://www.dropbox.com/s/gzetzcujomniedl/2020-04-30%2018.25.29-1.mp4?dl=0
Tasmota firmware: https://github.com/arendst/Tasmota
How to flash custom firmware on the Sonoff: https://youtu.be/UDnNI5wkNNY