merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
380 stars 62 forks source link

Smart Air Purifier 4 Compact not working (xiaomi.airp.cpa4) #611

Closed vedmant closed 1 month ago

vedmant commented 1 month ago

Describe the bug I installed the plugin, discovered the device. It shows accessory, but it doesn't respond to any command, I'm trying to switch it on, in Homebridge UI it just has not efferct, in Apple Home switch immediately going to off position.

I see in logs that it can't connect, but I can ping IP 192.168.1.16 from the homebridge server normally.

Expected behavior Should work.

Your config.json

{
    "bridge": {
        "name": "Homebridge 391D",
        "username": "0E:13:B2:94:39:1D",
        "port": 51152,
        "pin": "756-86-971",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 80,
            "platform": "config"
        },
        {
            "name": "TuyaWebPlatform",
            "options": {
                "username": "...",
                "password": "...",
                "countryCode": "66",
                "platform": "tuya"
            },
            "defaults": [],
            "scenes": false,
            "platform": "TuyaWebPlatform"
        },
        {
            "name": "Google Smart Home",
            "token": "",
            "notice": "Keep your token a secret!",
            "platform": "google-smarthome"
        },
        {
            "devices": [
                {
                    "name": "Xiaomi Smart Air Purifier 4 Compact",
                    "ip": "192.168.1.16",
                    "token": "e1598b1d147f8989d43920ea65db9123",
                    "deviceId": "708608200",
                    "model": "xiaomi.airp.cpa4",
                    "pollingInterval": 10,
                    "deepDebugLog": false,
                    "silentLog": false,
                    "deviceEnabled": true,
                    "micloud": {
                        "username": "...",
                        "password": "...",
                        "country": "us"
                    },
                    "onlyMainService": false,
                    "buzzerControl": true,
                    "ledControl": true,
                    "childLockControl": false,
                    "modeControl": true
                }
            ],
            "platform": "miot"
        }
    ]
}

Purifier firmware version: 2.1.8_0012

Debug log [7/13/2024, 7:05:29 AM] [miot] [Xiaomi Smart Air Purifier 4 Compact] Error: Could not connect to device, handshake timeout [7/13/2024, 7:05:29 AM] [miot] [Xiaomi Smart Air Purifier 4 Compact] Error during connection! Retrying in 60 seconds!

merdok commented 1 month ago

If the error says that it cannot connect then it most likely is that way. Either the ip or token which you specified are invalid. You can check the debug section for a cli command which allows you to validate the connection here: https://github.com/merdok/homebridge-miot?tab=readme-ov-file#debug

vedmant commented 1 month ago

@merdok Thanks, I was stupid, it was connected to different network, and on same IP I had different device on my network