question

james-ftp avatar image
james-ftp asked

Victron d-bus api - list connected products?

Hi,

When using the victron dbus api, is there a way to list the products connected to the system? I.e. for addresses of products in the form "com.victronenergy.[product type].[tty name]" or ''com.victronenergy.[product type].[interface]_di[device instance]_uc[unique-number]'', if we don't know the tty name or identifier of a product before hand, is there a way to display/discover them?

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.

2 Answers
mfriedel avatar image
mfriedel answered ·

Take a look at the dbus-spy.

2 |3000

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

laurenceh avatar image
laurenceh answered ·

Looking at the dBus tool:

dbus -y com.victronenergy.system / GetValue

I think this lists the connected services that are being published on the dBus

It certainly lists the extra service my code is publishing to the dBus like this

 'AvailableTemperatureServices': {
         'com.victronenergy.temperature/23/Temperature': 'Generic Temperature Input on Temperature sensor input 1',
         'com.victronenergy.temperature/24/Temperature': 'Generic Temperature Input on Temperature sensor input 2',
         'com.victronenergy.temperature/25/Temperature': 'Encased i2c AM2315 on i2c device 1',
         'com.victronenergy.temperature/26/Temperature': 'Custard Pi-3 8x12bit adc on Temperature sensor input 3',
         'com.victronenergy.temperature/27/Temperature': 'Custard Pi-3 8x12bit adc on Temperature sensor input 4',
         'com.victronenergy.temperature/28/Temperature': 'Custard Pi-3 8x12bit adc on Temperature sensor input 5',
         'default': 'Automatic',
         'nosensor': 'No sensor'},

I'm pretty certain as more devices are connected their service paths will be published on the dBus in this and other lists, I can see details for the following on my test system with nothing connected:

'AvailableBatteries': 
'AvailableBatteryMeasurements': 
'AvailableBatteryServices': 
'AvailableTemperatureServices': 

Sadly it does not pick up my i2c 'Humidity service'

'com.victronenergy.temperature/25/Humidity': ''Encased i2c AM2315 on i2c device 1'

So it seems it does not add everything only the things it knows to look for.

There is also a service mapping however it does not seem to map many services:

'ServiceMapping/com_victronenergy_settings_0': 'com.victronenergy.settings',
 'ServiceMapping/com_victronenergy_temperature_23': 'com.victronenergy.temperature.builtin_adc5_di0',
 'ServiceMapping/com_victronenergy_temperature_24': 'com.victronenergy.temperature.builtin_adc3_di1',
 'ServiceMapping/com_victronenergy_temperature_25': 'com.victronenergy.temperature.i2c_id00',
 'ServiceMapping/com_victronenergy_temperature_26': 'com.victronenergy.temperature.RPi_adc0_id00',
 'ServiceMapping/com_victronenergy_temperature_27': 'com.victronenergy.temperature.RPi_adc1_id01',
 'ServiceMapping/com_victronenergy_temperature_28': 'com.victronenergy.temperature.RPi_adc7_id02',

As these are all on the dBus you can write python scripts that will extract the relevant data and use it when creating python objects to attach to particular services.

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.

jeroen avatar image jeroen ♦ commented ·

dbus -y without any arguments will list all available services.

0 Likes 0 ·

Related Resources