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.
Through the web api a call to the JSON-RPC method register_instance.
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
-
property
-
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
-
property
-
class
volttroncentral.agent.
VolttronCentralAgent
(webroot='/home/docs/checkouts/readthedocs.org/user_builds/volttron/checkouts/develop/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
-
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
-
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.
-
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.
-
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.
main
(argv=['/home/docs/checkouts/readthedocs.org/user_builds/volttron/envs/develop/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