question

mfriedel avatar image
mfriedel asked

Problems with multiple DBus instances in single app since e venus OS 2.80

Background.

I have driver that uses a shared connection for multiple devices.

It is one driver instance with the connection that registers multiple devices/services.

It has been working fine in 2.7x.

The code is in python, and when I instantiate the Service I use the private=True to force separate instances of the bus connection.

self._dbusconn = bus or (dbus.SessionBus() if 'DBUS_SESSION_BUS_ADDRESS' in os.environ else dbus.SystemBus(private=True))


If I have 1 instance this works fine, it also works for 2.. but for 3 or more it creates some interesting problems.

Updates to the bus still work, but all other paths disappear on the bus.

So for example

/Mgmt/Connection


disappears


/State


and others I update stick around.


Not sure where the problem lies yet. Could be the python bindings to the dbus library (changes for switch to python3).


Any ideas are welcome


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.

3 Answers
bathnm avatar image
bathnm answered Ā·

You might want too take a look at your code and the latest velib_python. There has been a change to the way things work. They have moved from a model referred to as dictupdates to a new model called ItemsChanged. I do not know if this change is impacting your code.

Maybe take a look at a few of the Victron python services to check, and a close look at release notes or beta release notifications within the forums.

2 |3000

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

henne avatar image
henne answered Ā·

I also want to create multiple instances, could you share your code how to create multiple ? I have seen your previous post on the problem, but I'm not sure where to put the Private=True element? Also have you been able to fix it in 2.80? Thank you

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.

bathnm avatar image bathnm commented Ā·
@henne you might want too check out this dBus-API wiki page. Specifically the section on VRM Device Instance.
0 Likes 0 Ā·
henne avatar image
henne answered Ā·

I got this working now

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