Source code for sensirion_i2c_sen62.commands

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2026 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:     sensirion-driver-generator 1.5.3
# Product:       sen62
# Model-Version: 1.1.0
#
"""
The transfer classes specify the data that is transferred between host and sensor. The generated transfer classes
are used by the driver class and not intended for direct use.
"""

from sensirion_driver_adapters.transfer import Transfer
from sensirion_driver_adapters.rx_tx_data import TxData, RxData
from sensirion_driver_support_types.bitfield import BitField, BitfieldContainer


[docs] class DeviceStatus(BitfieldContainer): reserved1 = BitField(offset=0, width=4) fan_error = BitField(offset=4, width=1) reserved2 = BitField(offset=5, width=1) rht_error = BitField(offset=6, width=1) gas_error = BitField(offset=7, width=1) reserved3 = BitField(offset=8, width=3) pm_error = BitField(offset=11, width=1) reserved6 = BitField(offset=12, width=9) fan_speed_warning = BitField(offset=21, width=1)
[docs] class StartContinuousMeasurement(Transfer): """ Starts a continuous measurement. After starting the measurement, it takes some time (~1.1s) until the first measurement results are available. You could poll with the command "Get Data Ready" to check when the results are ready to read. This command is only available in idle mode. If the device is already in any measure mode, this command has no effect. """ CMD_ID = 0x21
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.05, slave_address=None, ignore_ack=False)
[docs] class StopMeasurement(Transfer): """ Stops the measurement and returns to idle mode. After sending this command, wait at least 1000 ms before starting a new measurement. If the device is already in idle mode, this command has no effect. """ CMD_ID = 0x104
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=1.0, slave_address=None, ignore_ack=False)
[docs] class GetDataReady(Transfer): """ This command can be used to check if new measurement results are ready to read. The data ready flag is automatically reset after reading the measurement values. """ CMD_ID = 0x202
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>B?')
[docs] class ReadMeasuredValuesAsIntegers(Transfer): """ Returns the measured values. The command \"Get Data Ready\" can be used to check if new data is available since the last read operation. If no new data is available, the previous values will be returned again. If no data is available at all (e.g. measurement not running for at least one second), all values will be at their upper limit (0xFFFF for `uint16`, 0x7FFF for `int16`). """ CMD_ID = 0x4a3
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>HHHHhh')
[docs] class ReadNumberConcentrationValuesAsIntegers(Transfer): """ Returns the measured number concentration values. The command 0x0202 "Get Data Ready" can be used to check if new data is available since the last read operation. If no new data is available, the previous values will be returned again. If no data is available at all (e.g. measurement not running for at least one second), all values will be at their upper limit (0xFFFF for `uint16`). """ CMD_ID = 0x316
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>HHHHH')
[docs] class ReadMeasuredRawValues(Transfer): """ Returns the measured raw values. The command 0x0202 \"Get Data Ready\" can be used to check if new data is available since the last read operation. If no new data is available, the previous values will be returned again. If no data is available at all (e.g. measurement not running for at least one second), all values will be at their upper limit (0x7FFF for `int16`). """ CMD_ID = 0x492
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>hh')
[docs] class StartFanCleaning(Transfer): """ This command triggers fan cleaning. The fan is set to the maximum speed for 10 seconds and then automatically stopped. Wait at least 10s after this command before starting a measurement. """ CMD_ID = 0x5607
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False)
[docs] class SetTemperatureOffsetParameters(Transfer): """ This command allows to compensate temperature effects of the design-in at customer side by applying custom temperature offsets to the ambient temperature. The compensated ambient temperature is calculated as follows: * T_Ambient_Compensated = T_Ambient + (slope * T_Ambient) + offset Where `slope` and `offset` are the values set with this command, smoothed with the specified time constant. All temperatures (`T_Ambient_Compensated`, `T_Ambient` and `offset`) are represented in °C. There are 5 temperature offset slots available that all contribute additively to `T_Ambient_Compensated`. The default values for the temperature offset parameters are all zero, meaning that `T_Ambient_Compensated` is equal to `T_Ambient` by default. The parameters can be changed in any state of the device, i.e. both in idle mode and in measure mode. """ CMD_ID = 0x60b2 def __init__(self, offset, slope, time_constant, slot): self._offset = offset self._slope = slope self._time_constant = time_constant self._slot = slot
[docs] def pack(self): return self.tx_data.pack([self._offset, self._slope, self._time_constant, self._slot])
tx = TxData(CMD_ID, '>HhhHH', device_busy_delay=0.02, slave_address=None, ignore_ack=False)
[docs] class SetTemperatureAccelerationParameters(Transfer): """ This command allows to set custom temperature acceleration parameters of the RH/T engine. It overwrites the default temperature acceleration parameters of the RH/T engine with custom values. This configuration is volatile, i.e. the parameters will be reverted to their default values after a device reset. """ CMD_ID = 0x6100 def __init__(self, k, p, t1, t2): self._k = k self._p = p self._t1 = t1 self._t2 = t2
[docs] def pack(self): return self.tx_data.pack([self._k, self._p, self._t1, self._t2])
tx = TxData(CMD_ID, '>HHHHH', device_busy_delay=0.02, slave_address=None, ignore_ack=False)
[docs] class ActivateShtHeater(Transfer): """ Activate the heater feature of the SHT4x sensor. This command allows to use the inbuilt heater in SHT sensor to decontaminate and reverse creep at high humidity. This command activates the SHT sensor heater with 200mW for 1s. The SHT heater measurement done just before deactivation can be read using the command \"Get SHT Heater Measurements\" after the duration of the heating feature as specified in the SHT4x datasheet. Wait at least 20s after this command before starting a measurement to get coherent temperature values (heating consequence to disappear). """ CMD_ID = 0x6765
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False)
[docs] class GetShtHeaterMeasurements(Transfer): """ Get the measurement values when the SHT sensor heating is finished. """ CMD_ID = 0x6790
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>hh')
[docs] class GetProductName(Transfer): """Gets the product name from the device.""" CMD_ID = 0xd014
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>32s')
[docs] class GetSerialNumber(Transfer): """Gets the serial number from the device.""" CMD_ID = 0xd033
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>32s')
[docs] class GetVersion(Transfer): """Gets the version information for the hardware, firmware and communication protocol.""" CMD_ID = 0xd100
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>BB')
[docs] class ReadDeviceStatus(Transfer): """ Reads the current device status. Use this command to get detailed information about the device status. The device status is encoded in flags. Each device status flag represents a single bit in a 32-bit integer value. If more than one error is present, the device status register value is the sum of the corresponding flag values. For details about the available flags, refer to the device status flags documentation in the data sheet. """ CMD_ID = 0xd206
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>I')
[docs] class ReadAndClearDeviceStatus(Transfer): """ Reads the current device status (like command 0xD206 "Read Device Status") and afterwards clears all flags. """ CMD_ID = 0xd210
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.02, slave_address=None, ignore_ack=False) rx = RxData('>I')
[docs] class DeviceReset(Transfer): """Executes a reset on the device. This has the same effect as a power cycle.""" CMD_ID = 0xd304
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=1.2, slave_address=None, ignore_ack=False)