Add update_without_throttle to ecobee number (#116504)

add update_without_throttle
This commit is contained in:
Marc-Olivier Arsenault 2024-05-10 15:54:28 -04:00 committed by GitHub
parent 8168aff253
commit db6e3f7cbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,10 +88,15 @@ class EcobeeVentilatorMinTime(EcobeeBaseEntity, NumberEntity):
super().__init__(data, thermostat_index) super().__init__(data, thermostat_index)
self.entity_description = description self.entity_description = description
self._attr_unique_id = f"{self.base_unique_id}_ventilator_{description.key}" self._attr_unique_id = f"{self.base_unique_id}_ventilator_{description.key}"
self.update_without_throttle = False
async def async_update(self) -> None: async def async_update(self) -> None:
"""Get the latest state from the thermostat.""" """Get the latest state from the thermostat."""
await self.data.update() if self.update_without_throttle:
await self.data.update(no_throttle=True)
self.update_without_throttle = False
else:
await self.data.update()
self._attr_native_value = self.thermostat["settings"][ self._attr_native_value = self.thermostat["settings"][
self.entity_description.ecobee_setting_key self.entity_description.ecobee_setting_key
] ]
@ -99,3 +104,4 @@ class EcobeeVentilatorMinTime(EcobeeBaseEntity, NumberEntity):
def set_native_value(self, value: float) -> None: def set_native_value(self, value: float) -> None:
"""Set new ventilator Min On Time value.""" """Set new ventilator Min On Time value."""
self.entity_description.set_fn(self.data, self.thermostat_index, int(value)) self.entity_description.set_fn(self.data, self.thermostat_index, int(value))
self.update_without_throttle = True