Schedule the Publication of Readings
The following table describes the configuration variables that can be used with each object in the array of objects of the Schedules parameter:
Parameter | Type | Description | Valid Values | Required |
---|---|---|---|---|
device | String | The name of the device providing readings, as configured in the Devices parameter | A valid device name | Y |
resource | String | The name of the device resource to publish, as configured in the Devices parameter | A valid device resource | Y |
interval | Unsigned Integer | The interval in microseconds between the publication of each reading | Y | |
topics | Array of strings | The topics on which to publish readings | N |
For further information on the Schedules and Devices parameters, see Device Service Component Configuration.
Schedule Configuration Example
The following example JSON configuration file configures a schedule for readings from the Modbus Network Power Meter Simulation device:
{
"Library": "libxrt-modbus-device-service.so",
"Factory": "xrt_modbus_device_service_factory",
"Name": "modbus_device_service",
"Topic": "modbus_device_service/data",
"Devices": {
"Network-Power-Meter-Simulation": {
"profile": "Network Power Meter",
"protocols": {
"modbus-tcp": {
"Address": "${MODBUS_DEVICE_ADDRESS}",
"Port": "1502",
"UnitID": "1"
}
}
}
},
"Schedules": [
{
"device": "Network-Power-Meter-Simulation",
"resource": "Current",
"interval": 2000000
},
{
"device": "Network-Power-Meter-Simulation",
"resource": "Energy",
"interval": 1000000,
"topics": ["modbus_device_service/readings", "modbus_device_service/energy"]
}
],
"ProfileDir": "config/profiles",
"Scheduler": "sched",
"Logger": "logger",
"ThreadPool": "pool",
"Bus": "bus"
}