Skip to content

Commit d78c3ed

Browse files
committed
call later logic
1 parent eeef086 commit d78c3ed

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: custom_components/lock_code_manager/binary_sensor.py

+9
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ async def _update_state(self, _: datetime | None = None) -> None:
183183
self._call_later_unsub()
184184
self._call_later_unsub = None
185185

186+
if any(
187+
self._lock_slot_sensor_state(lock) == STATE_UNKNOWN for lock in self.locks
188+
):
189+
self._call_later_unsub = async_call_later(
190+
self.hass, timedelta(seconds=2), self._update_state
191+
)
192+
self.async_on_remove(self._call_later_unsub)
193+
return
194+
186195
_LOGGER.debug(
187196
"%s (%s): Updating %s",
188197
self.config_entry.entry_id,

0 commit comments

Comments
 (0)