pi_portal.modules.integrations.gpio.components.bases.input

GPIOInputBase class.

class pi_portal.modules.integrations.gpio.components.bases.input.GPIOInputBase(pin_number, pin_name, initial_state)[source]

GPIO input base representation.

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

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

  • initial_state (Any) – The value to initially set the state to.

has_changed()[source]

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.

hook_setup_input()[source]

Override to initialize the GPIO input. This is optional.

Return type:

None

Returns:

The new GPIO state value.

abstract hook_update_state()[source]

Override to return the current state of the GPIO Input.

Return type:

Any

Returns:

The new GPIO state value.

poll()[source]

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.