platform_driver.interfaces.dnp3.driver_wrapper module

class platform_driver.interfaces.dnp3.driver_wrapper.DriverConfig(csv_config: List[dict])[source]

Bases: object

For validate driver configuration, e.g., driver-config.csv

csv_config: List[dict]

csv_config

Examples:

[{‘Point Name’: ‘Heartbeat’, ‘Volttron Point Name’: ‘Heartbeat’, ‘Units’: ‘On/Off’, ‘Units Details’: ‘On/Off’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘0’, ‘Type’: ‘boolean’, ‘Notes’: ‘Point for heartbeat toggle’}, {‘Point Name’: ‘Catfact’, ‘Volttron Point Name’: ‘Catfact’, ‘Units’: ‘No cat fact’, ‘Units Details’: ‘No cat fact’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘No cat fact’, ‘Type’: ‘str’, ‘Notes’: ‘Cat fact extract from REST API’}]

key_validate() List[dict][source]
Returns

EXAMPLE: {‘pointname’: ‘Heartbeat’, ‘datatype’: ‘boolean’, ‘units’: ‘On/Off’, ‘readonly’: ‘TRUE’, ‘defaultvalue’: ‘0’, ‘description’: ‘Point for heartbeat toggle’, ‘volttronpointname’: ‘Heartbeat’, ‘unitsdetails’: ‘On/Off’}

exception platform_driver.interfaces.dnp3.driver_wrapper.DriverInterfaceError[source]

Bases: Exception

class platform_driver.interfaces.dnp3.driver_wrapper.WrapperInterface(**kwargs)[source]

Bases: BasicRevert, BaseInterface

configure(driver_config_in_json_config: dict, csv_config: List[dict])[source]
Used by driver.py
def get_interface(self, driver_type, config_dict, config_string):

interface.configure(config_dict, config_string)

driver_config_in_json_config: associated with driver_config in driver-config.config (json-like file)

user inputs are put here, e.g., IP address, url, etc.

csv_config: associated with the whole driver-config.csv file

Examples: [{‘Point Name’: ‘Heartbeat’, ‘Volttron Point Name’: ‘Heartbeat’, ‘Units’: ‘On/Off’, ‘Units Details’: ‘On/Off’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘0’, ‘Type’: ‘boolean’, ‘Notes’: ‘Point for heartbeat toggle’}, {‘Point Name’: ‘Catfact’, ‘Volttron Point Name’: ‘Catfact’, ‘Units’: ‘No cat fact’, ‘Units Details’: ‘No cat fact’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘No cat fact’, ‘Type’: ‘str’, ‘Notes’: ‘Cat fact extract from REST API’}]

create_register(driver_config, point_name, data_type, units, read_only, default_value, description, csv_config, reg_def, register_type, *args, **kwargs) Union[WrapperRegister, Type[WrapperRegister]][source]
get_point(point_name, **kwargs) Union[int, str, float, bool][source]

Override BasicInvert method Note: this method should be evoked by vip agent EXAMPLE:

rs = a.vip.rpc.call(“platform.driver”, “get_point”,
“campus-vm/building-vm/Dnp3”,

“AnalogInput_index0”).get()

static get_reg_point(register: Union[WrapperRegister, Type[WrapperRegister]])[source]

Core logic for get_point

get_register_by_name(name: str) WrapperRegister[source]

Get a register by it’s point name.

Parameters

name (str) – Point name of register.

Returns

An instance of BaseRegister

Return type

BaseRegister

insert_register(register: WrapperRegister)[source]

Inserts a register into the Interface.

Parameters

register (BaseRegister) – Register to add to the interface.

parse_config(csv_config, driver_config_in_json_config)[source]
abstract static pass_register_types(csv_config: dict, driver_config_in_json_config: List[dict], register_type_list: Optional[List[Union[WrapperRegister, Type[WrapperRegister]]]] = None) List[Union[WrapperRegister, Type[WrapperRegister]]][source]

For ingesting the register types list Will be used by concrete Interface class inherit this template

driver_config_in_json_config: associated with driver_config in driver-config.config (json-like file)

user inputs are put here, e.g., IP address, url, etc.

csv_config: associated with the whole driver-config.csv file

Examples: [{‘Point Name’: ‘Heartbeat’, ‘Volttron Point Name’: ‘Heartbeat’, ‘Units’: ‘On/Off’, ‘Units Details’: ‘On/Off’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘0’, ‘Type’: ‘boolean’, ‘Notes’: ‘Point for heartbeat toggle’}, {‘Point Name’: ‘Catfact’, ‘Volttron Point Name’: ‘Catfact’, ‘Units’: ‘No cat fact’, ‘Units Details’: ‘No cat fact’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘No cat fact’, ‘Type’: ‘str’, ‘Notes’: ‘Cat fact extract from REST API’}]

register_type_list:

Example: [RestAPIRegister, RestAPIRegister, RestAPIRegister, RandomBoolRegister]

set_point(point_name, value)[source]

