pymodbus.datastore.database package
Define Datastore.
- 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()
Reset all the datastores to their default values.
- setValues(fx, address, values)
Set 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)
Validate 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.SqlSlaveContext(*args, **kwargs)
Bases:
pymodbus.interfaces.IModbusSlaveContext
This creates a modbus data model with each data access in its a 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()
Reset all the datastores to their default values.
- setValues(fx, address, values, update=True)
Set 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
update – Update existing register in the db
- validate(fx, address, count=1)
Validate 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
Datastore using redis.
- 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()
Reset all the datastores to their default values.
- setValues(fx, address, values)
Set 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)
Validate 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
Datastore using SQL.
- class pymodbus.datastore.database.sql_datastore.SqlSlaveContext(*args, **kwargs)
Bases:
pymodbus.interfaces.IModbusSlaveContext
This creates a modbus data model with each data access in its a 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()
Reset all the datastores to their default values.
- setValues(fx, address, values, update=True)
Set 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
update – Update existing register in the db
- validate(fx, address, count=1)
Validate 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