TempSensor

class TempSensor(address: str)[source]

Bases: TempSensorBase

Interface for a temperature and humidity sensor via I2C.

I2C_ADDR

The I2C address.

Type:

int

bus

The I2C bus number.

Type:

int

i2cbus

The I2C bus connection.

Type:

smbus2.SMBus

error

Error message.

Type:

str

__init__(address: str) None[source]

Initializes the TempSensor.

Parameters:

address (str) – The I2C address as a hex string.

Methods

__init__(address)

Initializes the TempSensor.

get_temperature()

Reads temperature and humidity from the sensor.

start()

Configures the sensor to start measurement.

Attributes

error: str = 'Error connecting to the temp_sensor '
start() None[source]

Configures the sensor to start measurement.

get_temperature() tuple[float, float, str][source]

Reads temperature and humidity from the sensor.

Returns:

A tuple containing temperature (float),

humidity (float), and a formatted string (str).

Return type:

tuple[float, float, str]