0

Is it possible to call a VOLTTRON agent method running on an edge device via rpc from a Python web app running on a different PC on the LAN?

Sorry if this sounds like a silly question, but the raise_setpoints_up function is what I would want to call on my VOLTTRON edge device if its even possible.

#@RPC.export
def rpc_method(self):
    """
    RPC method
    May be called from another agent via self.core.rpc.call
    """


def raise_setpoints_up(self):

    _log.debug(f'*** [Setter Agent INFO] *** -  STARTING raise_setpoints_up FUNCTION!')

Is there any documentation to read up on for this process? I am hoping to find something I can use with aiohttp with something like this below, any tips or links to read up on greatly appreciated.

import aiohttp
import asyncio
from jsonrpcclient.clients.aiohttp_client import aiohttpClient

async def main(loop):
    async with aiohttp.ClientSession(loop=loop) as session:
        client = aiohttpClient(session, "http://xxx.xxx.xxx.xxx:5000/") # VOLTTRON edge?
        response = await client.request("agent.core.rpc.call") # agent method?
        print(response.data.result)

loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))

Would it matter if the VOLTTRON edge device is single or part of a multi-platform to call an agent via rpc?

bbartling
  • 3,288
  • 9
  • 43
  • 88
  • I have chosen not to submit these comments as an answer as my understanding is incomplete and I do not feel comfortable providing specific advice on this topic, however; I believe [it is possible to connect remote agents to a platform instance](https://volttron.readthedocs.io/en/main/platform-features/message-bus/multi-platform/multi-platform-rabbit/agent-communication-rabbitmq.html?highlight=remote%20agent#remote-agent-on-local-instance) (an agent on a different machine, for example). With this feature, it would then be possible to use RPC to interact with the remote agent. – jklarson Jun 11 '21 at 20:15
  • From this it looks like you are using http on your end device. So your end device would need to expose http in order for this to work. You would need to enable web and add volttron central to get the rpc functionality to work. see https://volttron.readthedocs.io/en/main/agent-framework/core-service-agents/volttron-central/webservice-api.html for how that works – Craig Jun 11 '21 at 23:23

0 Answers0