pymodbus.datastore.database package

class pymodbus.datastore.database.SqlSlaveContext(*args, **kwargs)

Bases: pymodbus.interfaces.IModbusSlaveContext

This creates a modbus data model with each data access stored in its own personal block

getValues(fx, address, count=1)

Get count values from datastore

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to retrieve
Returns:

The requested values from a:a+c

reset()

Resets all the datastores to their default values

setValues(fx, address, values)

Sets the datastore with the supplied values

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • values – The new values to be set
validate(fx, address, count=1)

Validates the request to make sure it is in range

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to test
Returns:

True if the request in within range, False otherwise

class pymodbus.datastore.database.RedisSlaveContext(**kwargs)

Bases: pymodbus.interfaces.IModbusSlaveContext

This is a modbus slave context using redis as a backing store.

getValues(fx, address, count=1)

Get count values from datastore

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to retrieve
Returns:

The requested values from a:a+c

reset()

Resets all the datastores to their default values

setValues(fx, address, values)

Sets the datastore with the supplied values

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • values – The new values to be set
validate(fx, address, count=1)

Validates the request to make sure it is in range

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to test
Returns:

True if the request in within range, False otherwise

Submodules

pymodbus.datastore.database.redis_datastore module

class pymodbus.datastore.database.redis_datastore.RedisSlaveContext(**kwargs)

Bases: pymodbus.interfaces.IModbusSlaveContext

This is a modbus slave context using redis as a backing store.

getValues(fx, address, count=1)

Get count values from datastore

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to retrieve
Returns:

The requested values from a:a+c

reset()

Resets all the datastores to their default values

setValues(fx, address, values)

Sets the datastore with the supplied values

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • values – The new values to be set
validate(fx, address, count=1)

Validates the request to make sure it is in range

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to test
Returns:

True if the request in within range, False otherwise

pymodbus.datastore.database.sql_datastore module

class pymodbus.datastore.database.sql_datastore.SqlSlaveContext(*args, **kwargs)

Bases: pymodbus.interfaces.IModbusSlaveContext

This creates a modbus data model with each data access stored in its own personal block

getValues(fx, address, count=1)

Get count values from datastore

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to retrieve
Returns:

The requested values from a:a+c

reset()

Resets all the datastores to their default values

setValues(fx, address, values)

Sets the datastore with the supplied values

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • values – The new values to be set
validate(fx, address, count=1)

Validates the request to make sure it is in range

Parameters:
  • fx – The function we are working with
  • address – The starting address
  • count – The number of values to test
Returns:

True if the request in within range, False otherwise