diff --git a/custom_components/amphiro_ble/sensor.py b/custom_components/amphiro_ble/sensor.py index 7887924..d2abe9e 100755 --- a/custom_components/amphiro_ble/sensor.py +++ b/custom_components/amphiro_ble/sensor.py @@ -137,3 +137,20 @@ class AmphiroBluetoothSensorEntity( def native_value(self) -> int | float | None: """Return the native value.""" return self.processor.entity_data.get(self.entity_key) + + @property + def available(self) -> bool: + """Return True if entity is available. + + The sensor is only created when the device is seen. + + Since these are sleepy devices which stop broadcasting + when not in use, we can't rely on the last update time + so once we have seen the device we always return True. + """ + return True + + @property + def assumed_state(self) -> bool: + """Return True if the device is no longer broadcasting.""" + return not self.processor.available