Rename var to compliant name in August integration (#56812)

This commit is contained in:
Simone Chemelli 2021-09-30 12:15:17 +02:00 committed by GitHub
parent c6f48056fd
commit ee28dd57c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View file

@ -93,7 +93,7 @@ def _native_datetime() -> datetime:
class AugustRequiredKeysMixin:
"""Mixin for required keys."""
state_provider: Callable[[AugustData, DoorbellDetail], bool]
value_fn: Callable[[AugustData, DoorbellDetail], bool]
is_time_based: bool
@ -115,21 +115,21 @@ SENSOR_TYPES_DOORBELL: tuple[AugustBinarySensorEntityDescription, ...] = (
key="doorbell_ding",
name="Ding",
device_class=DEVICE_CLASS_OCCUPANCY,
state_provider=_retrieve_ding_state,
value_fn=_retrieve_ding_state,
is_time_based=True,
),
AugustBinarySensorEntityDescription(
key="doorbell_motion",
name="Motion",
device_class=DEVICE_CLASS_MOTION,
state_provider=_retrieve_motion_state,
value_fn=_retrieve_motion_state,
is_time_based=True,
),
AugustBinarySensorEntityDescription(
key="doorbell_online",
name="Online",
device_class=DEVICE_CLASS_CONNECTIVITY,
state_provider=_retrieve_online_state,
value_fn=_retrieve_online_state,
is_time_based=False,
),
)
@ -225,9 +225,7 @@ class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorEntity):
def _update_from_data(self):
"""Get the latest state of the sensor."""
self._cancel_any_pending_updates()
self._attr_is_on = self.entity_description.state_provider(
self._data, self._detail
)
self._attr_is_on = self.entity_description.value_fn(self._data, self._detail)
if self.entity_description.is_time_based:
self._attr_available = _retrieve_online_state(self._data, self._detail)