async def METHOD_NAME(self, gw, device, type):
    self.logger.debug(f"Check if device {device['did']} exists")
    did = device["did"]
    self.devices[did] = device
    if not await fhem.checkIfDeviceExists(
        self.hash, "FHEMPYTYPE", "xiaomi_gateway3_device", "DID", did
    ):
        devname = (
            "".join(filter(str.isalnum, str(device["model"]))) + "_" + device["mac"]
        )
        await fhem.CommandDefine(
            self.hash,
            devname
            + " fhempy xiaomi_gateway3_device "
            + self.hash["NAME"]
            + " "
            + did,
        )
    else:
        if "init" in device and did in self.fhempy_devices:
            if did == "lumi." + device["mac"]:
                device["version"] = self.gw.version()
            await self.fhempy_devices[did].initialize(device)
    # wait for fhem
    await asyncio.sleep(2)