Override/Restate BasicInvert method for convenience Note: this method should be evoked by vip agent EXAMPLE:

rs = a.vip.rpc.call(“platform.driver”, “set_point”,
“campus-vm/building-vm/Dnp3”,

“AnalogInput_index0”, 0.543).get()

static set_reg_point(register: Union[WrapperRegister, Type[WrapperRegister]], value_to_set: Union[int, str, float, bool])[source]

Core logic for set_point, i.e., _set_point without verification Note: Can be used for vip-agent-mock testing

classmethod set_reg_point_async_w_verification(value_to_set: Union[int, str, float, bool], register: Union[WrapperRegister, Type[WrapperRegister]], relax_verification=True)[source]

Counterpart of set_reg_point_w_verification for asynchronous workflow with delay and retry.

classmethod set_reg_point_w_verification(value_to_set: Union[int, str, float, bool], register: Union[WrapperRegister, Type[WrapperRegister]], relax_verification=True)[source]

Core logic for set_point, i.e., _set_point with verification Note: Can be used for vip-agent-mock testing

class platform_driver.interfaces.dnp3.driver_wrapper.WrapperInterfaceNew(*args, **kwargs)[source]

Bases: object

Use composition instead of inheritance

configure(driver_config_in_json_config: dict, csv_config: List[dict])[source]
Used by driver.py
def get_interface(self, driver_type, config_dict, config_string):

interface.configure(config_dict, config_string)

driver_config_in_json_config: associated with driver_config in driver-config.config (json-like file)

user inputs are put here, e.g., IP address, url, etc.

csv_config: associated with the whole driver-config.csv file

Examples: [{‘Point Name’: ‘Heartbeat’, ‘Volttron Point Name’: ‘Heartbeat’, ‘Units’: ‘On/Off’, ‘Units Details’: ‘On/Off’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘0’, ‘Type’: ‘boolean’, ‘Notes’: ‘Point for heartbeat toggle’}, {‘Point Name’: ‘Catfact’, ‘Volttron Point Name’: ‘Catfact’, ‘Units’: ‘No cat fact’, ‘Units Details’: ‘No cat fact’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘No cat fact’, ‘Type’: ‘str’, ‘Notes’: ‘Cat fact extract from REST API’}]

create_register(driver_config, point_name, data_type, units, read_only, default_value, description, csv_config, reg_def, register_type, *args, **kwargs) Union[WrapperRegister, Type[WrapperRegister]][source]
get_point(point_name, **kwargs) Union[int, str, float, bool][source]
get_register_by_name(name: str) Register[source]
insert_register(register: WrapperRegister)[source]

Inserts a register into the Interface.

Parameters

register (BaseRegister) – Register to add to the interface.

parse_config(csv_config, driver_config_in_json_config, register_type_list)[source]
abstract static pass_register_types(csv_config: dict, driver_config_in_json_config: List[dict], register_type_list: Optional[List[Union[WrapperRegister, Type[WrapperRegister]]]] = None) List[Union[WrapperRegister, Type[WrapperRegister]]][source]

For ingesting the register types list Will be used by concrete Interface class inherit this template

driver_config_in_json_config: associated with driver_config in driver-config.config (json-like file)

user inputs are put here, e.g., IP address, url, etc.

csv_config: associated with the whole driver-config.csv file

Examples: [{‘Point Name’: ‘Heartbeat’, ‘Volttron Point Name’: ‘Heartbeat’, ‘Units’: ‘On/Off’, ‘Units Details’: ‘On/Off’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘0’, ‘Type’: ‘boolean’, ‘Notes’: ‘Point for heartbeat toggle’}, {‘Point Name’: ‘Catfact’, ‘Volttron Point Name’: ‘Catfact’, ‘Units’: ‘No cat fact’, ‘Units Details’: ‘No cat fact’, ‘Writable’: ‘TRUE’, ‘Starting Value’: ‘No cat fact’, ‘Type’: ‘str’, ‘Notes’: ‘Cat fact extract from REST API’}]

register_type_list:

Example: [RestAPIRegister, RestAPIRegister, RestAPIRegister, RandomBoolRegister]

scrape_all()[source]

Implementation of BaseInterface.scrape_all()

set_point(point_name, value)[source]

Implementation of BaseInterface.set_point()

Passes arguments through to BasicRevert._set_point()

class platform_driver.interfaces.dnp3.driver_wrapper.WrapperRegister(driver_config: dict, point_name: str, data_type: Union[int, str, float, bool], units: str, read_only: bool, default_value=None, description='', csv_config={}, *args, **kwargs)[source]

Bases: BaseRegister

Template Register, host boilerplate code

abstract get_register_value(**kwargs) Union[int, str, float, bool][source]

Override this to get register value Examples 1 retrieve:

def get_register_value():

some_url: str = self.config_dict.get(“url”) return self.get_restAPI_value(url=some_url)

def get_restAPI_value(url=some_url)

abstract set_register_value(value, **kwargs) Optional[Union[int, str, float, bool]][source]
property value