我正在尝试开发一个查询 platform.historian 的代理,但在使用 RPC 查询方法时收到此错误消息:AttributeError: 'NoneType' object has no attribute 'call'
class TCMAgent(Agent):
def __init__(self, config_path, **kwargs):
super(TCMAgent, self).__init__(**kwargs)
self.config = utils.load_config(config_path)
self.site = self.config.get('campus')
self.building = self.config.get('building')
self.unit = self.config.get('unit')
self.subdevices = self.config.get('subdevices')
self.subdevice = self.subdevices[0]
...
...
def test_api():
'''To test Volttron APIs'''
import os
topic_tmpl = "{campus}/{building}/{unit}/{subdevice}/{point}"
tcm = TCMAgent(os.environ.get('AGENT_CONFIG'))
topic1 = topic_tmpl.format(campus='PNNL',
building='SEB',
unit='AHU1',
subdevice='VAV123A',
point='MaximumZoneAirFlow')
result = tcm.vip.rpc.call('platform.historian',
'query',
topic=topic1,
count=20,
order="LAST_TO_FIRST").get(timeout=100)
assert result is not None
if __name__ == '__main__':
# Entry point for script
#sys.exit(main())
test_api()
更新下面的错误跟踪:
2016-07-19 14:58:31,362 volttron.platform.vip.agent.core DEBUG: publickey is None
2016-07-19 14:58:31,362 volttron.platform.vip.agent.core DEBUG: secretkey is None
Traceback (most recent call last):
File "/home/hngo/volttron/examples/TCMAgent/tcm/agent.py", line 236, in <module>
test_api()
File "/home/hngo/volttron/examples/TCMAgent/tcm/agent.py", line 230, in test_api
order="LAST_TO_FIRST").get(timeout=100)
File "/home/hngo/volttron/volttron/platform/vip/agent/subsystems/rpc.py", line 303, in call
request, result = self._dispatcher.call(method, args, kwargs)
AttributeError: 'NoneType' object has no attribute 'call'