get_scale
- get_scale(address: str, min_threshold: float, max_threshold: float, enabled: bool, calibration_key: str = 'SCALE_CALIBRATION_VALUE', weight_to_calibrate_key: str = 'SCALE_WEIGHT_TO_CALIBRATE') Scale | NullScale[source]
Factory function to initialize the Scale.
- Parameters:
address (str) – The I2C address of the scale.
min_threshold (float) – The minimum weight threshold for valid measurements.
max_threshold (float) – The maximum weight threshold for valid measurements.
enabled (bool) – Whether this scale is physically present and should be initialized at all.
calibration_key (str) – The setting key holding this scale’s calibration factor.
weight_to_calibrate_key (str) – The setting key holding the known weight last used to calibrate this scale.
- Returns:
An initialized Scale instance or a null scale if disabled or on failure.
- Return type:
Scale | NullScale