I have the following code below, the callback track(conn, value) should be called when the "/Ac/Consumption/L1/Power" value changes ie property changes, bit it does not get called, anybody that can tell me why?
#!/usr/bin/python -u
from functools import partial
import dbus
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
def track(conn, value):
if value["Value"] > 0:
print("Yes")
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="/Ac/Consumption/L1/Power",
bus_name="com.victronenergy.system")
GLib.MainLoop().run()
if __name__ == "__main__":
main()
I am running this on VenusOS 2.80~41-large-25
I am debugging the code from VS Code inside my MAC connected to my Cerbo GX device via SSH