0

Im developing a Volttron energy storage control agent and am attempting to perform a seemingly simple read of the battery's "state of energy" with this line

# read current SoE from battery system
result = self.vip.rpc.call(
    'platform.driver', 
    'get_point', 
    path='devices/STAC/SEDG_BESS',
    point_name='SEDGBatteryStateOfEnergy'
).get(timeout=5)

but I am getting the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "src/gevent/event.py", line 305, in gevent._gevent_cevent.AsyncResult.get
  File "src/gevent/event.py", line 335, in gevent._gevent_cevent.AsyncResult.get
  File "src/gevent/event.py", line 305, in gevent._gevent_cevent.AsyncResult.get
  File "src/gevent/event.py", line 305, in gevent._gevent_cevent.AsyncResult.get
  File "src/gevent/event.py", line 323, in gevent._gevent_cevent.AsyncResult.get
  File "src/gevent/event.py", line 303, in gevent._gevent_cevent.AsyncResult._raise_exception
  File "/home/pi/volttron/env/lib/python3.8/site-packages/gevent/_compat.py", line 66, in reraise
    raise value
volttron.platform.jsonrpc.RemoteError: builtins.KeyError('devices/STAC/SEDG_BESS')

I have 2 agents (listeneragent-3.3 & platform_driveragent-4.0) running in the main Volttron process:

(volttron) pi@raspberrypi:~/volttron $ vctl status
UUID AGENT                     IDENTITY                    TAG      STATUS          HEALTH
4 DeviceWriteAgentagent-0.1 DeviceWriteAgentagent-0.1_1                          
a actuatoragent-1.0         platform.actuator                                    
0 listeneragent-3.3         listeneragent-3.3_1         listener running [9856]  GOOD
3 platform_driveragent-4.0  platform.driver                      running [9857]  GOOD
d sqlhistorianagent-4.0.0   sqlhistorianagent-4.0.0_1  

and Im running my custom ESS controller agent in the VSCode debugger using all the settings specified in the Volttron Dev documention

I know the Platform Driver is running and connected to the ESS because I see it posting periodic scrapes of all the modbus registers to volttron.log. Here you can see one of these scrapes with the devices/STAC/SEDG_BESS device with a point named SEDGBatteryStateOfEnergy:

