custom_components/leafeemag/binary_sensor.py
def _set_state_by_received_bytearray (self, received_bytearray) -> None:
        """Set state of this sensor by received sensor value."""

        is_open = None;
        if received_bytearray.decode() == '\x00': # Opened
            is_open = True
        else: # Closed
            is_open = False

        _LOGGER.debug('State of Mag %s has been changed to %s', self._name, is_open)

        # Set state
        self._state = is_open

        # Update time
        self._last_connected_at = time.time()
Set state of this sensor by received sensor value.
Set state of this sensor by received sensor value.
Set state of this sensor by received sensor value .
def _set_state_by_received_bytearray (self, received_bytearray) -> None:
        is_open = None;
        if received_bytearray.decode() == '\x00': 
            is_open = True
        else: 
            is_open = False
        _LOGGER.debug('State of Mag %s has been changed to %s', self._name, is_open)
        self._state = is_open
        self._last_connected_at = time.time()
def _set_state_by_received_bytearray ( self , received_bytearray ) -> None : is_open = None ; if received_bytearray . decode ( ) == '\x00' : is_open = True else : is_open = False _LOGGER . debug ( 'State of Mag %s has been changed to %s' , self . _name , is_open ) self . _state = is_open self . _last_connected_at = time . time ( )
Set state of this sensor by received sensor value.
Set state of this sensor by received sensor value .
"""Set state of this sensor by received sensor value.""" # Opened # Closed # Set state # Update time
self
received_bytearray