custom_components/leafeemag/binary_sensor.py
def update(self) -> None:
        """Not update the state in here, because the state will be updated by notification from the Mag."""

        if self._mag_device == None and self._last_connected_at == 0:
            # This device has not made a first connection yet
            return

        if self._mag_device == None and CONNECT_ERROR_RETRY_INTERVAL_SEC < (time.time() - self._last_connected_at):
            # First or Retry connection
            self._connect_and_subscribe()

        elif self._mag_device != None and PERIODIC_RECONNECT_INTERVAL_SEC < (time.time() - self._last_connected_at):
            # Periodic Reconnect after long time has passed (to keep reliability of connection)
            self._connect_and_subscribe()

        return
Not update the state in here, because the state will be updated by notification from the Mag.
Not update the state in here, because the state will be updated by notification from the Mag.
Not update the state in here because the state will be updated by notification from the Mag .
def update(self) -> None:
        if self._mag_device == None and self._last_connected_at == 0:
            return
        if self._mag_device == None and CONNECT_ERROR_RETRY_INTERVAL_SEC < (time.time() - self._last_connected_at):
            self._connect_and_subscribe()
        elif self._mag_device != None and PERIODIC_RECONNECT_INTERVAL_SEC < (time.time() - self._last_connected_at):
            self._connect_and_subscribe()
        return
def update ( self ) -> None : if self . _mag_device == None and self . _last_connected_at == 0 : return if self . _mag_device == None and CONNECT_ERROR_RETRY_INTERVAL_SEC < ( time . time ( ) - self . _last_connected_at ) : self . _connect_and_subscribe ( ) elif self . _mag_device != None and PERIODIC_RECONNECT_INTERVAL_SEC < ( time . time ( ) - self . _last_connected_at ) : self . _connect_and_subscribe ( ) return
Not update the state in here, because the state will be updated by notification from the Mag.
Not update the state in here because the state will be updated by notification from the Mag .
"""Not update the state in here, because the state will be updated by notification from the Mag.""" # This device has not made a first connection yet # First or Retry connection # Periodic Reconnect after long time has passed (to keep reliability of connection)
self