API Reference

SHT2x

Sht2xI2cDevice

class sensirion_i2c_sht.sht2x.device.Sht2xI2cDevice(connection, slave_address=64)[source]

SHT2x I²C device class to allow executing I²C commands.

__init__(connection, slave_address=64)[source]

Constructs a new SHT2x I²C device.

Parameters:
  • connection (I2cConnection) – The I²C connection to use for communication.
  • slave_address (byte) – The I²C slave address, defaults to 0x44.
single_shot_measurement()[source]

Trigger a measurement and read the temperature and humidity.

Returns:The measured temperature and humidity.
Return type:tuple
soft_reset()[source]

Perform a soft reset for the device. This can be used to force the system into a well-defined state without removing the power supply.

read_serial_number()[source]

Read the extended serial number from the device.

Returns:The extended serial number.
Return type:int
connection

Get the used I²C connection.

Returns:The used I²C connection.
Return type:I2cConnection
execute(command)

Execute an I²C command on this device.

Parameters:command (I2cCommand) – The command to be executed.
Returns:The interpreted response of the executed command.
Return type:Depends on the executed command.
slave_address

Get the I²C slave address.

Returns:The I²C slave address.
Return type:byte

Sht2xI2cCommand

class sensirion_i2c_sht.sht2x.commands.Sht2xI2cCmdBase(command, tx_data, rx_length, read_delay, timeout, command_bytes=1, post_processing_time=0.0)[source]

Sht2x I²C base command.

__init__(command, tx_data, rx_length, read_delay, timeout, command_bytes=1, post_processing_time=0.0)[source]

Constructs a new SHT2x I²C command.

Parameters:
  • command (int/None) – The command ID to be sent to the device. None means that no command will be sent, i.e. only tx_data (if not None) will be sent. No CRC is added to these bytes since the command ID usually already contains a CRC.
  • tx_data (bytes-like/list/None) – Bytes to be extended with CRCs and then sent to the I²C device. None means that no write header will be sent at all (if command is None too). An empty list means to send the write header (even if command is None), but without data following it.
  • rx_length (int/None) – Number of bytes to be read from the I²C device, including CRC bytes. None means that no read header is sent at all. Zero means to send the read header, but without reading any data.
  • read_delay (float) – Delay (in Seconds) to be inserted between the end of the write operation and the beginning of the read operation. This is needed if the device needs some time to prepare the RX data, e.g. if it has to perform a measurement. Set to 0.0 to indicate that no delay is needed, i.e. the device does not need any processing time.
  • timeout (float) – Timeout (in Seconds) to be used in case of clock stretching. If the device stretches the clock longer than this value, the transceive operation will be aborted with a timeout error. Set to 0.0 to indicate that the device will not stretch the clock for this command.
  • command_bytes (int) – Number of command bytes.
  • post_processing_time (float) – Maximum time in seconds the device needs for post processing of this command until it is ready to receive the next command. For example after a device reset command, the device might need some time until it is ready again. Usually this is 0.0s, i.e. no post processing is needed.
interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht2x.commands.Sht2xI2cMeasureHumidity[source]

Sht2x command for a single shot measurement with clock stretching disabled.

__init__()[source]

Constructs a new command.

interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The read humidity.
Return type:Sht2xHumidity
class sensirion_i2c_sht.sht2x.commands.Sht2xI2cMeasureTemperature[source]

Sht2x command for a single shot measurement with clock stretching disabled.

__init__()[source]

Constructs a new command.

interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The read temperature.
Return type:Sht2xTemperature
class sensirion_i2c_sht.sht2x.commands.Sht2xI2cCmdSoftReset[source]

Sht2x command for a soft reset.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht2x.commands.Sht2xI2cCmdReadOtp(address, number_of_bytes_to_read)[source]

Sht2x command to read from the OTP.

__init__(address, number_of_bytes_to_read)[source]

Constructs a new command.

Parameters:
  • address (byte) – Address of OTP to read from.
  • number_of_bytes_to_read (int) – Number of bytes to read.
interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The read bytes from the OTP.
Return type:list(int)
class sensirion_i2c_sht.sht2x.commands.Sht2xI2cCmdReadMetalRom(number_of_words_to_read)[source]

Sht2x command to read from the metal ROM.

__init__(number_of_words_to_read)[source]

Constructs a new command.

Parameters:number_of_words_to_read (int) – Number of words to read.
interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The read words from the metal ROM.
Return type:list(int)

Response Types

class sensirion_i2c_sht.sht2x.response_types.Sht2xTemperature(ticks)[source]

Represents a measurement response for the temperature.

With the ticks you can access the raw data as received from the device. For the converted values you can choose between degrees_celsius and degrees_fahrenheit.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

degrees_celsius

The converted temperature in °C.

degrees_fahrenheit

The converted temperature in °F.

class sensirion_i2c_sht.sht2x.response_types.Sht2xHumidity(ticks)[source]

Represents a measurement response for the humidity.

With the ticks you can access the raw data as received from the device. For the converted value the percent_rh attribute is available.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

percent_rh

The converted humidity in %RH.

SHT3x

Sht3xI2cDevice

class sensirion_i2c_sht.sht3x.device.Sht3xI2cDevice(connection, slave_address=68)[source]

SHT3x I²C device class to allow executing I²C commands.

__init__(connection, slave_address=68)[source]

Constructs a new SHT3x I²C device.

Parameters:
  • connection (I2cConnection) – The I²C connection to use for communication.
  • slave_address (byte) – The I²C slave address, defaults to 0x44.
single_shot_measurement(repeatability=<Sht3xRepeatability.HIGH: 1>)[source]

Trigger a measurement and read the temperature and humidity.

Parameters:repeatability (Sht3xRepeatability) – Configure the repeatability setting.
Raises:ValueError – If the passed repeatability is not valid.
Returns:The measured temperature and humidity.
Return type:tuple
art_enable()[source]

