def start(self):
        """ Monitor the bus for events and handle them """
        print("Entering monitoring mode, press CTRL-C to quit")
        serial = self._connection.serial

        while True:
            serial.write(b"@R")
            length = int(serial.read(), 16)
            data = serial.read(length * 2)
            message = messages.parse(data)
            if not (self._options.filter and
                    message.entity and
                    message.entity in self._devices):
                logging.debug(" ".join(message.bytes))
            if not self._options.config or \
               message.entity is None or \
               message.entity in self._devices:
                continue

            print("New device found")
            ha_id = input("Enter home assistant unique ID: ")
            name = input("Enter name: ")
            self._add_device(scs_id=message.entity, ha_id=ha_id, name=name)
def start ( self ) : print ( "Entering monitoring mode, press CTRL-C to quit" ) serial = self . _connection . serial while True : serial . write ( b"@R" ) length = int ( serial . read ( ) , 16 ) data = serial . read ( length * 2 ) message = messages . parse ( data ) if not ( self . _options . filter and message . entity and message . entity in self . _devices ) : logging . debug ( " " . join ( message . bytes ) ) if not self . _options . config or message . entity is None or message . entity in self . _devices : continue print ( "New device found" ) ha_id = input ( "Enter home assistant unique ID: " ) name = input ( "Enter name: " ) self . _add_device ( scs_id = message . entity , ha_id = ha_id , name = name )
Monitor the bus for events and handle them