1

Say I have a running volttron agent with a @RPC decorated method (if that's relevant). Are there any ways to call that method from outside of the volttron platform? (In my case from a django web server)

2 Answers2

0

An agent may register endpoints on the VOLTTRON web service. A callback may be setup for the endpoint as needed.

The web service must be enabled and the agent needs to pass "enable_web=True" to the base agent constructor.

You can find the documentation and examples here: http://volttron.readthedocs.io/en/develop/specifications/webframework.html

Kyle Monson
  • 471
  • 1
  • 3
  • 6
0

Along with what kyle-monson mentions, you also have to run Volttron using the bind argument. This will expose the registered endpoints on the bind arg given. e.g `volttron -vv --bind-web-address "https://127.0.0.1:7080"

OR specify the bind-web-address in the ~/.volttron/config

[volttron]
message-bus = rmq
bind-web-address = https://127.0.0.1:7080

Then you can send HTTP POST request to https://127.0.0.1:7080/rpc-method-name

rpc-method-name in the request URL being the registered method using self.vip.web.register_endpoint("/rpc-method-name", self.call_back_method_for_endpoint)

The call back method takes in two parameters "env" and "data"

For more details on this two parameters check the docs here

rjdkolb
  • 10,377
  • 11
  • 69
  • 89