下面的代码片段来自actuator agent
,我正在尝试研究方法revert_point
:
#@RPC.export
def revert_point(self, requester_id, topic, point=None, **kwargs):
"""
RPC method
Reverts the value of a specific point on a device to a default state.
Requires the device be scheduled by the calling agent.
:param requester_id: Ignored, VIP Identity used internally
:param topic: The topic of the point to revert in the
format <device topic>/<point name>
:param \*\*kwargs: Any driver specific parameters
:type topic: str
:type requester_id: str
.. warning:: Calling without previously scheduling a device and not
within
the time allotted will raise a LockError"""
rpc_peer = self.vip.rpc.context.vip_message.peer
return self._revert_point(rpc_peer, topic, point=point, **kwargs)
我称revert_point
:
for device in revert_topic_devices:
response = self.vip.rpc.call('platform.actuator', 'revert_point', self.core.identity, final_topic, self.jci_setpoint_topic).get(timeout=3)
此信息:
2.0 (self.core.identity)
slipstream_internal/slipstream_hq/27/OCC-SCHEDULE (final_topic)
2.0
slipstream_internal/slipstream_hq/29/OCC-SCHEDULE
2.0
slipstream_internal/slipstream_hq/30/OCC-SCHEDULE
我收到一个关键错误:
volttron.platform.jsonrpc.RemoteError: volttron.platform.jsonrpc.RemoteError("builtins.KeyError('slipstream_internal/slipstream_hq/30/OCC-SCHEDULE')")
答案 0 :(得分:0)
我想通了,像这样调用方法:
for device in revert_topic_devices:
response = self.vip.rpc.call('platform.actuator', 'revert_point', self.core.identity, topic, self.jci_setpoint_topic).get(timeout=3)
主题应如下所示:
slipstream_internal/slipstream_hq/27
2.0
slipstream_internal/slipstream_hq/29
2.0
slipstream_internal/slipstream_hq/30