def respond_fw_config(self, msg):
        """Respond to a firmware config request."""
        (req_fw_type,
         req_fw_ver,
         req_blocks,
         req_crc,
         bloader_ver) = fw_hex_to_int(msg.payload, 5)
        _LOGGER.debug(
            'Received firmware config request with firmware type %s, '
            'firmware version %s, %s blocks, CRC %s, bootloader %s',
            req_fw_type, req_fw_ver, req_blocks, req_crc, bloader_ver)
        fw_type, fw_ver, fware = self._get_fw(
            msg, (self.requested, self.unstarted))
        if fware is None:
            return None
        if fw_type != req_fw_type:
            _LOGGER.warning(
                'Firmware type %s of update is not identical to existing '
                'firmware type %s for node %s',
                fw_type, req_fw_type, msg.node_id)
        _LOGGER.info(
            'Updating node %s to firmware type %s version %s from type %s '
            'version %s', msg.node_id, fw_type, fw_ver, req_fw_type,
            req_fw_ver)
        msg = msg.copy(sub_type=self._const.Stream.ST_FIRMWARE_CONFIG_RESPONSE)
        msg.payload = fw_int_to_hex(
            fw_type, fw_ver, fware['blocks'], fware['crc'])
        return msg
def respond_fw_config ( self , msg ) : ( req_fw_type , req_fw_ver , req_blocks , req_crc , bloader_ver ) = fw_hex_to_int ( msg . payload , 5 ) _LOGGER . debug ( 'Received firmware config request with firmware type %s, ' 'firmware version %s, %s blocks, CRC %s, bootloader %s' , req_fw_type , req_fw_ver , req_blocks , req_crc , bloader_ver ) fw_type , fw_ver , fware = self . _get_fw ( msg , ( self . requested , self . unstarted ) ) if fware is None : return None if fw_type != req_fw_type : _LOGGER . warning ( 'Firmware type %s of update is not identical to existing ' 'firmware type %s for node %s' , fw_type , req_fw_type , msg . node_id ) _LOGGER . info ( 'Updating node %s to firmware type %s version %s from type %s ' 'version %s' , msg . node_id , fw_type , fw_ver , req_fw_type , req_fw_ver ) msg = msg . copy ( sub_type = self . _const . Stream . ST_FIRMWARE_CONFIG_RESPONSE ) msg . payload = fw_int_to_hex ( fw_type , fw_ver , fware [ 'blocks' ] , fware [ 'crc' ] ) return msg
Respond to a firmware config request.