2022-08-25 11:53:20,237 (listeneragent-3.3 9856) __main__ INFO: Peer: pubsub, Sender: platform.driver:, Bus: , Topic: devices/STAC/SEDG_BESS/all, Headers: {'Date': '2022-08-25T17:53:20.083384+00:00', 'TimeStamp': '2022-08-25T17:53:20.083384+00:00', 'SynchronizedTimeStamp': '2022-08-25T17:53:20.000000+00:00', 'min_compatible_version': '3.0', 'max_compatible_version': ''}, Message: 
[{'SEDGACInverterPowerTotal': 3594,
  'SEDGACInverterPowerTotal_SF': 0,
  'SEDGACMeterPowerTotal': 3591,
  'SEDGACMeterPowerTotal_SF': 0,
  'SEDGBatteryStateOfEnergy': 31.998273849487305,
  'SEDGDCBatteryPower': 0.0,
  'SEDGDCInverterPowerTotal': 3648,
  'SEDGDCInverterPowerTotal_SF': 0,
  'SEDGRemote_Control_Charge_Limit': 6600.0,
  'SEDGRemote_Control_Command_Discharge_Limit': 6600.0,
  'SEDGRemote_Control_Command_Mode': 1,
  'SEDGRemote_Control_Command_Timeout': 3600,
  'SEDGStorage_AC_Charge_Limit': 6600.0,
  'SEDGStorage_AC_Charge_Policy': 1,
  'SEDGStorage_Backup_Reserved_Setting': 10.0,
  'SEDGStorage_Charge-Discharge_Default_Mode': 1,
  'SEDGStorage_Control_Mode': 4,
  'SEDGWrite_Remote_Control_Charge_Limit': 6600.0,
  'SEDGWrite_Remote_Control_Command_Discharge_Limit': 6600.0,
  'SEDGWrite_Remote_Control_Command_Mode': 1,
  'SEDGWrite_Remote_Control_Command_Timeout': 3600,
  'SEDGWrite_Storage_AC_Charge_Limit': 6600.0,
  'SEDGWrite_Storage_AC_Charge_Policy': 1,
  'SEDGWrite_Storage_Backup_Reserved_Setting': 10.0,
  'SEDGWrite_Storage_Charge-Discharge_Default_Mode': 1,
  'SEDGWrite_Storage_Control_Mode': 4},
 {'SEDGACInverterPowerTotal': {'type': 'integer',
                               'tz': 'UTC',
                               'units': 'Watts'},
  'SEDGACInverterPowerTotal_SF': {'type': 'integer', 'tz': 'UTC', 'units': ''},
  'SEDGACMeterPowerTotal': {'type': 'integer', 'tz': 'UTC', 'units': 'Watts'},
  'SEDGACMeterPowerTotal_SF': {'type': 'integer', 'tz': 'UTC', 'units': ''},
  'SEDGBatteryStateOfEnergy': {'type': 'integer', 'tz': 'UTC', 'units': '%'},
  'SEDGDCBatteryPower': {'type': 'integer', 'tz': 'UTC', 'units': 'Watts'},
  'SEDGDCInverterPowerTotal': {'type': 'integer',
                               'tz': 'UTC',
                               'units': 'Watts'},
  'SEDGDCInverterPowerTotal_SF': {'type': 'integer', 'tz': 'UTC', 'units': ''},
  'SEDGRemote_Control_Charge_Limit': {'type': 'integer',
                                      'tz': 'UTC',
                                      'units': 'Watts'},
  'SEDGRemote_Control_Command_Discharge_Limit': {'type': 'integer',
                                                 'tz': 'UTC',
                                                 'units': 'Watts'},
  'SEDGRemote_Control_Command_Mode': {'type': 'integer',
                                      'tz': 'UTC',
                                      'units': ''},
  'SEDGRemote_Control_Command_Timeout': {'type': 'integer',
                                         'tz': 'UTC',
                                         'units': 'Sec '},
  'SEDGStorage_AC_Charge_Limit': {'type': 'integer',
                                  'tz': 'UTC',
                                  'units': 'KW or % '},
  'SEDGStorage_AC_Charge_Policy': {'type': 'integer', 'tz': 'UTC', 'units': ''},
  'SEDGStorage_Backup_Reserved_Setting': {'type': 'integer',
                                          'tz': 'UTC',
                                          'units': '% '},
  'SEDGStorage_Charge-Discharge_Default_Mode': {'type': 'integer',
                                                'tz': 'UTC',
                                                'units': ''},
  'SEDGStorage_Control_Mode': {'type': 'integer', 'tz': 'UTC', 'units': ''},
  'SEDGWrite_Remote_Control_Charge_Limit': {'type': 'integer',
                                            'tz': 'UTC',
                                            'units': 'Watts'},
  'SEDGWrite_Remote_Control_Command_Discharge_Limit': {'type': 'integer',
                                                       'tz': 'UTC',
                                                       'units': 'Watts'},
  'SEDGWrite_Remote_Control_Command_Mode': {'type': 'integer',
                                            'tz': 'UTC',
                                            'units': ''},
  'SEDGWrite_Remote_Control_Command_Timeout': {'type': 'integer',
                                               'tz': 'UTC',
                                               'units': 'Sec'},
  'SEDGWrite_Storage_AC_Charge_Limit': {'type': 'integer',
                                        'tz': 'UTC',
                                        'units': 'KW or % '},
  'SEDGWrite_Storage_AC_Charge_Policy': {'type': 'integer',
                                         'tz': 'UTC',
                                         'units': ''},
  'SEDGWrite_Storage_Backup_Reserved_Setting': {'type': 'integer',
                                                'tz': 'UTC',
                                                'units': '% '},
  'SEDGWrite_Storage_Charge-Discharge_Default_Mode': {'type': 'integer',
                                                      'tz': 'UTC',
                                                      'units': ''},
  'SEDGWrite_Storage_Control_Mode': {'type': 'integer',
                                     'tz': 'UTC',
                                     'units': ''}}]

