Slave devices¶
One device has at least one slave device. Slave devices are devices that are attached to their master (master controller), and write to pathpoints on behalf of their master controller, however, they are their own entities.
For example, the RAPID platform uses slave devices as means to configure network. Consider such a device
device_id: rapid
slave1: rapideth0
configuration: static ip 192.168.224.200/24 192.168.224.1
slave2: rapiduart
configuration: modbus 9600 8n1
Obtaining further info¶
To get the list of slave devices, use smok.client.SMOKDevice.get_device_info()
.
It will return you such a class:
- class smok.basics.DeviceInfo(device_id: str, facets: Set[str], language: str, timezone: str, units: str, verbose_name: str, slaves: List[SlaveDeviceInfo])¶
A class holding device information
- Variables
device_id – device ID of the device (str)
slaves – list of
smokclient.basics.SlaveDeviceInfo
containing info about the slave devices (tp.List[SlaveDeviceInfo
])facets – a set of strings, contains interfaces that access to this device is allowed for (tp.Set[str])
timezone – local timezone of this device, in accordance with tzdata (str)
language – language of this device, according to ISO639-1 (str)
units – either metric or imperial, units used on this device (str)
verbose_name – human-readable name of this device (str)
Which attribute slaves
will contain a list of such classes:
- class smok.basics.SlaveDeviceInfo(device_id: str, master_controller: str, responsible_service: str, configuration: str)¶
Information about a slave device attached to primary device
- Variables
device_id – slave device ID (str)
master_controller – ID of master device (str)
responsible_service – service responsible for this device, mostly “rapid” (str)
configuration – a string containing configuration for this device (str)
- to_json() dict ¶
Return a JSON-able representation of this object
Interfacing with slave devices¶
You can get your interface to slave devices via smok.client.SMOKDevice.get_slaves()
.
This will return you a list of this class: