volttroncentral.agent module

The VolttronCentral(VCA) agent is used to manage remote VOLTTRON instances. The VCA exposes a JSON-RPC based web api and a web enabled visualization framework. The web enabled framework is known as VOLTTRON Central Management Console (VCMC).

In order for an instance to be able to be managed by VCMC a vcplatform.agent.VolttronCentralPlatform must be executing on the instance. If there is a vcplatform.agent.VolttronCentralPlatform running on the same instance as VCA it will be automatically registered as a managed instance. Otherwise, there are two different paths to registering an instance with VCA.

  1. Through the web api a call to the JSON-RPC method register_instance.

  2. From an external platform through pub/sub. this secondary method is preferred when deploying instances in the field that need to “phone home” to VCA after being deployed.

class volttroncentral.agent.Platform(instance_name, serverkey, vip_address)

Bases: tuple

property instance_name

Alias for field number 0

property serverkey

Alias for field number 1

property vip_address

Alias for field number 2

class volttroncentral.agent.RequiredArgs(id, session_user, platform_uuid)

Bases: tuple

property id

Alias for field number 0

property platform_uuid

Alias for field number 2

property session_user

Alias for field number 1

class volttroncentral.agent.VolttronCentralAgent(webroot='/home/docs/checkouts/readthedocs.org/user_builds/volttron/checkouts/releases-8.2/services/core/VolttronCentral/volttroncentral/webroot', users={}, topic_replace_list=[], **kwargs)[source]

Bases: volttron.platform.vip.agent.Agent

Agent for managing many volttron instances from a central web ui.

During the

configure_platforms(config_name, action, contents)[source]
get_publickey()[source]

RPC method allowing the caller to retrieve the publickey of this agent.

This method is available for allowing VolttronCentralPlatform agents to allow this agent to be able to connect to its instance.

Returns

The publickey of this volttron central agent.

Return type

str

get_setting(session_user, params)[source]

Retrieve a value from the passed setting key. The params object must contain a “key” to return from the settings store.

Parameters
  • session_user – Unused

  • params – Dictionary that must contain a ‘key’ key.

Returns

The value or a jsonrpc error object.

get_setting_keys(session_user, params)[source]

Returns a list of all of the settings keys so the caller can know what settings to request.

Parameters
  • session_user – Unused

  • params – Unused

Returns

A list of settings available to the caller.

is_registered(address_hash=None, address=None)[source]
jsonrpc(env: dict, data: dict)[source]

The main entry point for ^jsonrpc data

This method will only accept rpcdata. The first time this method is called, per session, it must be using get_authorization. That will return a session token that must be included in every subsequent request. The session is tied to the ip address of the caller.

Parameters
  • env (object) – Environment dictionary for the request.

  • data (object) – The JSON-RPC 2.0 method to call.

Return object

An JSON-RPC 2.0 response.

open_authenticate_ws_endpoint(fromip, endpoint)[source]

Callback method from when websockets are opened. The endpoint must be ‘/’ delimited with the second to last section being the session of a logged in user to volttron central itself.

Parameters
  • fromip

  • endpoint – A string representing the endpoint of the websocket.

Returns

send_management_message(type, data={})[source]

Send a message to any socket that has connected to the management socket.

The payload sent to the client is like the following:

{
    "type": "UPDATE_DEVICE_STATUS",
    "data": "this is data that was passed"
}
Parameters
  • type (str) – A string defining a unique type for sending to the websockets.

  • data (serializable) – An object that str can be called on.

set_setting(session_user, params)[source]

Sets or removes a setting from the config store. If the value is None then the item will be removed from the store. If there is an error in saving the value then a jsonrpc.json_error object is returned.

Parameters
  • session_user – Unused

  • params – Dictionary that must contain ‘key’ and ‘value’ keys.

Returns

A ‘SUCCESS’ string or a jsonrpc.json_error object.

volttroncentral.agent.init_volttron_central(config_path, **kwargs)[source]
volttroncentral.agent.main(argv=['/home/docs/checkouts/readthedocs.org/user_builds/volttron/envs/releases-8.2/lib/python3.6/site-packages/sphinx/__main__.py', '-T', '-E', '-b', 'html', '-d', '_build/doctrees', '-D', 'language=en', '.', '_build/html'])[source]

Main method called by the eggsecutable.

Parameters

argv

Returns