pi_portal.modules.integrations.gpio.components.bases.temperature_sensor

TemperatureSensor class.

class pi_portal.modules.integrations.gpio.components.bases.temperature_sensor.TemperatureSensor(pin_number, pin_name)[source]

TemperatureSensor Temperature Sensor class.

Parameters:
  • pin_number (int) – The GPIO input number.

  • pin_name (str) – The name of this door in alerts and logs.

has_changed()

Query the state to see if it has changed since the last poll.

Return type:

bool

Returns:

A boolean indicating if the state has changed.

abstract hook_setup_hardware()

Override to return the hardware sensor that can be used during polling.

Return type:

Any

Returns:

A pollable hardware interface.

hook_setup_input()

Override to initialize the GPIO input. This is optional.

Return type:

None

Returns:

The new GPIO state value.

abstract hook_update_state()[source]

Retrieve new state for the GPIO input.

Return type:

TypeTemperatureData

Returns:

The new GPIO state value.

Raises:

RuntimeError

poll()

Update the state of the GPIO input.

Return type:

None

property sensor_type: str

Returns the name of the input type. The default behaviour is to return the implementation’s class name.

Returns:

The inputs name.

class pi_portal.modules.integrations.gpio.components.bases.temperature_sensor.TypeTemperatureData[source]

Typed representation of temperature sensor data.