Here's the output of vctl config list platform.driver:

(volttron) pi@raspberrypi:~/volttron $ vctl config list platform.driver
config
devices/STAC/SEDG_BESS
registry_configs/SEDG_tk
registry_configs/SEDG_tk_map

Any idea what might be happening here? I've tried shutting Volttron down and restarting , but it has not seemed to help.

Thanks!

  • I'm just interpreting from the docs here. Have you looked at the registry configuration file to make sure that's the name you use to request that value? Just blue-skying it, for example, the public name MIGHT be "BatteryStateOfEnergy" which gets mapped to the name you see. – Tim Roberts Aug 25 '22 at 18:15
  • I think I'm referencing the right point name. It seems like the error im getting has more to do with the device name not being recognized, right? – jhthompson12 Aug 25 '22 at 18:35
  • @TimRoberts, sorry for the confusion, but I just made a small edit to my question where I updated the Traceback. I accidentally posted a traceback from something I was trying while troubleshooting – jhthompson12 Aug 25 '22 at 18:42
  • Yes. Notice the log mentions `/all`. Perhaps you need to specify an instance, like `/0`. – Tim Roberts Aug 25 '22 at 19:01
  • @TimRoberts I guess I dont fully understand the suggestion. If I try: `self.vip.rpc.call('platform.driver', 'get_point', path='devices/STAC/SEDG_BESS/all', point_name='SEDGBatteryStateOfEnergy').get(timeout=5)` I get a similar error: `volttron.platform.jsonrpc.RemoteError: builtins.KeyError('devices/STAC/SEDG_BESS/all')` – jhthompson12 Aug 25 '22 at 19:04
  • The error log `volttron.platform.jsonrpc.RemoteError: builtins.KeyError('devices/STAC/SEDG_BESS')` suggests that this device name (i.e. path) was not mapped to a driver, which should have happened in the PlatformDriver [here](https://github.com/VOLTTRON/volttron/blob/main/services/core/PlatformDriverAgent/platform_driver/agent.py#L380). Can you run `vctl config list platform.driver`? This will list all the device names (i.e. paths) installed. Use that list to ensure that the device name that you are using in the get_point rpc call (i.e. path='devices/STAC/SEDG_BESS') does exist on PDriver. – bonicim Aug 25 '22 at 20:53
  • @bonicim, yes, that device is in fact installed in the platform.driver: `(volttron) pi@raspberrypi:~/volttron$ vctl config list platform.driver config devices/STAC/SEDG_BESS registry_configs/SEDG_tk registry_configs/SEDG_tk_map ` Sorry, it's a very awkward trying to post that output in a comment here without the ability to add new lines – jhthompson12 Aug 25 '22 at 22:23
  • @bonicim, I added the output to the end if the question above to make it easier to read. Thanks! – jhthompson12 Aug 25 '22 at 22:29

1 Answers1

0

Changing the device path from
'devices/STAC/SEDG_BESS'
to
'STAC/SEDG_BESS'
did the trick!

This is a bit confusing as I was referencing this documentation for get_point which shows the "devices/" prefix on the path parameter:
enter image description here

  • You are right about the documentation being confusing. The root cause of this bug is that PlatformDriver(PD) does not store a device topic in its original form; rather, it modifies the device topic and uses that modified topic as the device topic. For example, while your topic is 'devices/STAC/SEDG_BESS', the PD will modify that topic as 'STAC/SEDG_BESS' via this [helper method](https://github.com/bonicim/volttron/blob/develop/services/core/PlatformDriverAgent/platform_driver/agent.py#L338). – bonicim Aug 26 '22 at 18:45