pi_portal.modules.integrations.gpio.components.bases.input_base.GPIOInputBase
- class pi_portal.modules.integrations.gpio.components.bases.input_base.GPIOInputBase(pin_number: int, pin_name: str, initial_state: TypeState)[source]
Bases:
ABC,Generic[TypeState]GPIO input base representation.
- Parameters:
pin_number – The GPIO input number.
pin_name – The name of this input in alerts and logs.
initial_state – The value to initially set the state to.
- has_changed() bool[source]
Query the state to see if it has changed since the last poll.
- Returns:
A boolean indicating if the state has changed.
- Return type:
bool
- abstract hook_update_state() TypeState[source]
Override to return the current state of the GPIO Input.
- Returns:
The new GPIO state value.
- Return type:
TypeState
- property sensor_type: str
Returns the name of the input type. The default behaviour is to return the implementation’s class name.
- Returns:
The input’s name.