platform_driver.interfaces.modbus module

class platform_driver.interfaces.modbus.Interface(**kwargs)[source]

Bases: platform_driver.interfaces.BasicRevert, platform_driver.interfaces.BaseInterface

build_ranges_map()[source]
configure(config_dict, registry_config_str)[source]

Configures the Interface for the specific instance of a device.

Parameters
  • config_dict (dict) – The “driver_config” section of the driver configuration file.

  • registry_config_str (str) – The contents of the registry configuration file.

This method must setup register representations of all points on a device by creating instances of BaseRegister (or a subclass) and adding them to the Interface with BaseInterface.insert_register().

get_point(point_name)[source]

Get the current value for the point name given.

Parameters
  • point_name (str) – Name of the point to retrieve.

  • kwargs – Any interface specific parameters.

Returns

Point value

insert_register(register)[source]

Inserts a register into the Interface.

Parameters

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

merge_register_ranges()[source]

Merges any adjacent registers for more efficient scraping. May only be called after all registers have been inserted.

parse_config(configDict)[source]
scrape_bit_registers(client, read_only)[source]
scrape_byte_registers(client, read_only)[source]
class platform_driver.interfaces.modbus.ModbusBitRegister(address, type_string, pointName, units, read_only, mixed_endian=False, description='', slave_id=0)[source]

Bases: platform_driver.interfaces.modbus.ModbusRegisterBase

get_register_count()[source]
get_state(client)[source]
parse_value(starting_address, bit_stream)[source]
set_state(client, value)[source]
class platform_driver.interfaces.modbus.ModbusByteRegister(address, type_string, pointName, units, read_only, mixed_endian=False, description='', slave_id=0)[source]

Bases: platform_driver.interfaces.modbus.ModbusRegisterBase

get_register_count()[source]
get_state(client)[source]
parse_value(starting_address, byte_stream)[source]
set_state(client, value)[source]
exception platform_driver.interfaces.modbus.ModbusInterfaceException(string)[source]

Bases: pymodbus.exceptions.ModbusException

class platform_driver.interfaces.modbus.ModbusRegisterBase(address, register_type, read_only, pointName, units, description='', slave_id=0)[source]

Bases: platform_driver.interfaces.BaseRegister

platform_driver.interfaces.modbus.modbus_client(address, port)[source]