我正在努力开发一个代理来查询史学家平台但在使用RPC查询方法时收到以下错误消息:AttributeError:“NoneType”对象没有属性“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()
更新以下错误跟踪:
^{pr2}$
你的代理不会连接到平台,也不会“启动”。这就是你们现在要处理的问题。我也不明白你是如何指定vip地址来连接到运行平台的。在
您需要先运行代理,然后才能允许它进行rpc调用。如下所示,以https://github.com/VOLTTRON/volttron/blob/develop/examples/SimpleForwarder/simpleforwarder/simpleforwarder.py#L118为例进行了修改。在
相关问题 更多 >
编程相关推荐