API Reference

Sen5xI2cDevice

Sen5xMeasuredValues

class sensirion_i2c_sen5x.measured_values.Sen5xMeasuredValues(values)[source]

Represents a SEN5x measurement response for the “Read Measured Values” command.

Response Data Types

Sen5xMassConcentration

class sensirion_i2c_sen5x.response_types.Sen5xMassConcentration(ticks)[source]

Represents a SEN5x measurement response for the particulate matter mass concentration.

With the ticks attribute you can access the raw data as received from the device. For the converted physical value the physical attribute is available. The attribute available can be used to check whether the value is available or not.

Sen5xHumidity

class sensirion_i2c_sen5x.response_types.Sen5xHumidity(ticks)[source]

Represents a SEN5x measurement response for the humidity.

With the ticks attribute you can access the raw data as received from the device. For the converted value the percent_rh attribute is available. The attribute available can be used to check whether the value is available or not.

Sen5xTemperature

class sensirion_i2c_sen5x.response_types.Sen5xTemperature(ticks)[source]

Represents a SEN5x measurement response for the temperature.

With the ticks attribute you can access the raw data as received from the device. For the converted values you can choose between degrees_celsius and degrees_fahrenheit. The attribute available can be used to check whether the value is available or not.

Sen5xAirQualityIndex

class sensirion_i2c_sen5x.response_types.Sen5xAirQualityIndex(ticks)[source]

Represents a SEN5x measurement response for the air quality index.

With the ticks attribute you can access the raw data as received from the device. For the converted value the scaled attribute is available. The attribute available can be used to check whether the value is available or not.

Sen5xDeviceStatus

class sensirion_i2c_sen5x.response_types.Sen5xDeviceStatus(value)[source]

Represents a SEN5x device status response.

With the value attribute you can access the raw value as received from the device. The convenience attribute flags allows you to get all set flags as strings. In addition, each flag is provided as separate bool attribute.

Sen5xVersion

class sensirion_i2c_sen5x.response_types.Sen5xVersion(firmware, hardware, protocol)[source]

Class representing all version numbers of an I2C device. This is used for the “Get Version” command.

class sensirion_i2c_sen5x.response_types.Sen5xFirmwareVersion(major, minor, debug)[source]

Class representing the firmware version of a device.

class sensirion_i2c_sen5x.response_types.Sen5xHardwareVersion(major, minor)[source]

Class representing the hardware version of a device.

class sensirion_i2c_sen5x.response_types.Sen5xProtocolVersion(major, minor)[source]

Class representing the I2C protocol version of an I2C device.

Commands

CmdStartMeasurement

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdStartMeasurement[source]

Start Measurement I²C Command

Starts a continuous measurement.

After starting the measurement, it takes some time (~1s) until the first measurement results are available. You could poll with the command 0x0202 “Read Data Ready” to check when the results are ready to read.

If the device is in measure mode without PM and the firmware version is higher than 1.0, this command enables PM measurement without affecting the already running RH/T/VOC/NOx measurements (except that the “data ready”-flag will be cleared). If the device is in idle mode, this command starts the normal measurement. In any other case (e.g. normal measure mode already running), this command has no effect.

CmdStartMeasurementWithoutPm

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdStartMeasurementWithoutPm[source]

Start Measurement Without PM I²C Command

Starts a continuous measurement without PM. Only humidity, temperature, VOC and NOx are available in this mode. Laser and fan are switched off to keep power consumption low.

After starting the measurement, it takes some time (~1s) until the first measurement results are available. You could poll with the command 0x0202 “Read Data Ready” to check when the results are ready to read.

If the device is in the normal measure mode and the firmware version is higher than 1.0, this command disables PM measurement without affecting the already running RH/T/VOC/NOx measurements (except that the “data ready”-flag will be cleared). If the device is in idle mode, this command starts the measurement without PM. In any other case (e.g. measure mode without PM already running), this command has no effect.

CmdStopMeasurement

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdStopMeasurement[source]

Stop Measurement I²C Command

Stops the measurement and returns to idle mode.

If the device is already in idle mode, this command has no effect.

CmdReadDataReady

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdReadDataReady[source]

Read Data Ready I²C Command

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 with the 0x03.. “Read Measured Values” commands.

Note

During fan (auto-)cleaning, no measurement data is available for several seconds and thus this flag will not be set until cleaning has finished. So please expect gaps of several seconds at any time if fan auto-cleaning is enabled.

CmdReadMeasuredValues

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdReadMeasuredValues[source]

Read Measured Values I²C Command

Returns the measured values.

The command 0x0202 “Read 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.

CmdGetTemperatureOffsetParameters

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdGetTemperatureOffsetParameters(raw=False)[source]

Get Temperature Offset Parameters I²C Command

Gets the temperature offset parameters from the device.

CmdSetTemperatureOffsetParameters

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdSetTemperatureOffsetParameters(offset, slope, time_constant, raw=False)[source]

Set Temperature Offset Parameters I²C Command

Sets the temperature offset parameters for the device.

Note

This configuration is volatile, i.e. the parameters will be reverted to their default value of zero after a device reset.

CmdGetWarmStartParameter

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdGetWarmStartParameter(raw=False)[source]

Get Warm Start Parameter I²C Command

Gets the warm start parameter from the device.