Enable the ART (accelerated response time

heater_on()[source]

Switch on the internal heater.

heater_off()[source]

Switch off the internal heater.

read_status_register()[source]

Read out the status register.

Returns:The status register.
Return type:Sht3xStatusRegister
clear_status_register()[source]

Clear the status register. All flags (Bit 15, 11, 10, 4) in the status register can be cleared (set to zero).

soft_reset()[source]

Perform a soft reset for the device. This can be used to force the system into a well-defined state without removing the power supply.

read_serial_number()[source]

Read the serial number from the device.

Returns:The serial number.
Return type:int
connection

Get the used I²C connection.

Returns:The used I²C connection.
Return type:I2cConnection
execute(command)

Execute an I²C command on this device.

Parameters:command (I2cCommand) – The command to be executed.
Returns:The interpreted response of the executed command.
Return type:Depends on the executed command.
slave_address

Get the I²C slave address.

Returns:The I²C slave address.
Return type:byte

Sht3xI2cCommand

class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdBase(command, tx_data, rx_length, read_delay, timeout, post_processing_time=0.0)[source]

SHT3x I²C base command.

__init__(command, tx_data, rx_length, read_delay, timeout, post_processing_time=0.0)[source]

Constructs a new SHT3x I²C command.

Parameters:
  • command (int/None) – The command ID to be sent to the device. None means that no command will be sent, i.e. only tx_data (if not None) will be sent. No CRC is added to these bytes since the command ID usually already contains a CRC.
  • tx_data (bytes-like/list/None) – Bytes to be extended with CRCs and then sent to the I²C device. None means that no write header will be sent at all (if command is None too). An empty list means to send the write header (even if command is None), but without data following it.
  • rx_length (int/None) – Number of bytes to be read from the I²C device, including CRC bytes. None means that no read header is sent at all. Zero means to send the read header, but without reading any data.
  • read_delay (float) – Delay (in Seconds) to be inserted between the end of the write operation and the beginning of the read operation. This is needed if the device needs some time to prepare the RX data, e.g. if it has to perform a measurement. Set to 0.0 to indicate that no delay is needed, i.e. the device does not need any processing time.
  • timeout (float) – Timeout (in Seconds) to be used in case of clock stretching. If the device stretches the clock longer than this value, the transceive operation will be aborted with a timeout error. Set to 0.0 to indicate that the device will not stretch the clock for this command.
  • post_processing_time (float) – Maximum time in seconds the device needs for post processing of this command until it is ready to receive the next command. For example after a device reset command, the device might need some time until it is ready again. Usually this is 0.0s, i.e. no post processing is needed.
interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdMeasBase(command, read_delay)[source]

Base SHT3x command for a single shot measurement with clock stretching disabled.

__init__(command, read_delay)[source]

Constructs a new command.

Parameters:
  • command (int/None) – The command word to be sent to the device. None means that no command will be sent, i.e. only tx_words (if not None) will be sent.
  • read_delay (float) – Delay (in Seconds) to be inserted between the end of the write operation and the beginning of the read operation. This is needed if the device needs some time to prepare the RX data, e.g. if it has to perform a measurement. Set to 0.0 to indicate that no delay is needed, i.e. the device does not need any processing time.
interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdMeasHighRes[source]

SHT3x command for a single shot measurement with high repeatability and clock stretching disabled.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdMeasMediumRes[source]

SHT3x command for a single shot measurement with medium repeatability and clock stretching disabled.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdMeasLowRes[source]

SHT3x command for a single shot measurement with low repeatability and clock stretching disabled.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdEnableART[source]

SHT3x command to enable the ART (accelerated response time) feature.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdHeaterOn[source]

SHT3x command to enable the internal heater.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdHeaterOff[source]

SHT3x command to disable the internal heater.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdSoftReset[source]

SHT3x command for a soft reset.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdReadStatusRegister[source]

SHT3x command to read the status register.

__init__()[source]

Constructs a new command.

interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The status register.
Return type:Sht3xStatusRegister
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdResetStatusRegister[source]

SHT3x command to reset the status register.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht3x.commands.Sht3xI2cCmdReadSerial[source]

SHT3x command to read the serial number.

__init__()[source]

Constructs a new command.

interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The serial number.
Return type:int

Data Types

class sensirion_i2c_sht.sht3x.data_types.Sht3xRepeatability[source]

An enum containing all available repeatability settings for the temperature and humidity measurement.

HIGH = 1

High repeatability

MEDIUM = 2

Medium repeatability

LOW = 3

Low repeatability

Response Types

class sensirion_i2c_sht.sht3x.response_types.Sht3xTemperature(ticks)[source]

Represents a measurement response for the temperature.

With the ticks you can access the raw data as received from the device. For the converted values you can choose between degrees_celsius and degrees_fahrenheit.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

degrees_celsius

The converted temperature in °C.

degrees_fahrenheit

The converted temperature in °F.

class sensirion_i2c_sht.sht3x.response_types.Sht3xHumidity(ticks)[source]

Represents a measurement response for the humidity.

With the ticks you can access the raw data as received from the device. For the converted value the percent_rh attribute is available.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

percent_rh

The converted humidity in %RH.

class sensirion_i2c_sht.sht3x.response_types.Sht3xStatusRegister(raw)[source]

Represents the content of the status register.

With the status_register_word you can access the raw data as received from the device. For each data field of the status register an attribute is available.

Parameters:raw (int) – The read status register word as received from the device.
__init__(raw)[source]

Creates an instance from the received raw data.

raw

The raw data word (int) as received from the device.

write_data_checksum_status

Write data checksum status (Bit 0, bool)

  • False: checksum of last write transfer was correct
  • True: checksum of last write transfer failed
command_status

Command status (Bit 1, bool)

  • False: last command executed successfully
  • True: last command not processed. It was either invalid or failed the integrated command checksum
temperature_tracking_alert

Temperature tracking alert (Bit 10, bool)

  • False: no alert
  • True: alert
humidity_tracking_alert

Humidity tracking alert (Bit 11, bool)

  • False: no alert
  • True: alert
heater_status

Heater status (Bit 13, bool)

  • False: heater off
  • True: heater on
alert_pending_status

Alert pending status (Bit 15, bool)

  • False: no pending alerts
  • True: at least one pending alert

SHT4x

Sht4xI2cDevice

class sensirion_i2c_sht.sht4x.device.Sht4xI2cDevice(connection, slave_address=68)[source]

SHT4x I²C device class to allow executing I²C commands.

__init__(connection, slave_address=68)[source]

Constructs a new SHT4x I²C device.

Parameters:
  • connection (I2cConnection) – The I²C connection to use for communication.
  • slave_address (byte) – The I²C slave address, defaults to 0x44.
single_shot_measurement(repeatability=<Sht4xRepeatability.HIGH: 1>)[source]

Trigger a measurement and read the temperature and humidity.

Parameters:repeatability (Sht4xRepeatability) – Configure the repeatability setting.
Raises:ValueError – If the passed repeatability is not valid.
Returns:The measured temperature and humidity.
Return type:tuple
activate_heater(power=<Sht4xHeaterPower.HIGH: 1>, duration=<Sht4xHeaterActivationDuration.LONG: 1>)[source]

Activate the heater and trigger a high precision measurement.

Important notes for operating the heater:

  • The heater is designed for a maximum duty cycle of 5%.
  • During operation of the heater, sensor specifications are not valid.
  • The temperature sensor can additionally be affected by the thermally induced mechanical stress, offsetting the temperature reading from the actual temperature.
  • The sensor’s temperature (base temperature + temperature increase from heater) must not exceed Tmax = 125 °C in order to have proper electrical functionality of the chip.

If higher heating temperatures are desired, consecutive heating commands have to be sent to the sensor. The heater shall only be operated in ambient temperatures below 65°C else it could drive the sensor outside of its maximal operating temperature.

Parameters:
Raises:

ValueError – If the passed parameters are not valid.

Returns:

The measured temperature and humidity.

Return type:

tuple

soft_reset()[source]

Perform a soft reset for the device. This can be used to force the system into a well-defined state without removing the power supply.

read_serial_number()[source]

Read the serial number from the device.

Returns:The serial number.
Return type:int
connection

Get the used I²C connection.

Returns:The used I²C connection.
Return type:I2cConnection
execute(command)

Execute an I²C command on this device.

Parameters:command (I2cCommand) – The command to be executed.
Returns:The interpreted response of the executed command.
Return type:Depends on the executed command.
slave_address

Get the I²C slave address.

Returns:The I²C slave address.
Return type:byte

Sht4xI2cCommand

class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdBase(command, tx_data, rx_length, read_delay, post_processing_time=0.0)[source]

SHT4x I²C base command.

__init__(command, tx_data, rx_length, read_delay, post_processing_time=0.0)[source]

Constructs a new SHT4x I²C command.

Parameters:
  • command (int/None) – The command ID to be sent to the device. None means that no command will be sent, i.e. only tx_data (if not None) will be sent. No CRC is added to these bytes since the command ID usually already contains a CRC.
  • tx_data (bytes-like/list/None) – Bytes to be extended with CRCs and then sent to the I²C device. None means that no write header will be sent at all (if command is None too). An empty list means to send the write header (even if command is None), but without data following it.
  • rx_length (int/None) – Number of bytes to be read from the I²C device, including CRC bytes. None means that no read header is sent at all. Zero means to send the read header, but without reading any data.
  • read_delay (float) – Delay (in Seconds) to be inserted between the end of the write operation and the beginning of the read operation. This is needed if the device needs some time to prepare the RX data, e.g. if it has to perform a measurement. Set to 0.0 to indicate that no delay is needed, i.e. the device does not need any processing time.
  • post_processing_time (float) – Maximum time in seconds the device needs for post processing of this command until it is ready to receive the next command. For example after a device reset command, the device might need some time until it is ready again. Usually this is 0.0s, i.e. no post processing is needed.
interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdMeasBase(command, read_delay)[source]

Base SHT4x command for a single shot measurement.

__init__(command, read_delay)[source]

Constructs a new command.

Parameters:
  • command (int/None) – The command word to be sent to the device. None means that no command will be sent, i.e. only tx_words (if not None) will be sent.
  • read_delay (float) – Delay (in Seconds) to be inserted between the end of the write operation and the beginning of the read operation. This is needed if the device needs some time to prepare the RX data, e.g. if it has to perform a measurement. Set to 0.0 to indicate that no delay is needed, i.e. the device does not need any processing time.
interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdMeasHighRes[source]

SHT4x command for a single shot measurement with high repeatability.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdMeasMediumRes[source]

SHT4x command for a single shot measurement with medium repeatability.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdMeasLowRes[source]

SHT4x command for a single shot measurement with low repeatability.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterHighPowerLong[source]

SHT4x command activate highest heater power and a high precision measurement (typ. 200mW @ 3.3V) for 1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterHighPowerShort[source]

SHT4x command activate highest heater power and a high precision measurement (typ. 200mW @ 3.3V) for 0.1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterMediumPowerLong[source]

SHT4x command activate medium heater power and a high precision measurement (typ. 110mW @ 3.3V) for 1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterMediumPowerShort[source]

SHT4x command activate medium heater power and a high precision measurement (typ. 110mW @ 3.3V) for 0.1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterLowPowerLong[source]

SHT4x command activate lowest heater power and a high precision measurement (typ. 20mW @ 3.3V) for 1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdHeaterLowPowerShort[source]

SHT4x command activate lowest heater power and a high precision measurement (typ. 20mW @ 3.3V) for 0.1 second.

__init__()[source]

Constructs a new command.

interpret_response(data)

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The measured temperature and humidity.
Return type:tuple
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdSoftReset[source]

SHT4x command for a soft reset.

__init__()[source]

Constructs a new command.

interpret_response(data)

Validates the CRCs of the received data from the device and returns the data with all CRCs removed.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The received bytes, or None if there is no data received.
Return type:bytes or None
Raises:I2cChecksumError – If a received CRC was wrong.
class sensirion_i2c_sht.sht4x.commands.Sht4xI2cCmdReadSerial[source]

SHT4x command to read the serial number.

__init__()[source]

Constructs a new command.

interpret_response(data)[source]

Converts the raw response from the device to the proper data type.

Parameters:data (bytes) – Received raw bytes from the read operation.
Returns:The serial number.
Return type:int

Data Types

class sensirion_i2c_sht.sht4x.data_types.Sht4xRepeatability[source]

An enum containing all available repeatability settings for the temperature and humidity measurement.

HIGH = 1

High repeatability

MEDIUM = 2

Medium repeatability

LOW = 3

Low repeatability

class sensirion_i2c_sht.sht4x.data_types.Sht4xHeaterPower[source]

An enum containing all available heater power settings.

HIGH = 1

High power (typ. 200mW @ 3.3V)

MEDIUM = 2

Medium power (typ. 110mW @ 3.3V)

LOW = 3

Lowest power (typ. 20mW @ 3.3V)

class sensirion_i2c_sht.sht4x.data_types.Sht4xHeaterActivationDuration[source]

An enum containing all available heater activation duration settings.

LONG = 1

Long duration (typ. 1 second)

SHORT = 2

Short duration (typ. 0.1 seconds)

Response Types

class sensirion_i2c_sht.sht4x.response_types.Sht4xTemperature(ticks)[source]

Represents a measurement response for the temperature.

With the ticks you can access the raw data as received from the device. For the converted values you can choose between degrees_celsius and degrees_fahrenheit.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

degrees_celsius

The converted temperature in °C.

degrees_fahrenheit

The converted temperature in °F.

class sensirion_i2c_sht.sht4x.response_types.Sht4xHumidity(ticks)[source]

Represents a measurement response for the humidity.

With the ticks you can access the raw data as received from the device. For the converted value the percent_rh attribute is available.

Parameters:ticks (int) – The read ticks as received from the device.
__init__(ticks)[source]

Creates an instance from the received raw data.

ticks

The ticks (int) as received from the device.

percent_rh

The converted humidity in %RH.