BAC0 icon indicating copy to clipboard operation
BAC0 copied to clipboard

KeyError exception when reading 'all' properties with show_property_name=True

Open laurentderu opened this issue 4 months ago • 0 comments

When I'm doing the following request go read all the properties of an object instance :

network = BAC0.connect(...)
request = f"{self.device.address}:{self.device.port} {object_type} {object_instance} all"
print("REQUEST", request)
network.readMultiple(request, show_property_name=True)

I get a KeyError exception :

REQUEST 10.2.1.1:47808 analogInput 20 all
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:['10.2.1.1:47808', 'analogInput', '20', 'all']
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:###################################
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:# Read Multiple
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:###################################
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:['10.2.1.1:47808', 'analogInput', '20', 'all']
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:###################################
DEBUG:bacpypes.task:FunctionTask > (RuntimeError('timeout'),) {}
DEBUG:bacpypes.task:    - task: ._FunctionTask object at 0x129ea15b0>
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:iocb                 
DEBUG:bacpypes.iocb._statelog:2481.005726 10.2.1.1 idle
DEBUG:bacpypes.iocb._statelog:2481.005856 10.2.1.1 active
DEBUG:bacpypes.iocb._statelog:2481.065153 10.2.1.1 idle
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:==================================================================================================================
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:'analogInput' : 20
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:==================================================================================================================
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:propertyIdentifier   propertyArrayIndex   value                          datatype            
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:------------------------------------------------------------------------------------------------------------------
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:'objectIdentifier'   None                 ('analogInput', 20)            
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:'objectName'         None                 "H'HCMxCrt10'TFl"              
DEBUG:BAC0_Root.BAC0.scripts.Lite.Lite:'objectType'         None                 'analogInput'                  
KeyError: 'AnalogInputObject'
File "/Users/ld/git/mapiu/mapiu-ae/dmway/plugins/bacnet/bacnet.py", line 268, in run
    await action.execute(self.logger)
  File "/Users/ld/git/mapiu/mapiu-ae/dmway/plugins/bacnet/bacnet.py", line 83, in execute
    response = await self.do_execute(logger)
  File "/Users/ld/git/mapiu/mapiu-ae/dmway/plugins/bacnet/bacnet.py", line 216, in do_execute
    object_data = self.device.client.client.readMultiple(request, show_property_name=True)
  File "/Users/ld/git/mapiu/build-env/lib/python3.9/site-packages/BAC0/core/io/Read.py", line 386, in readMultiple
    for k, v in registered_object_types["BAC0"][

If i do instead

request = {'address': '10.2.1.1:47808', 'objects': {'analogInput:20': ['all']}}
network.readMultiple(args=None, request_dict=request)

I get the list of properties with their values

laurentderu avatar Oct 14 '24 07:10 laurentderu