API Reference¶
Sfc5xxxShdlcDevice¶
-
class
sensirion_shdlc_sfc5xxx.device.
Sfc5xxxShdlcDevice
(connection, slave_address)[source]¶ Sfc5xxx device.
This is a low-level driver which just provides all SHDLC commands as Python methods. Typically, calling a method sends one SHDLC request to the device and interprets its response. There is no higher level functionality available, please look for other drivers if you need a higher level interface.
There is no (or very few) caching functionality in this driver. For example if you call
get_serial_number()
100 times, it will send the command 100 times over the SHDLC interface to the device. This makes the driver (nearly) stateless.-
__init__
(connection, slave_address)[source]¶ Create an Sfc5xxx device instance on an SHDLC connection.
Note
This constructor does not communicate with the device, so it’s possible to instantiate an object even if the device is not connected or powered yet.
Parameters: - connection (ShdlcConnection) – The connection used for the communication.
- slave_address (byte) – The address of the device. The default address of the SFC5xxx is 0.
-
get_product_type
(as_int=False)[source]¶ Get the product type. The product type (sometimes also called “device type”) can be used to detect what kind of SHDLC product is connected.
Parameters: as_int (bool) – If True
, the product type is returned as an integer, otherwise as a string of hexadecimal digits (default).Returns: The product type as an integer or string of hexadecimal digits. Return type: string/int
-
get_product_subtype
()[source]¶ Get the product subtype. Some product types exist in multiple slightly different variants, this command allows to determine the exact variant of the connected device. Sometimes this is called “device subtype”.
Note
This command is not supported by every product type.
Returns: The product subtype as a byte (the interpretation depends on the connected product type). Return type: byte
-
get_product_name
()[source]¶ Get the product name of the device.
Note
This command is not supported by every product type.
Returns: The product name as an ASCII string. Return type: string
-
get_article_code
()[source]¶ Get the article code of the device.
Note
This command is not supported by every product type.
Returns: The article code as an ASCII string. Return type: string
-
get_serial_number
()[source]¶ Get the serial number of the device.
Returns: The serial number as an ASCII string. Return type: string
-
get_version
()[source]¶ Get the version of the device firmware, hardware and SHDLC protocol.
Returns: The device version as a Version object. Return type: Version
-
read_device_status
(clear=True, as_exception=False)[source]¶ Read and optionally clear the device status and the last error. The status and error code interpretation is documented in the device interface specification.
Parameters: - clear (bool) – If
True
, the status flags on the device get cleared. - as_exception (bool) – If
True
, the last error is returned as anShdlcDeviceError
object instead of a byte.
Returns: The device status as a 32-bit unsigned integer containing all status flags, and the last error which occurred on the device. If
as_exception
isTrue
, it’s returned as anShdlcDeviceError
object orNone
, otherwise as a byte.Return type: int, byte/ShdlcDeviceError/None
- clear (bool) – If
-
get_slave_address
()[source]¶ Get the SHDLC slave address of the device.
Note
See also the property
slave_address
which returns the device’s slave address without sending a command. This method really sends a command to the device, even though the slave address is actually already known by this object.Returns: The slave address of the device. Return type: byte
-
set_slave_address
(slave_address, update_driver=True)[source]¶ Set the SHDLC slave address of the device.
Note
The slave address is stored in non-volatile memory of the device and thus persists after a device reset. So the next time connecting to the device, you have to use the new address.
Warning
When changing the address of a slave, make sure there isn’t already a slave with that address on the same bus! In that case you would get communication issues which can only be fixed by disconnecting one of the slaves.
Parameters: - slave_address (byte) – The new slave address [0..254]. The address 255 is reserved for broadcasts.
- update_driver (bool) – If
True
, the propertyslave_address
of this object is also updated with the new address. This is needed to allow further communication with the device, as its address has changed.
-
get_baudrate
()[source]¶ Get the SHDLC baudrate of the device.
Note
This method really sends a command to the device, even though the baudrate is already known by the used
ShdlcPort
object.Returns: The baudrate of the device [bit/s]. Return type: int
-
set_baudrate
(baudrate, update_driver=True)[source]¶ Set the SHDLC baudrate of the device.
Note
The baudrate is stored in non-volatile memory of the device and thus persists after a device reset. So the next time connecting to the device, you have to use the new baudrate.
Warning
If you pass
True
to the argumentupdate_driver
, the baudrate of the underlayingShdlcPort
object is changed. As the baudrate applies to the whole bus (with all its slaves), you might no longer be able to communicate with other slaves. Generally you should change the baudrate of all slaves consecutively, and only setupdate_driver
toTrue
the last time.Parameters: - baudrate (int) – The new baudrate. See device documentation for a list of supported baudrates. Many devices support the baudrates 9600, 19200 and 115200.
- update_driver (bool) – If true, the baudrate of the
ShdlcPort
object is also updated with the baudrate. This is needed to allow further communication with the device, as its baudrate has changed.
-
get_reply_delay
()[source]¶ Get the SHDLC reply delay of the device.
See
set_reply_delay()
for details.Returns: The reply delay of the device [μs]. Return type: byte
-
set_reply_delay
(reply_delay_us)[source]¶ Set the SHDLC reply delay of the device.
The reply delay allows to increase the minimum response time of the slave to a given value in Microseconds. This is needed for RS485 masters which require some time to switch from sending to receiving. If the slave starts sending the response while the master is still driving the bus lines, a conflict on the bus occurs and communication fails. If you use such a slow RS485 master, you can increase the reply delay of all slaves to avoid this issue.
Parameters: reply_delay_us (byte) – The new reply delay [μs].
-
factory_reset
()[source]¶ Perform a factory reset (restore the off-the-shelf factory configuration).
Warning
This resets any configuration done after leaving the factory! Keep in mind that this command might also change communication parameters (i.e. baudrate and slave address) and thus you might have to adjust the driver’s parameters to allow further communication with the device.
-
get_setpoint
(scaling)[source]¶ Get the current flow setpoint.
Parameters: scaling (Sfc5xxxScaling) – Defines with which scale resp. unit the setpoint should be returned. Returns: The current setpoint with the specified scaling. Return type: float
-
set_setpoint
(setpoint, scaling)[source]¶ Set the flow setpoint which is used by the flow controller as reference input.
Parameters: - setpoint (float) – The new setpoint with the specified scaling.
- scaling (Sfc5xxxScaling) – Defines with which scale resp. unit the setpoint is passed.
-
get_setpoint_persist
()[source]¶ Get the setpoint persist configuration.
Returns: Whether the setpoint should persist after a device reset or not. Return type: bool
-
set_setpoint_persist
(persist)[source]¶ Set the setpoint persist configuration.
Allows to define if a setpoint should persist after a device reset (soft or hardreset) or if it should be set to zero. Default is
False
, i.e. the setpoint is set to zero after a device reset.Parameters: persist (bool) – Whether the setpoint should persist after a reset or not.
-
set_setpoint_and_read_measured_value
(setpoint, scaling)[source]¶ Set the flow setpoint and return the last measured flow value in one command.
This is the same as calling
set_setpoint()
andread_measured_value()
, but it’s more efficient since only one SHDLC command is executed.Parameters: - setpoint (float) – The new setpoint with the specified scaling.
- scaling (Sfc5xxxScaling) – Defines with which scale resp. unit the setpoint is passed and the measured flow is returned.
Returns: The last measured flow with the specified scaling.
Return type: float
-
read_measured_value
(scaling)[source]¶ Read the last measured flow value.
Parameters: scaling (Sfc5xxxScaling) – Defines with which scale resp. unit the measured flow should be returned. Returns: The last measured flow with the specified scaling. Return type: float
-
read_measured_value_buffer
(scaling, max_reads=100)[source]¶ Read the measured flow value buffer.
The MFC has an internal ring buffer in which the measured flow values are automatically stored in a regular interval. The size of the buffer is between 85 and 256 (depends on the specific device configuration). This method sends “read buffer” commands to the device until the whole buffer was read out (since the SHDLC frame length is limited, it’s not possible to read out the whole buffer with a single command). The received values will automatically be removed from the buffer in the device, so you will only get the values received since the last call to this method.
Warning
If you call this method too rarely, the buffer in the device will overrun, i.e. the oldest values are lost. You should check for lost values by reading the property
lost_values
of the returned object. This method does not raise an exception if there are values lost since depending on the use-case, this might be expected behavior.Note
If the buffer gets filled faster than you read it out, it’s not possible to read out the whole buffer. In that case, the property
remaining_values
of the returned object will hold a value greater than zero. You might want to check this property to be sure the whole buffer was read out. However, often that’s not needed since sooner or later you will also get a buffer overrun in this situation.Parameters: - scaling (Sfc5xxxScaling) – Defines with which scale resp. unit the measured flow values should be returned.
- max_reads (int) – The maximum count of read commands which should be sent until the read operation will be aborted. This abort condition is needed to avoid an infinite loop if the buffer gets filled faster than it can be read out.
Returns: An object containing the buffered flow values and some metadata. See
Sfc5xxxReadBufferResponse
for details.Return type:
-
get_valve_input_source
()[source]¶ Get the valve input source configuration.
Returns: The current valve input source configuration. Return type: Sfc5xxxValveInputSource
-
set_valve_input_source
(source)[source]¶ Set the valve input source configuration.
By default, the valve is controlled by the flow controller according the setpoint and measured flow. But with this configuration you can take over the valve control and set the valve to a specific value. This configuration is volatile, i.e. it is reset to its default value after a device reset.
Note
When changing the valve input source to
USER_DEFINED
. you also need to specify the user defined value by calling the methodset_user_defined_valve_value()
.Parameters: source (Sfc5xxxValveInputSource) – The valve input source to set.
-
get_user_defined_valve_value
()[source]¶ Get the current user defined valve value.
Returns: The current user defined valve value [0..1]. Zero means “fully closed”, 1.0 means “fully open”. Return type: float
-
set_user_defined_valve_value
(value)[source]¶ Set the user defined valve value.
Note
Writing the user defined valve value has no effect as long as the valve input source is not set to
USER_DEFINED
. So you’ll also have to callset_valve_input_source()
to change the valve input source.Parameters: value (float) – The new user defined valve value as a normalized value in the range [0..1]. Zero means “fully closed”, 1.0 means “fully open”.
-
get_user_defined_medium_unit
(substitute_wildcards=False)[source]¶ Get the currently configured user defined medium unit.
Parameters: substitute_wildcards (bool) – By default, the user defined medium unit is set to “undefined” values, which means to fall back to the calibration unit. With this parameter you can choose whether you want to get the actually configured user defined unit (which then might be undefined), or whether the calibration unit should be returned instead in that case. Default is False
, i.e. you will get the actual configuration without falling back to the calibration unit.Returns: The current user defined medium unit. Return type: Sfc5xxxMediumUnit
-
set_user_defined_medium_unit
(unit)[source]¶ Set the user defined medium unit.
This is the unit which will be used when reading or writing flow values like setpoint or measured flow with the scaling
USER_DEFINED
. This allows to always work with the same flow unit, no matter what’s the actual calibration unit of the MFC.Note
This setting is stored permanently in the device, i.e. it persists after a device reset.
Parameters: unit (Sfc5xxxMediumUnit) – The user defined medium unit to set.
-
get_user_defined_fullscale
()[source]¶ Get the fullscale flow in the currently set user defined unit.
Returns: The fullscale flow in the current user defined unit. Return type: float
-
get_user_controller_gain
()[source]¶ Get the current user controller gain.
Returns: The current user controller gain (normalized value, default 1.0). Return type: float
-
set_user_controller_gain
(gain)[source]¶ Set the current user controller gain.
This allows to adjust the speed of the flow controller by changing its overall gain.
Note
This value is stored permanently in the device, i.e. it persists after a device reset.
Parameters: gain (float) – The new gain to set (normalized value, default 1.0).
-
get_pressure_dependent_gain_enable
()[source]¶ Get the state of the pressure dependent gain setting.
Returns: Whether the pressure dependent gain is enabled or not. Return type: bool
-
set_pressure_dependent_gain_enable
(enable)[source]¶ Set the state of the pressure dependent gain setting.
If the pressure dependent gain is enabled, you’ll have to set the actual inlet pressure with the method
set_inlet_pressure_for_gain_correction()
.Note
This value is stored permanently in the device, i.e. it persists after a device reset.
Parameters: enable (bool) – Whether the pressure dependent gain should be enabled or not.
-
get_inlet_pressure_for_gain_correction
()[source]¶ Get the currently configured inlet pressure as used for the pressure dependent controller gain.
Returns: The currently configured inlet pressure [bar]. Return type: float
-
set_inlet_pressure_for_gain_correction
(pressure)[source]¶ Set the inlet pressure used for the pressure dependent controller gain.
Note
This value is stored permanently in the device, i.e. it persists after a device reset.
Parameters: pressure (float) – The new pressure [bar] to set.
-
get_gas_temperature_compensation_enable
()[source]¶ Get the state of the gas temperature compensation setting.
Returns: Whether the gas temperature compensation is enabled or not. Return type: bool
-
set_gas_temperature_compensation_enable
(enable)[source]¶ Set the state of the gas temperature compensation setting.
If the gas temperature compensation is enabled, you’ll have to set the actual inlet gas temperature with the method
set_inlet_gas_temperature_for_compensation()
.Note
This value is stored permanently in the device, i.e. it persists after a device reset.
Parameters: enable (bool) – Whether the gas temperature compensation should be enabled or not.
-
get_inlet_gas_temperature_for_compensation
()[source]¶ Get the currently configured inlet gas temperature as used for the gas temperature compensation.
Returns: The currently configured inlet gas temperature [°C]. Return type: float
-
set_inlet_gas_temperature_for_compensation
(temperature)[source]¶ Set the inlet gas temperature used for the gas temperature compensation.
Note
This value is stored permanently in the device, i.e. it persists after a device reset.
Parameters: temperature (float) – The new temperature [°C] to set.
-
measure_raw_flow
()[source]¶ Measure the raw flow ticks.
Returns: Measured raw flow ticks. Return type: int
-
measure_temperature
()[source]¶ Measure the sensor temperature.
Returns: Measured temperature [°C]. Return type: float
-
measure_raw_thermal_conductivity
(close_valve=True)[source]¶ Measure the raw thermal conductivity.
Parameters: close_valve (bool) – If True
(default), the valve will be forcibly closed for 500ms before measuring the thermal conductivity. This is needed to guarantee a correct and stable measurement. If you are sure that the valve is closed anyway, you could set this toFalse
to speed up the measurement.Returns: Measured raw thermal conductivity ticks. Return type: int
-
get_number_of_calibrations
()[source]¶ Get the number of possible calibrations. Each calibration can either contain a valid calibration or not. Use
get_calibration_validity()
to determine which indices contain a valid calibration.Returns: The number of calibrations the device memory can hold. Return type: int
-
get_calibration_validity
(index)[source]¶ Check whether there exists a valid calibration block at a specific index or not.
Parameters: index (int) – The index of the calibration to check. Returns: Whether at the specified index exists a valid calibration block or not. Return type: bool
-
get_calibration_gas_description
(index)[source]¶ Get the gas description of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Gas description string. Return type: str
-
get_calibration_gas_id
(index)[source]¶ Get the gas ID of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Gas ID. Return type: int
-
get_calibration_gas_unit
(index)[source]¶ Get the gas unit of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Gas unit. Return type: Sfc5xxxMediumUnit
-
get_calibration_fullscale
(index)[source]¶ Get the fullscale flow of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Fullscale flow in the unit of the calibration. Return type: float
-
get_calibration_initial_conditions
(index)[source]¶ Get the initial calibration conditions of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Initial calibration conditions. Return type: Sfc5xxxCalibrationConditions
-
get_calibration_recalibration_conditions
(index)[source]¶ Get the recalibration conditions of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Recalibration conditions. Return type: Sfc5xxxCalibrationConditions
-
get_calibration_thermal_conductivity_reference
(index)[source]¶ Get the thermal conductivity reference value of a specific calibration index.
Parameters: index (int) – The index of the calibration to read from. Returns: Thermal conductivity reference value ticks. Return type: int
-
get_current_gas_description
()[source]¶ Get the gas description of the currently active calibration.
Returns: Gas description string. Return type: str
-
get_current_gas_id
()[source]¶ Get the gas ID of the currently active calibration.
Returns: Gas ID. Return type: int
-
get_current_gas_unit
()[source]¶ Get the gas unit of the currently active calibration.
Returns: Gas unit. Return type: Sfc5xxxMediumUnit
-
get_current_fullscale
()[source]¶ Get the fullscale flow of the currently active calibration.
Returns: Fullscale flow in the unit of the calibration. Return type: float
-
get_current_initial_calibration_conditions
()[source]¶ Get the initial calibration conditions of the currently active calibration.
Returns: Initial calibration conditions. Return type: Sfc5xxxCalibrationConditions
-
get_current_recalibration_conditions
()[source]¶ Get the recalibration conditions of the currently active calibration.
Returns: Recalibration conditions. Return type: Sfc5xxxCalibrationConditions
-
get_current_thermal_conductivity_reference
()[source]¶ Get the thermal conductivity reference value of the currently active calibration.
Returns: Thermal conductivity reference value ticks. Return type: int
-
activate_calibration
(index)[source]¶ Activate a specific gas calibration block and run the flow controller.
Parameters: index (int) – The index of the calibration to activate.
-
read_user_memory
(address, length)[source]¶ Read data from the user memory.
Parameters: - address (int) – The address to read from.
- length (int) – Number of bytes to read.
Returns: The read data.
Return type: bytes
-
write_user_memory
(address, data)[source]¶ Write data to the user memory.
Parameters: - address (int) – The address to write to.
- data (bytes-like) – Data to write.
-
update_firmware
(image, emergency=False, status_callback=None, progress_callback=None)[source]¶ Update the firmware on the device.
This method allows you to download a new firmware (provided as a *.hex file) to the device. A device reset is performed after the firmware update.
Note
This can take several minutes, don’t abort it! If aborted, the device stays in the bootloader and you need to restart the update with
emergency=True
to recover.Warning
If the Sfc5xxx is connected through RS485 together with other SHDLC devices on the same bus, make sure that no other device has the slave address 0 and baudrate 115200! These connection settings are used by the bootloader and thus two devices would respond to the bootloader commands. If an update fails because of this, you will have to disconnect the other device with address 0 and do an emergency update to recover this device.
Parameters: - image – The image to flash, either as a
:py:
Sfc5xxxFirmwareImage
object, a file-like object, or the filename (str
) to the *.hex file. - emergency (bool) – Must be set to
True
if the device is already in bootloader mode,False
otherwise. - status_callback (callable) – Optional callback for status report, taking a string as parameter.
- progress_callback (callable) – Optional callback for progress report, taking a float as parameter (progress in percent).
Raises: - ShdlcFirmwareImageIncompatibilityError – If the image is not compatible with the connected device.
- Exception – On other errors.
- image – The image to flash, either as a
:py:
-
connection
¶ Get the used SHDLC connection.
Returns: The used SHDLC connection. Return type: ShdlcConnection
-
execute
(command)¶ Execute an SHDLC command.
Parameters: command (ShdlcCommand) – The command to execute. Returns: The interpreted response of the executed command.
-
last_error_flag
¶ Get the error flag which was received with the last response of the device. So this flag gets updated with every command sent to the device. If the flag is True, typically the derived classes provide a method to read the exact error reason from the device (the corresponding SHDLC command is called “Get Device Status”).
Note
When creating an instance of
ShdlcDeviceBase
, this property is initialized withFalse
and will not be updated until you send the first command to the device.Returns: True if the device indicated an error, False otherwise. Return type: bool
-
slave_address
¶ Get the slave address (not read from the device!).
Returns: The slave address. Return type: byte
-
Sfc5xxxFirmwareImage¶
-
class
sensirion_shdlc_sfc5xxx.firmware_image.
Sfc5xxxFirmwareImage
(hexfile)[source]¶ SFC5xxx firmware image.
This class represents a firmware image for the SFC5xxx device. It is used to load and verify Intel-Hex files for performing firmware updates over SHDLC.
-
__init__
(hexfile)[source]¶ Constructor which loads and parses the firmware from a hex file.
Parameters: hexfile (str/file) – The filename or file-like object containing the firmware in Intel-Hex format (*.hex). Raises: ShdlcFirmwareImageSignatureError – If the signature of the image is invalid.
-
application_version
¶ Get the application firmware version which is contained in the loaded image.
Returns: Application firmware version (note: debug flag is not supported, it’s always False). Return type: FirmwareVersion
-
available_bytes
¶ Get the count of available bytes left.
Returns: Count of available bytes. Return type: int
-
bootloader_version
¶ Get the bootloader version which is contained in the loaded image.
Returns: Bootloader version (note: debug flag is not supported, it’s always False). Return type: FirmwareVersion
-
checksum
¶ Get the checksum over the application firmware part of the loaded image. This is the checksum which needs to be sent to the product bootloader.
Returns: Checksum as a byte. Return type: byte
-
product_type
¶ Get the product type for which the loaded firmware is made.
Returns: Product type as an integer. Return type: int
-
read
(size=-1)¶ Read the next bytes of the application firmware.
Parameters: size (int) – Maximum count of bytes to read (-1 reads all available) Returns: Firmware data block. Return type: bytes
-
size
¶ Get the size of the application firmware.
Returns: Size in bytes. Return type: int
-
Definitions¶
Sfc5xxxScaling¶
-
class
sensirion_shdlc_sfc5xxx.definitions.
Sfc5xxxScaling
[source]¶ An enum containing all available scaling variants with their corresponding byte values how they are transmitted over SHDLC.
-
NORMALIZED
= 0¶ Normalized to range [0…1].
-
PHYSICAL
= 1¶ Physical value with unit and fullscale of calibration.
-
USER_DEFINED
= 2¶ User defined unit and scaling as configured.
-
Sfc5xxxValveInputSource¶
-
class
sensirion_shdlc_sfc5xxx.definitions.
Sfc5xxxValveInputSource
[source]¶ An enum containing all available valve input sources with their corresponding byte values how they are transmitted over SHDLC.
-
CONTROLLER
= 0¶ Driven by the flow controller (default).
-
FORCE_CLOSED
= 1¶ Force closed (valve remains fully closed).
-
FORCE_OPEN
= 2¶ Force open (valve remains fully open).
-
HOLD
= 3¶ Hold the voltage on the valve.
-
USER_DEFINED
= 16¶ Apply user defined value (needs to be configured!).
-
Units¶
Sfc5xxxUnitPrefix¶
-
class
sensirion_shdlc_sfc5xxx.units.
Sfc5xxxUnitPrefix
(value, description, symbol)[source]¶ An enum containing all available medium unit prefixes with their corresponding byte values how they are transmitted over SHDLC.
-
YOCTO
= -24¶ Yocto (10^-24).
-
ZEPTO
= -21¶ Zepto (10^-21).
-
ATTO
= -18¶ Atto (10^-18).
-
FEMTO
= -15¶ Femto (10^-15).
-
PICO
= -12¶ Pico (10^-12).
-
NANO
= -9¶ Nano (10^-9).
-
MICRO
= -6¶ Micro (10^-6).
-
MILLI
= -3¶ Milli (10^-3).
-
CENTI
= -2¶ Centi (10^-2).
-
DECI
= -1¶ Deci (10^-1).
-
ONE
= 0¶ No prefix (10^0).
-
DECA
= 1¶ Deca (10^1).
-
HECTO
= 2¶ Hecto (10^2).
-
KILO
= 3¶ Kilo (10^3).
-
MEGA
= 6¶ Mega (10^6).
-
GIGA
= 9¶ Giga (10^9).
-
TERA
= 12¶ Tera (10^12).
-
PETA
= 15¶ Peta (10^15).
-
EXA
= 18¶ Exa (10^18).
-
ZETTA
= 21¶ Zetta (10^21).
-
YOTTA
= 24¶ Yotta (10^24).
-
UNDEFINED
= 127¶ Undefined.
-
__init__
(value, description, symbol)[source]¶ Constructor
Parameters: - value (int) – The integer value.
- description (str) – The prefix description.
- symbol (str) – The prefix symbol.
-
description
¶ The prefix description (str).
-
symbol
¶ The prefix symbol (str).
-
Sfc5xxxUnit¶
-
class
sensirion_shdlc_sfc5xxx.units.
Sfc5xxxUnit
(value, description, symbol)[source]¶ An enum containing all available medium units with their corresponding byte values how they are transmitted over SHDLC.
-
NORM_LITER
= 0¶ Norm Liter (0°C, 1013hPa)
-
STANDARD_LITER
= 1¶ Standard Liter (20°C, 1013hPa)
-
STANDARD_LITER_15C
= 2¶ Standard Liter (15°C, 1013hPa)
-
STANDARD_LITER_25C
= 3¶ Standard Liter (25°C, 1013hPa)
-
STANDARD_LITER_70F
= 4¶ Standard Liter (70°F, 1013hPa)
-
LITER_LIQUI
= 8¶ Liter (liqui).
-
GRAM
= 9¶ Gram (g).
-
PASCAL
= 16¶ Pascal (Pa).
-
BAR
= 17¶ Bar.
-
METER_H2O
= 18¶ Meter H2O (mH2O).
-
INCH_H2O
= 19¶ Inch H2O (iH2O).
-
PERCENT
= 250¶ Percent (%).
-
PERMIL
= 251¶ Permil (‰).
-
INT8
= 252¶ 8-Bit Signed Integer.
-
INT16
= 253¶ 16-Bit Signed Integer.
-
INT32
= 254¶ 32-Bit Signed Integer.
-
UNDEFINED
= 255¶ Undefined.
-
Sfc5xxxUnitTimeBase¶
-
class
sensirion_shdlc_sfc5xxx.units.
Sfc5xxxUnitTimeBase
(value, description, symbol)[source]¶ An enum containing all available medium unit time bases with their corresponding byte values how they are transmitted over SHDLC.
-
NONE
= 0¶ No Time Base.
-
MICROSECOND
= 1¶ Microsecond (µs).
-
MILLISECOND
= 2¶ Millisecond (ms).
-
SECOND
= 3¶ Second (s).
-
MINUTE
= 4¶ Minute (min).
-
HOUR
= 5¶ Hour (h).
-
DAY
= 6¶ Day.
-
UNDEFINED
= 255¶ Undefined.
-
Sfc5xxxMediumUnit¶
-
class
sensirion_shdlc_sfc5xxx.units.
Sfc5xxxMediumUnit
(prefix, unit, timebase)[source]¶ A class representing the medium unit specification used by various SHDLC commands. It consists of three members:
- Prefix (
Sfc5xxxUnitPrefix
) - Physical Unit (
Sfc5xxxUnit
) - Unit Timebase
(
Sfc5xxxUnitTimeBase
)
-
__init__
(prefix, unit, timebase)[source]¶ Constructor.
Parameters: - prefix (Sfc5xxxUnitPrefix) – The unit prefix.
- unit (Sfc5xxxUnit) – The physical unit.
- timebase (Sfc5xxxUnitTimeBase) – The unit time base.
-
prefix
¶ Unit prefix (
Sfc5xxxUnitPrefix
).
-
unit
¶ Physical unit (
Sfc5xxxUnit
).
-
timebase
¶ Unit timebase (
Sfc5xxxUnitTimeBase
).
- Prefix (
Types¶
Sfc5xxxCalibrationConditions¶
-
class
sensirion_shdlc_sfc5xxx.types.
Sfc5xxxCalibrationConditions
(company, operator, datetime, temperature, inlet_pressure, differential_pressure, is_real_gas_calibration, accuracy_setpoint, accuracy_fullscale)[source]¶ A class representing the calibration condition parameters as used to store the initial calibration conditions and recalibration conditions of gas calibration blocks.
The class provides some public members which you can access directly.
-
__init__
(company, operator, datetime, temperature, inlet_pressure, differential_pressure, is_real_gas_calibration, accuracy_setpoint, accuracy_fullscale)[source]¶ Constructor.
Parameters: - company (str) – The company which has created the calibration.
- operator (str) – The operator who has created the calibration.
- datetime (datetime) – Date and time when the calibration was created.
- temperature (float) – System/gas temperature [°C].
- inlet_pressure (float) – Absolute pressure of gas inlet [bar].
- differential_pressure (float) – Pressure difference between inlet and outlet [bar].
- is_real_gas_calibration (bool) – Whether the calibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
- accuracy_setpoint (float) – Calibration accuracy in percent of the setpoint.
- accuracy_fullscale (float) – Calibration accuracy in percent of fullscale.
-
company
¶ The company which has created the calibration (str).
-
operator
¶ The operator who has created the calibration (str).
-
datetime
¶ Date and time when the calibration was created (datetime).
-
temperature
¶ System/gas temperature [°C] (float).
-
inlet_pressure
¶ Absolute pressure [bar] of gas inlet (float).
-
differential_pressure
¶ Pressure difference [bar] between inlet and outlet (float).
-
is_real_gas_calibration
¶ Whether the calibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
-
accuracy_setpoint
¶ Calibration accuracy in percent of the setpoint (float).
-
accuracy_fullscale
¶ Calibration accuracy in percent of fullscale (float).
-
Sfc5xxxReadBufferResponse¶
-
class
sensirion_shdlc_sfc5xxx.types.
Sfc5xxxReadBufferResponse
(scaling, read_count, lost_values, remaining_values, sampling_time, values)[source]¶ Helper class representing the response to the “read measured value buffer” command, i.e. of the method
read_measured_value_buffer()
.The class provides some public members which you can access directly.
-
__init__
(scaling, read_count, lost_values, remaining_values, sampling_time, values)[source]¶ Creates an instance from the data received from the device.
Parameters: - scaling (Sfc5xxxScaling) – With which scale resp. unit the measured flow was read (parameter sent to the “read measured value buffer” command).
- read_count (int) – How many times the “read measured value buffer” was executed to fetch the values contained in this object.
- lost_values (int) – Number of lost values (received from the “read measured value buffer” command).
- remaining_values (int) – Number of values remaining in the buffer (received from the last “read measured value buffer” command).
- sampling_time (float) – The sampling time of the measured values in Seconds (received from the “read measured value buffer” command).
- values (list(float)) – The measured values read from the buffer (received from the “read measured value buffer” command).
-
scaling
¶ The scaling of the measured values (
Sfc5xxxScaling
).
-
read_count
¶ How many times the “read measured value buffer” was executed to fetch the values contained in this object (int).
-
lost_values
¶ Number of lost values due to buffer overrun (int).
-
remaining_values
¶ Number of values remaining in the buffer after reading it (int). If the whole buffer was read out, this is zero.
-
sampling_time
¶ The sampling time of the measured values in Seconds (float).
-
values
¶ The measured values read from the buffer (list of float).
-
Device Errors¶
Functionality Not Implemented Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFunctionalityNotImplementedError
[source]¶ The requested functionality is not implemented (yet) on the device.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Nvm Address Out Of Range Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxNvmAddressOutOfRangeError
[source]¶ Address of is outside of the non-volatile memory address space.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Frame Checksum Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFrameChecksumError
[source]¶ Frame checksum mismatch detected. If this error occurs, no MISO frame will be sent (internal error only).
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Invalid Special Frame Identifier Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxInvalidSpecialFrameIdentifierError
[source]¶ Illegal special frame identifier.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Frame Composition Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFrameCompositionError
[source]¶ Illegal frame composition. Probably wrong data size for given subcommand.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
No Broadcast Response Available Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxNoBroadcastResponseAvailableError
[source]¶ Triggered a broadcast response, but no valid response is available at the moment.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Internal Function Argument Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxInternalFunctionArgumentError
[source]¶ Internal function argument out of range.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
I2c Nack Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxI2cNackError
[source]¶ NACK received from I2C device.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
I2c Master Hold Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxI2cMasterHoldError
[source]¶ Master hold not released in I2C.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
I2c Crc Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxI2cCrcError
[source]¶ I2C CRC mismatch.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Sensor Data Write Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxSensorDataWriteError
[source]¶ Sensor data read back differs from written value.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Sensor Measure Loop Not Running Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxSensorMeasureLoopNotRunningError
[source]¶ Sensor measure loop is not running.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Start Signal Processor Timeout Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxStartSignalProcessorTimeoutError
[source]¶ Timeout while starting signal processor.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Stop Signal Processor Timeout Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxStopSignalProcessorTimeoutError
[source]¶ Timeout while stopping signal processor.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Modify Signal Processor Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxModifySignalProcessorError
[source]¶ Not possible to modify signal processor while startup or shut down.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Hardware Communication Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxHardwareCommunicationError
[source]¶ Hardware communication failed.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Invalid Calibration Index Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxInvalidCalibrationIndexError
[source]¶ No valid gas calibration block at given index.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Inalid Sensor Field Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxInalidSensorFieldError
[source]¶ No valid calibration at given sensor field index.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
I2c Start Condition Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxI2cStartConditionError
[source]¶ I2C lines (SCL or SDA) low before sending start condition.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Supply Voltage Out Of Range Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxSupplyVoltageOutOfRangeError
[source]¶ Supply voltage out of range.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Unknown Hardware Type Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxUnknownHardwareTypeError
[source]¶ Unknown hardware type.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Unknown Hardware Version Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxUnknownHardwareVersionError
[source]¶ Unknown hardware version.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Fram Write Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFramWriteError
[source]¶ FRAM write error (read back mismatch).
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Flash Write Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFlashWriteError
[source]¶ Flash write error (read back mismatch).
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Sensor Eeprom Write Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxSensorEepromWriteError
[source]¶ Sensor EEPROM write error (read back mismatch).
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Missing Gas Pressure Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxMissingGasPressureError
[source]¶ Missing gas pressure, could not reach setpoint.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
External Oscillator Startup Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxExternalOscillatorStartupError
[source]¶ Could not startup external oscillator. System now runs with internal oscillator (+/- 1%).
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Communication Adapter Not Available Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxCommunicationAdapterNotAvailableError
[source]¶ The requested type of communication adapter is not available.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Sensor Busy Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxSensorBusyError
[source]¶ The sensor is busy at the moment.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Command Not Allowed In Current State Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxCommandNotAllowedInCurrentStateError
[source]¶ This command is not allowed in the current state of the device.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Functionality Not Supported Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFunctionalityNotSupportedError
[source]¶ The device does not support this functionality.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Fatal Error¶
-
class
sensirion_shdlc_sfc5xxx.device_errors.
Sfc5xxxFatalError
[source]¶ Unspecified or fatal system error.
-
__init__
()[source]¶ Constructor.
Parameters: - code (byte) – The error code received from the device.
- message (string) – The error description for the given error code.
-
error_code
¶ Get the error code received from the device.
Returns: Received error code. Return type: byte
-
error_message
¶ Get the description of the received error code.
Returns: Error message. Return type: string
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
Commands¶
Device Information¶
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdDeviceInformationBase
(*args, **kwargs)[source]¶ SHDLC command 0xD0: “Device Information”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdGetProductType
[source]¶ Get Product Type Command
Get the product type of the device.
-
static
interpret_response
(data)[source]¶ Returns: The product type as an ASCII string. Return type: str
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdGetProductName
[source]¶ Get Product Name Command
Get the product name of the device. This information is also contained on the product label.
-
static
interpret_response
(data)[source]¶ Returns: The product name as an ASCII string. Return type: str
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdGetArticleCode
[source]¶ Get Article Code Command
Get the article code of the device. This information is also contained on the product label.
-
static
interpret_response
(data)[source]¶ Returns: The article code as an ASCII string. Return type: str
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdGetSerialNumber
[source]¶ Get Serial Number Command
Get the serial number of the device. This information is also contained on the product label.
-
static
interpret_response
(data)[source]¶ Returns: The serial number as an ASCII string. Return type: str
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.device_information.
Sfc5xxxCmdGetProductSubtype
[source]¶ Get Product Subtype Command
Get the product subtype of the device.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Get Version¶
-
class
sensirion_shdlc_sfc5xxx.commands.get_version.
Sfc5xxxCmdGetVersionBase
(*args, **kwargs)[source]¶ SHDLC command 0xD1: “Get Version”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_version.
Sfc5xxxCmdGetVersion
[source]¶ Get Version Command
Get the version information for the hardware, firmware and SHDLC protocol.
-
static
interpret_response
(data)[source]¶ Returns: - firmware_major (int) - Firmware major version number.
- firmware_minor (int) - Firmware minor version number.
- firmware_debug (bool) - Firmware debug state. All officially released and delivered firmware versions have this set to false (i.e. 0x00).
- hardware_major (int) - Hardware major version number.
- hardware_minor (int) - Hardware minor version number.
- protocol_major (int) - Protocol major version number.
- protocol_minor (int) - Protocol minor version number.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
Read Device Status¶
-
class
sensirion_shdlc_sfc5xxx.commands.read_device_status.
Sfc5xxxCmdReadDeviceStatusBase
(*args, **kwargs)[source]¶ SHDLC command 0xD2: “Read Device Status”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.read_device_status.
Sfc5xxxCmdReadDeviceStatus
(clear)[source]¶ Read Device Status Command
Read the current device status.
Note
When the device is running, some error situations can be detected. These errors will be memorized as flags in the state register of the device. If one or more of the error flags are set, this will be signalized to the master by setting the “Device Error Flag” in the state information byte of the MISO frame (see frame description). With this command you can readout the state register containing the 32 flags. Find a list of all flags in the appendix.
-
__init__
(clear)[source]¶ Constructor.
Parameters: clear (bool) – Set to true to clear the error flags after reading. Note: if the error situation remains after clearing, the flag will be set again (except the boot error flag #0).
-
static
interpret_response
(data)[source]¶ Returns: - device_status (int) - The device status as a register where 32 independent flags can be signalized. The meaning of the bits is defined in the appendix.
- boot_error (int) - If an error occurred during system boot, this will be marked by setting flag #0 in the status register. In addition to the flag, this error code defines what exactly went wrong.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Device Reset¶
-
class
sensirion_shdlc_sfc5xxx.commands.device_reset.
Sfc5xxxCmdDeviceResetBase
(*args, **kwargs)[source]¶ SHDLC command 0xD3: “Device Reset”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.device_reset.
Sfc5xxxCmdDeviceReset
[source]¶ Device Reset Command
Resets the device. This command has the same effect as a power-reset.
Note
The device will reply before executing the reset. After the response is sent, the device needs some time until it is ready for communication again (see post processing time). If the command is sent with broadcast, the reset is done directly after the reception of the command.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Slave Address¶
-
class
sensirion_shdlc_sfc5xxx.commands.slave_address.
Sfc5xxxCmdSlaveAddressBase
(*args, **kwargs)[source]¶ SHDLC command 0x90: “Slave Address”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.slave_address.
Sfc5xxxCmdGetSlaveAddress
[source]¶ Get Slave Address Command
Get the SHDLC slave address of the device.
-
static
interpret_response
(data)[source]¶ Returns: The current slave address of the device. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.slave_address.
Sfc5xxxCmdSetSlaveAddress
(slave_address)[source]¶ Set Slave Address Command
Set the SHDLC slave address of the device.
Note
The slave address is stored in non-volatile memory of the device and thus persists after a device reset. So the next time connecting to the device, you have to use the new address. When changing the address of a slave, make sure there isn’t already a slave with that address on the same bus! In that case you would get communication issues which can only be fixed by disconnecting one of the slaves.
-
__init__
(slave_address)[source]¶ Constructor.
Parameters: slave_address (int) – The new slave address to set.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Baudrate¶
-
class
sensirion_shdlc_sfc5xxx.commands.baudrate.
Sfc5xxxCmdBaudrateBase
(*args, **kwargs)[source]¶ SHDLC command 0x91: “Baudrate”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.baudrate.
Sfc5xxxCmdGetBaudrate
[source]¶ Get Baudrate Command
Get the SHDLC baudrate of the device.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.baudrate.
Sfc5xxxCmdSetBaudrate
(baudrate)[source]¶ Set Baudrate Command
Set the SHDLC baudrate of the device.
Note
The baudrate is stored in non-volatile memory of the device and thus persists after a device reset. So the next time connecting to the device, you have to use the new baudrate.
-
__init__
(baudrate)[source]¶ Constructor.
Parameters: baudrate (int) – The new baudrate in bit/s. Allowed values are 9600, 19200, 38400, 115200 (default), 230400 and 460800.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Factory Reset¶
-
class
sensirion_shdlc_sfc5xxx.commands.factory_reset.
Sfc5xxxCmdFactoryResetBase
(*args, **kwargs)[source]¶ SHDLC command 0x92: “Factory Reset”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.factory_reset.
Sfc5xxxCmdFactoryReset
[source]¶ Factory Reset Command
Perform a factory reset which will restore the off-the-shelf factory configuration. In addition, a device reset will be performed after restoring the factory configuration.
Note
This resets any configuration done after leaving the factory! Keep in mind that this command might also change communication parameters (i.e. baudrate and slave address) and thus you might have to adjust the driver’s parameters to allow further communication with the device.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Reply Delay¶
-
class
sensirion_shdlc_sfc5xxx.commands.reply_delay.
Sfc5xxxCmdReplyDelayBase
(*args, **kwargs)[source]¶ SHDLC command 0x95: “Reply Delay”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.reply_delay.
Sfc5xxxCmdGetReplyDelay
[source]¶ Get Reply Delay Command
Get the SHDLC reply delay of the device.
-
static
interpret_response
(data)[source]¶ Returns: The reply delay of the device in Microseconds. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.reply_delay.
Sfc5xxxCmdSetReplyDelay
(reply_delay)[source]¶ Set Reply Delay Command
Set the SHDLC reply delay of the device.
Note
The reply delay must not be set to a value smaller than 2us! Due to a bug in some firmware versions, the values 0us and 1us can lead to unrecoverable communication issues!
-
__init__
(reply_delay)[source]¶ Constructor.
Parameters: reply_delay (int) – The reply delay in Microseconds.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Setpoint¶
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint.
Sfc5xxxCmdSetpointBase
(*args, **kwargs)[source]¶ SHDLC command 0x00: “Setpoint”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint.
Sfc5xxxCmdGetSetpoint
(scaling)[source]¶ Get Setpoint Command
Get the current flow setpoint.
-
__init__
(scaling)[source]¶ Constructor.
Parameters: scaling (int) – Defines with which scale resp. unit the setpoint should be returned:
- 0x00: Normalized setpoint in range [0.0 … 1.0]
- 0x01: Setpoint represents a physical value. The range depends on the flow unit and calibration range.
- 0x02: Setpoint represents a value in the user defined medium unit. Requires at least firmware version 1.40.
-
static
interpret_response
(data)[source]¶ Returns: The current setpoint with the specified scaling. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint.
Sfc5xxxCmdSetSetpoint
(scaling, setpoint)[source]¶ Set Setpoint Command
Set the flow setpoint which is used by the flow controller as reference input.
Note
If the “setpoint persists” feature is enabled, the setpoint will be stored in non-volatile memory and re-applied after a device reset.
-
__init__
(scaling, setpoint)[source]¶ Constructor.
Parameters: - scaling (int) –
Defines with which scale resp. unit the setpoint is transmitted:
- 0x00: Normalized setpoint in range [0.0 … 1.0]
- 0x01: Setpoint represents a physical value. The range depends on the flow unit and calibration range.
- 0x02: Setpoint represents a value in the user defined medium unit. Requires at least firmware version 1.40.
- setpoint (float) – The new setpoint with the specified scaling.
- scaling (int) –
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Setpoint Persist¶
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint_persist.
Sfc5xxxCmdSetpointPersistBase
(*args, **kwargs)[source]¶ SHDLC command 0x02: “Setpoint Persist”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint_persist.
Sfc5xxxCmdSetSetpointPersist
(persist)[source]¶ Set Setpoint Persist Command
Allows to define if a setpoint should persist after a reset (soft or hardreset) or if it should be set to zero.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(persist)[source]¶ Constructor.
Parameters: persist (bool) – Whether the setpoint should persist after a reset or not.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.setpoint_persist.
Sfc5xxxCmdGetSetpointPersist
[source]¶ Get Setpoint Persist Command
Get the setpoint persist configuration.
-
static
interpret_response
(data)[source]¶ Returns: Whether the setpoint should persist after a reset or not. Return type: bool
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
Set Setpoint And Read Measured Value¶
-
class
sensirion_shdlc_sfc5xxx.commands.set_setpoint_and_read_measured_value.
Sfc5xxxCmdSetSetpointAndReadMeasuredValueBase
(*args, **kwargs)[source]¶ SHDLC command 0x03: “Set Setpoint And Read Measured Value”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.set_setpoint_and_read_measured_value.
Sfc5xxxCmdSetSetpointAndReadMeasuredValue
(scaling, setpoint)[source]¶ Set Setpoint And Read Measured Value Command
This command is a combination of the two commands “Set Setpoint (0x00)” and “Read Measured Value (0x08)”. It is intended for process data exchange (setpoint and flow) and safes a lot of protocol overhead compared to separate command usage.
Note
If the “setpoint persists” feature is enabled, the setpoint will be stored in non-volatile memory and re-applied after a device reset.
-
__init__
(scaling, setpoint)[source]¶ Constructor.
Parameters: - scaling (int) –
Defines with which scale resp. unit the setpoint and measured flow are transmitted:
- 0x00: Normalized setpoint/flow in range [0.0 … 1.0]
- 0x01: Setpoint/flow represents physical values. The range depends on the flow unit and calibration range.
- 0x02: Setpoint/flow represent values in the user defined medium unit. Requires at least firmware version 1.40.
- setpoint (float) – The new setpoint with the specified scaling.
- scaling (int) –
-
static
interpret_response
(data)[source]¶ Returns: The latest measured flow with the specified scaling. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Read Measured Value¶
-
class
sensirion_shdlc_sfc5xxx.commands.read_measured_value.
Sfc5xxxCmdReadMeasuredValueBase
(*args, **kwargs)[source]¶ SHDLC command 0x08: “Read Measured Value”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.read_measured_value.
Sfc5xxxCmdReadMeasuredValue
(scaling)[source]¶ Read Measured Value Command
The command returns the latest measured flow value. The value can be read as physical or normalized value.
-
__init__
(scaling)[source]¶ Constructor.
Parameters: scaling (int) – Defines with which scale resp. unit the measured flow should be returned:
- 0x00: Normalized flow in range [0.0 … 1.0]
- 0x01: Flow represents a physical value. The range depends on the flow unit and calibration range.
- 0x02: Flow represents a value in the user defined medium unit. Requires at least firmware version 1.40.
-
static
interpret_response
(data)[source]¶ Returns: The latest measured flow with the specified scaling. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Read Measured Value Buffer¶
-
class
sensirion_shdlc_sfc5xxx.commands.read_measured_value_buffer.
Sfc5xxxCmdReadMeasuredValueBufferBase
(*args, **kwargs)[source]¶ SHDLC command 0x09: “Read Measured Value Buffer”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.read_measured_value_buffer.
Sfc5xxxCmdReadMeasuredValueBuffer
(scaling)[source]¶ Read Measured Value Buffer Command
The MFC has an internal ring buffer in which the measured flow values are automatically stored in a regular interval. The size of the buffer is between 85 and 256 (depends on the specific device configuration). With this command you can readout the buffered values (maximum 60 values per transfer, due to the limited space in the data part of the SHDLC frame). If you do not readout the buffer or you are too slow with reading, the oldest values will be lost.
Note
The values which have been read will automatically be cleared from the ring buffer.
-
__init__
(scaling)[source]¶ Constructor.
Parameters: scaling (int) – Defines with which scale resp. unit the measured flow should be returned:
- 0x00: Normalized flow in range [0.0 … 1.0]
- 0x01: Flow represents a physical value. The range depends on the flow unit and calibration range.
- 0x02: Flow represents a value in the user defined medium unit. Requires at least firmware version 1.40.
-
static
interpret_response
(data)[source]¶ Returns: - lost_value_count (int) - If the time between the “Read Measured Value Buffer” command calls is to large, the internal ring buffer will overrun. In this case, the oldest value in the buffer is cleared when a new value enters. This number is a counter which counts the missing values between the function calls (number of values which were not readout by the bus master).
- remaining_value_count (int) - The number of values which remains in the buffer after this command call (the number of returned values is limited to 60 values because the maximum allowed data part in the SHDLC frame is 255 bytes).
- sampling_time (float) - Time between the measured values in Seconds.
- measured_values (list(float)) - The measured values read from the ring buffer (0…60 values) with the specified scaling.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Valve Input Source Configuration¶
-
class
sensirion_shdlc_sfc5xxx.commands.valve_input_source_configuration.
Sfc5xxxCmdValveInputSourceConfigurationBase
(*args, **kwargs)[source]¶ SHDLC command 0x20: “Valve Input Source Configuration”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.valve_input_source_configuration.
Sfc5xxxCmdGetValveInputSource
[source]¶ Get Valve Input Source Command
Get the input source for the valve, i.e. the input which controls the valve voltage.
-
static
interpret_response
(data)[source]¶ Returns: The current valve input source: - 0x00: Controller (default), driven by the flow controller.
- 0x01: Force closed, valve remains fully closed.
- 0x02: Force open, valve remains fully open.
- 0x03: Hold, hold the voltage on the valve.
- 0x10: User defined, apply user defined value [0..1].
Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.valve_input_source_configuration.
Sfc5xxxCmdSetValveInputSource
(input_source)[source]¶ Set Valve Input Source Command
Set the input source for the valve, i.e. the input which controls the valve voltage.
Note
This configuration is volatile.
-
__init__
(input_source)[source]¶ Constructor.
Parameters: input_source (int) – The valve input source to set:
- 0x00: Controller (default), driven by the flow controller.
- 0x01: Force closed, valve remains fully closed.
- 0x02: Force open, valve remains fully open.
- 0x03: Hold, hold the voltage on the valve.
- 0x10: User defined, apply user defined value [0..1].
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.valve_input_source_configuration.
Sfc5xxxCmdGetUserDefinedValveValue
[source]¶ Get User Defined Valve Value Command
Get the value which is applied to the valve when the valve input source is set to user defined.
-
static
interpret_response
(data)[source]¶ Returns: The current user defined valve value [0..1]. 0.0 means fully closed, 1.0 means fully open. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.valve_input_source_configuration.
Sfc5xxxCmdSetUserDefinedValveValue
(value)[source]¶ Set User Defined Valve Value Command
Set the value which is applied to the valve when the valve input source is set to user defined.
Note
This configuration is volatile.
-
__init__
(value)[source]¶ Constructor.
Parameters: value (float) – The user defined valve value to set [0..1]. 0.0 means fully closed, 1.0 means fully open.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Medium Unit Configuration¶
-
class
sensirion_shdlc_sfc5xxx.commands.medium_unit_configuration.
Sfc5xxxCmdMediumUnitConfigurationBase
(*args, **kwargs)[source]¶ SHDLC command 0x21: “Medium Unit Configuration”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.medium_unit_configuration.
Sfc5xxxCmdGetUserDefinedMediumUnit
[source]¶ Get User Defined Medium Unit Command
Get the user defined medium unit.
-
static
interpret_response
(data)[source]¶ Returns: - prefix (int) - Medium unit prefix, see appendix for encoding. 0x7F = Use medium unit prefix from calibration.
- unit (int) - Medium unit, see appendix for encoding. 0xFF = Use medium unit from calibration.
- timebase (int) - Timebase, see appendix for encoding. 0xFF = Use timebase from calibration.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.medium_unit_configuration.
Sfc5xxxCmdSetUserDefinedMediumUnit
(prefix, unit, timebase)[source]¶ Set User Defined Medium Unit Command
Set the user defined medium unit.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(prefix, unit, timebase)[source]¶ Constructor.
Parameters: - prefix (int) – Medium unit prefix, see appendix for encoding. 0x7F = Use medium unit prefix from calibration.
- unit (int) – Medium unit, see appendix for encoding. 0xFF = Use medium unit from calibration.
- timebase (int) – Timebase, see appendix for encoding. 0xFF = Use timebase from calibration.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.medium_unit_configuration.
Sfc5xxxCmdGetUserDefinedMediumUnitWithoutWildcards
[source]¶ Get User Defined Medium Unit Without Wildcards Command
Get the user defined medium unit with wildcards substituted with their actual units.
-
static
interpret_response
(data)[source]¶ Returns: - prefix (int) - Medium unit prefix, see appendix for encoding.
- unit (int) - Medium unit, see appendix for encoding.
- timebase (int) - Timebase, see appendix for encoding.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.medium_unit_configuration.
Sfc5xxxCmdGetUserDefinedFullscale
[source]¶ Get User Defined Fullscale Command
Get the fullscale flow in the user defined medium unit.
-
static
interpret_response
(data)[source]¶ Returns: Fullscale for user defined medium unit. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
Controller Configuration¶
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdControllerConfigurationBase
(*args, **kwargs)[source]¶ SHDLC command 0x22: “Controller Configuration”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdGetUserControllerGain
[source]¶ Get User Controller Gain Command
Get the user defined controller gain.
-
static
interpret_response
(data)[source]¶ Returns: The current user controller gain. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdSetUserControllerGain
(gain)[source]¶ Set User Controller Gain Command
Set the user defined controller gain.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdGetPressureDependentGainEnable
[source]¶ Get Pressure Dependent Gain Enable Command
Get the pressure dependent gain enable state.
-
static
interpret_response
(data)[source]¶ Returns: The current state of the pressure dependent gain. Return type: bool
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdSetPressureDependentGainEnable
(enable)[source]¶ Set Pressure Dependent Gain Enable Command
Set the pressure dependent gain enable state.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(enable)[source]¶ Constructor.
Parameters: enable (bool) – The pressure dependent gain state to set.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdGetInletPressureForGainCorrection
[source]¶ Get Inlet Pressure For Gain Correction Command
Get the inlet pressure used for the pressure dependent gain.
-
static
interpret_response
(data)[source]¶ Returns: The currently set inlet pressure [bar]. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdSetInletPressureForGainCorrection
(pressure)[source]¶ Set Inlet Pressure For Gain Correction Command
Set the inlet pressure used for the pressure dependent gain.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(pressure)[source]¶ Constructor.
Parameters: pressure (float) – The inlet pressure to set [bar].
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdGetGasTemperatureCompensationEnable
[source]¶ Get Gas Temperature Compensation Enable Command
Get the gas temperature compensation enable state.
-
static
interpret_response
(data)[source]¶ Returns: The current state of the temperature compensation. Return type: bool
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdSetGasTemperatureCompensationEnable
(enable)[source]¶ Set Gas Temperature Compensation Enable Command
Set the gas temperature compensation enable state.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(enable)[source]¶ Constructor.
Parameters: enable (bool) – The temperature compensation state to set.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdGetInletGasTemperatureForCompensation
[source]¶ Get Inlet Gas Temperature For Compensation Command
Get the inlet gas temperature used for the temperature compensation.
-
static
interpret_response
(data)[source]¶ Returns: The currently set inlet gas temperature [°C]. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.controller_configuration.
Sfc5xxxCmdSetInletGasTemperatureForCompensation
(temperature)[source]¶ Set Inlet Gas Temperature For Compensation Command
Set the inlet gas temperature used for the temperature compensation.
Note
This configuration is stored in non-volatile memory of the device and thus persists after a device reset.
-
__init__
(temperature)[source]¶ Constructor.
Parameters: temperature (float) – The inlet gas temperature to set [°C].
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Advanced Measurements¶
-
class
sensirion_shdlc_sfc5xxx.commands.advanced_measurements.
Sfc5xxxCmdAdvancedMeasurementsBase
(*args, **kwargs)[source]¶ SHDLC command 0x30: “Advanced Measurements”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.advanced_measurements.
Sfc5xxxCmdMeasureRawFlow
[source]¶ Measure Raw Flow Command
Perform a flow measurement and return the measured raw flow ticks from the sensor.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.advanced_measurements.
Sfc5xxxCmdMeasureRawThermalConductivity
(use_temperature_compensation=None)[source]¶ Measure Raw Thermal Conductivity Command
Perform a thermal conductivity measurement and return the measured raw tick value.
Note
The valve must be fully closed for at least 500ms to get correct results!
-
__init__
(use_temperature_compensation=None)[source]¶ Constructor.
Parameters: use_temperature_compensation (int) – This parameter (existing since V1.56) allows to choose between uncompensated and temperature compensated measurement. If this parameter is not used, the compensated value will be returned if possible, otherwise the uncompensated value will be returned:
- 0x00: Read uncompensated thermal conductivity
- 0x01: Read temperature compensated thermal conductivity
This parameter is optional. When passing
None
(the default), it is not sent to the device at all.
-
static
interpret_response
(data)[source]¶ Returns: Measured raw thermal conductivity in ticks. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.advanced_measurements.
Sfc5xxxCmdMeasureRawThermalConductivityWithClosedValve
(use_temperature_compensation=None)[source]¶ Measure Raw Thermal Conductivity With Closed Valve Command
Perform a thermal conductivity measurement and return the measured raw tick value. The valve is automatically closed during the measurement.
-
__init__
(use_temperature_compensation=None)[source]¶ Constructor.
Parameters: use_temperature_compensation (int) – This parameter (existing since V1.56) allows to choose between uncompensated and temperature compensated measurement. If this parameter is not used, the compensated value will be returned if possible, otherwise the uncompensated value will be returned:
- 0x00: Read uncompensated thermal conductivity
- 0x01: Read temperature compensated thermal conductivity
This parameter is optional. When passing
None
(the default), it is not sent to the device at all.
-
static
interpret_response
(data)[source]¶ Returns: Measured raw thermal conductivity in ticks. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.advanced_measurements.
Sfc5xxxCmdMeasureTemperature
[source]¶ Measure Temperature Command
Perform a gas temperature measurement.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Get Calibration Information¶
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationInformationBase
(*args, **kwargs)[source]¶ SHDLC command 0x40: “Get Calibration Information”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetNumberOfCalibrations
[source]¶ Get Number Of Calibrations Command
Get the number of calibrations, i.e. how many calibration blocks the device memory is able to hold.
Note
Not all calibration blocks actually contain a valid gas calibration. Use the command Get Calibration Validity to check which calibrations are valid and thus can be activated.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationValidity
(index)[source]¶ Get Calibration Validity Command
Check whether there exists a valid calibration at a specific index or not.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The index to check whether there is a valid calibration or not.
-
static
interpret_response
(data)[source]¶ Returns: Whether there exists a valid calibration at the specified index or not. Return type: bool
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationGasDescription
(index)[source]¶ Get Calibration Gas Description Command
Get the gas description string of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationGasId
(index)[source]¶ Get Calibration Gas Id Command
Get the gas ID of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationGasUnit
(index)[source]¶ Get Calibration Gas Unit Command
Get the gas unit of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
static
interpret_response
(data)[source]¶ Returns: - prefix (int) - Medium unit prefix, see appendix for encoding.
- unit (int) - Medium unit, see appendix for encoding.
- timebase (int) - Timebase, see appendix for encoding.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationFullscale
(index)[source]¶ Get Calibration Fullscale Command
Get the fullscale flow of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
static
interpret_response
(data)[source]¶ Returns: The read fullscale flow in the unit of the corresponding calibration. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationInitialConditions
(index)[source]¶ Get Calibration Initial Conditions Command
Get the initial calibration conditions of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
static
interpret_response
(data)[source]¶ Returns: - company (str) - The company which has created the calibration.
- operator (str) - The operator who has created the calibration.
- year (int) - Year of the calibration date.
- month (int) - Month of the calibration date.
- day (int) - Day of the calibration date.
- hour (int) - Hour of the calibration time.
- minute (int) - Minute of the calibration time.
- temperature (float) - System/gas temperature [°C] of calibration.
- inlet_pressure (float) - Absolute pressure of gas inlet [bar].
- differential_pressure (float) - Pressure difference between inlet and outlet [bar].
- is_real_gas_calibration (bool) - Whether the calibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
- accuracy_setpoint (float) - Calibration accuracy in percent of the setpoint. This accuracy is valid if larger than the accuracy of fullscale.
- accuracy_fullscale (float) - Calibration accuracy in percent of fullscale. This value is valid if larger than the accuracy of the setpoint.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationRecalibrationConditions
(index)[source]¶ Get Calibration Recalibration Conditions Command
Get the recalibration conditions of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
static
interpret_response
(data)[source]¶ Returns: - company (str) - The company which has created the recalibration.
- operator (str) - The operator who has created the recalibration.
- year (int) - Year of the recalibration date.
- month (int) - Month of the recalibration date.
- day (int) - Day of the recalibration date.
- hour (int) - Hour of the recalibration time.
- minute (int) - Minute of the recalibration time.
- temperature (float) - System/gas temperature [°C] of recalibration.
- inlet_pressure (float) - Absolute pressure of gas inlet [bar].
- differential_pressure (float) - Pressure difference between inlet and outlet [bar].
- is_real_gas_calibration (bool) - Whether the recalibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
- accuracy_setpoint (float) - Calibration accuracy in percent of the setpoint. This accuracy is valid if larger than the accuracy of fullscale.
- accuracy_fullscale (float) - Calibration accuracy in percent of fullscale. This value is valid if larger than the accuracy of the setpoint.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_calibration_information.
Sfc5xxxCmdGetCalibrationThermalConductivityReference
(index)[source]¶ Get Calibration Thermal Conductivity Reference Command
Get the thermal conductivity reference value of a specific calibration index.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The calibration index to read the requested information from.
-
static
interpret_response
(data)[source]¶ Returns: Thermal conductivity reference value for the gas. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
Get Current Calibration Information¶
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentCalibrationInformationBase
(*args, **kwargs)[source]¶ SHDLC command 0x44: “Get Current Calibration Information”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentGasDescription
[source]¶ Get Current Gas Description Command
Get the gas description string of the currently active calibration.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentGasId
[source]¶ Get Current Gas Id Command
Get the gas ID of the currently active calibration.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentGasUnit
[source]¶ Get Current Gas Unit Command
Get the gas unit of the currently active calibration.
-
static
interpret_response
(data)[source]¶ Returns: - prefix (int) - Medium unit prefix, see appendix for encoding.
- unit (int) - Medium unit, see appendix for encoding.
- timebase (int) - Timebase, see appendix for encoding.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentFullscale
[source]¶ Get Current Fullscale Command
Get the fullscale flow of the currently active calibration.
-
static
interpret_response
(data)[source]¶ Returns: The read fullscale flow in the unit of the corresponding calibration. Return type: float
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentInitialCalibrationConditions
[source]¶ Get Current Initial Calibration Conditions Command
Get the initial calibration conditions of the currently active calibration.
-
static
interpret_response
(data)[source]¶ Returns: - company (str) - The company which has created the calibration.
- operator (str) - The operator who has created the calibration.
- year (int) - Year of the calibration date.
- month (int) - Month of the calibration date.
- day (int) - Day of the calibration date.
- hour (int) - Hour of the calibration time.
- minute (int) - Minute of the calibration time.
- temperature (float) - System/gas temperature [°C] of calibration.
- inlet_pressure (float) - Absolute pressure of gas inlet [bar].
- differential_pressure (float) - Pressure difference between inlet and outlet [bar].
- is_real_gas_calibration (bool) - Whether the calibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
- accuracy_setpoint (float) - Calibration accuracy in percent of the setpoint. This accuracy is valid if larger than the accuracy of fullscale.
- accuracy_fullscale (float) - Calibration accuracy in percent of fullscale. This value is valid if larger than the accuracy of the setpoint.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentRecalibrationConditions
[source]¶ Get Current Recalibration Conditions Command
Get the recalibration conditions of the currently active calibration.
-
static
interpret_response
(data)[source]¶ Returns: - company (str) - The company which has created the recalibration.
- operator (str) - The operator who has created the recalibration.
- year (int) - Year of the recalibration date.
- month (int) - Month of the recalibration date.
- day (int) - Day of the recalibration date.
- hour (int) - Hour of the recalibration time.
- minute (int) - Minute of the recalibration time.
- temperature (float) - System/gas temperature [°C] of recalibration.
- inlet_pressure (float) - Absolute pressure of gas inlet [bar].
- differential_pressure (float) - Pressure difference between inlet and outlet [bar].
- is_real_gas_calibration (bool) - Whether the recalibration was performed with the real process gas (true) or if it was calculated from a different gas (false).
- accuracy_setpoint (float) - Calibration accuracy in percent of the setpoint. This accuracy is valid if larger than the accuracy of fullscale.
- accuracy_fullscale (float) - Calibration accuracy in percent of fullscale. This value is valid if larger than the accuracy of the setpoint.
Return type: tuple
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
-
class
sensirion_shdlc_sfc5xxx.commands.get_current_calibration_information.
Sfc5xxxCmdGetCurrentThermalConductivityReference
[source]¶ Get Current Thermal Conductivity Reference Command
Get the thermal conductivity reference value of the currently active calibration.
-
static
interpret_response
(data)[source]¶ Returns: Thermal conductivity reference value for the gas. Return type: int
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
static
Activate Calibration¶
-
class
sensirion_shdlc_sfc5xxx.commands.activate_calibration.
Sfc5xxxCmdActivateCalibrationBase
(*args, **kwargs)[source]¶ SHDLC command 0x45: “Activate Calibration”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.activate_calibration.
Sfc5xxxCmdActivateCalibration
(index)[source]¶ Activate Calibration Command
This command loads a calibration from calibration memory and runs the flow controller. If the specified calibration is already active, this command does nothing. The active calibration is stored in non-volatile memory and will automatically be re-activated after a device reset.
Note
Caution: This command will cause a write operation in an EEPROM. Because of the limited write cycles of the EEPROM, this command should not be called periodical (max 50’000 times with a new calibration). Loading the same calibration again is not a problem and will not cause a write operation.
-
__init__
(index)[source]¶ Constructor.
Parameters: index (int) – The index of the calibration to activate.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
User Memory Access¶
-
class
sensirion_shdlc_sfc5xxx.commands.user_memory_access.
Sfc5xxxCmdUserMemoryAccessBase
(*args, **kwargs)[source]¶ SHDLC command 0x6E: “User Memory Access”.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.user_memory_access.
Sfc5xxxCmdReadUserMemory
(address, length)[source]¶ Read User Memory Command
Read data from the user memory.
-
__init__
(address, length)[source]¶ Constructor.
Parameters: - address (int) – Address from where to start reading.
- length (int) – Defines how many bytes should be read.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-
-
class
sensirion_shdlc_sfc5xxx.commands.user_memory_access.
Sfc5xxxCmdWriteUserMemory
(address, length, write_data)[source]¶ Write User Memory Command
Write data into the user memory.
-
__init__
(address, length, write_data)[source]¶ Constructor.
Parameters: - address (int) – Address from where to start writing.
- length (int) – Defines how many bytes should be written.
- write_data (bytes) – The data to be written.
-
check_response_length
(data)¶ Check if the response length is correct.
Parameters: data (bytes) – Raw data (payload) received from the device. Raises: ShdlcResponseError – If length is wrong.
-
data
¶ Get the command data (payload).
Returns: Command data (length 0..255). Return type: bytes
-
id
¶ Get the command ID.
Returns: Command ID (0..255). Return type: byte
-
interpret_response
(data)¶ Interpret the response to this command received from the device. This converts the raw byte array to the actual data type(s) depending on the sent command.
Parameters: data (bytes) – Raw data (payload) received from the device. Returns: Interpreted response. Data type and meaning depends on the sent command. None for commands without response data. See the actual command implementation for details.
-
max_response_time
¶ Get the maximum response time for this command.
Returns: Maximum response time in seconds. Return type: float
-
post_processing_time
¶ Get the post processing time for this command. The post processing time defines how long a device needs to execute a command after responding to the SHDLC command. Most devices don’t need post processing (command is executed before the response is sent). Only special commands (e.g. a device reset) are executed after the response is sent.
Returns: Maximum response time in seconds. Return type: float
-