CmdSetWarmStartParameter

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdSetWarmStartParameter(warm_start, raw=False)[source]

Set Warm Start Parameter I²C Command

Sets the warm start parameter for the device.

Note

This parameter can be changed in any state of the device (and the getter immediately returns the new value), but it is applied only the next time starting a measurement, i.e. when sending a “Start Measurement” command! So the parameter needs to be set before a warm-start measurement is started.

Note

This configuration is volatile, i.e. the parameter will be reverted to its default value of zero after a device reset.

CmdGetRhtAccelerationMode

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetRhtAccelerationMode[source]

Get RH/T Acceleration Mode I²C Command

Gets the RH/T acceleration mode.

CmdSetRhtAccelerationMode

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdSetRhtAccelerationMode(mode)[source]

Set RH/T Acceleration Mode I²C Command

Sets the RH/T acceleration mode.

Note

This parameter can be changed in any state of the device (and the getter immediately returns the new value), but it is applied only the next time starting a measurement, i.e. when sending a “Start Measurement” command. So the parameter needs to be set before a new measurement is started.

CmdGetVocAlgorithmTuningParameters

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetVocAlgorithmTuningParameters[source]

Get VOC Algorithm Tuning Parameters I²C Command

Gets the currently set tuning parameters of the VOC algorithm.

CmdSetVocAlgorithmTuningParameters

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdSetVocAlgorithmTuningParameters(index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]

Set VOC Algorithm Tuning Parameters I²C Command

Sets the tuning parameters of the VOC algorithm.

Note

This command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

CmdGetNoxAlgorithmTuningParameters

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetNoxAlgorithmTuningParameters[source]

Get NOx Algorithm Tuning Parameters I²C Command

Gets the currently set tuning parameters of the NOx algorithm.

CmdSetNoxAlgorithmTuningParameters

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdSetNoxAlgorithmTuningParameters(index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor)[source]

Set NOx Algorithm Tuning Parameters I²C Command

Sets the tuning parameters of the NOx algorithm.

Note

This command is available only in idle mode. In measure mode, this command has no effect. In addition, it has no effect if at least one parameter is outside the specified range.

CmdGetVocAlgorithmState

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetVocAlgorithmState[source]

Get VOC Algorithm State I²C Command

Gets the current VOC algorithm state. This data can be used to restore the state with the “Set VOC Algorithm State” command after a short power cycle or device reset.

This command can be used either in measure mode or in idle mode (which will then return the state at the time when the measurement was stopped). In measure mode, the state can be read each measure interval to always have the latest state available, even in case of a sudden power loss.

CmdSetVocAlgorithmState

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdSetVocAlgorithmState(state)[source]

Set VOC Algorithm State I²C Command

Sets the VOC algorithm state previously received with the “Get VOC Algorithm State” command.

Note

This command is only available in idle mode and the state will be applied only once when starting the next measurement. Any further measurements (i.e. when stopping and restarting the measure mode) will reset the state to initial values. In measure mode, this command has no effect.

CmdStartFanCleaning

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdStartFanCleaning[source]

Start Fan Cleaning I²C Command

Starts the fan cleaning manually. The “data ready”-flag will be cleared immediately and during the next few seconds, no new measurement results will be available (old values will be returned). Once the cleaning is finished, the “data ready”-flag will be set and new measurement results will be available.

When executing this command while cleaning is already active, the command does nothing.

If you stop the measurement while fan cleaning is active, the cleaning will be aborted immediately.

Note

This command is only available in measure mode with PM measurement enabled, i.e. only if the fan is already running. In any other state, this command does nothing.

CmdGetFanAutoCleaningInterval

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetFanAutoCleaningInterval[source]

Get Fan Auto Cleaning Interval I²C Command

Gets the fan auto cleaning interval from the device.

CmdSetFanAutoCleaningInterval

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdSetFanAutoCleaningInterval(interval)[source]

Set Fan Auto Cleaning Interval I²C Command

Sets the fan auto cleaning interval for the device.

CmdGetProductName

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetProductName[source]

Get Product Name I²C Command

Gets the product name from the device.

CmdGetSerialNumber

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdGetSerialNumber[source]

Get Serial Number I²C Command

Gets the serial number from the device.

CmdGetVersion

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdGetVersion[source]

Get Version I²C Command

Gets the version information for the hardware, firmware and communication protocol.

CmdReadDeviceStatus

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdReadDeviceStatus[source]

Read Device Status I²C Command

Reads the current device status flags.

Note

The status flags of type “Error” are sticky, i.e. they are not cleared automatically even if the error condition no longer exists. So they can only be cleared manually with the command 0xD210 “Read And Clear Device Status” or with a device reset. All other flags are not sticky, i.e. they are cleared automatically if the trigger condition disappears.

CmdReadAndClearDeviceStatus

class sensirion_i2c_sen5x.commands.wrapped.Sen5xI2cCmdReadAndClearDeviceStatus[source]

Read And Clear Device Status I²C Command

Reads the current device status (like command 0xD206 “Read Device Status”) and afterwards clears all flags.

CmdDeviceReset

class sensirion_i2c_sen5x.commands.generated.Sen5xI2cCmdDeviceReset[source]

Device Reset I²C Command

Executes a reset on the device. This has the same effect as a power cycle.