merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
390 stars 61 forks source link

Mi Smart Power Plug 2 (chuangmi.plug.212a01) successfully initialised, but not working #77

Closed KingCZE closed 3 years ago

KingCZE commented 3 years ago

Hi, I have an issue with Mi Smart Power Plug 2 (chuangmi.plug.212a01). It is successfully initialised, but it does not respond - neither in the Homebridge GUI, nor in Apple Homekit.

Homebridge logs:

[8/28/2021, 5:10:50 PM] [miot] Initializing devices
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Got device configuration, initializing device with name: Miot device
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Device model known: chuangmi.plug.212a01! Creating device!
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Initializing device properties
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Initializing device actions
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Successfully created a Outlet device! It is a Mi Smart Power Plug 2.
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Initializing accessory!
[8/28/2021, 5:10:50 PM] [miot] [Miot device] Accessory successfully initialized!

Homebridge config:

        {
            "devices": [
                {
                    "name": "Miot device",
                    "ip": "192.168.xx.xx",
                    "token": "32-SYMBOL-LONG-TOKEN",
                    "model": "chuangmi.plug.212a01",
                    "pollingInterval": 5,
                    "deepDebugLog": true,
                    "buzzerControl": true,
                    "ledControl": true
                }
            ],
            "platform": "miot"
        }

I know the IP address is correct, and I am quite confident the token is correct as well (acquired from Get Mi Home device token app; from the _mihome.sqlite; and from miio discover in the device intiation state - all three methods give me the same token).

Homebridge does not show any error (and deep debug log in the plugin is on). Any ideas?

Thanks

merdok commented 3 years ago

Hi,

you would need to provide a homebridge debug log output so that I can have a look and see what the issue might be. You can check the README on how to start homebridge in debug log.

KingCZE commented 3 years ago

Hi, here it is:

[8/29/2021, 2:48:47 AM] [Homebridge UI] Homebridge restart request received
[8/29/2021, 2:48:47 AM] [Homebridge UI] UI / Bridge settings have not changed; only restarting Homebridge process
[8/29/2021, 2:48:47 AM] [Homebridge UI] Sending SIGTERM to Homebridge
[8/29/2021, 2:48:47 AM] Got SIGTERM, shutting down Homebridge...
[8/29/2021, 2:48:52 AM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[8/29/2021, 2:48:57 AM] [HB Supervisor] Restarting Homebridge...
[8/29/2021, 2:48:57 AM] [HB Supervisor] Starting Homebridge with extra flags: -I -D
[8/29/2021, 2:48:57 AM] [HB Supervisor] Started Homebridge v1.3.4 with PID: XXXXX
Initializing HAP-NodeJS v0.9.4...
[8/29/2021, 2:48:58 AM] Loaded config.json with 0 accessories and 3 platforms.
[8/29/2021, 2:48:58 AM] Loaded 2 cached accessories from cachedAccessories.
[8/29/2021, 2:48:58 AM] ---
[8/29/2021, 2:48:59 AM] Loaded plugin: homebridge-config-ui-x@4.41.2
[8/29/2021, 2:48:59 AM] Registering platform 'homebridge-config-ui-x.config'
[8/29/2021, 2:48:59 AM] ---
[8/29/2021, 2:49:00 AM] Loaded plugin: homebridge-miot@0.9.10
[8/29/2021, 2:49:00 AM] Registering platform 'homebridge-miot.miot'
[8/29/2021, 2:49:00 AM] ---
[8/29/2021, 2:49:00 AM] Loaded plugin: homebridge-tapo@1.4.7
[8/29/2021, 2:49:00 AM] Registering platform 'homebridge-tapo.TapoP100'
[8/29/2021, 2:49:00 AM] ---
[8/29/2021, 2:49:00 AM] Loaded plugin: homebridge-tplink-smarthome@6.4.0
[8/29/2021, 2:49:00 AM] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[8/29/2021, 2:49:00 AM] ---
[8/29/2021, 2:49:00 AM] Loading 3 platforms...
[8/29/2021, 2:49:00 AM] [Config] Initializing config platform...
[8/29/2021, 2:49:00 AM] [Config] Running in Service Mode
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Initializing TapoP100 platform...
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] config.json: {XXXXXXXXXXXSOMETHINGSOMETHING}
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] config: {XXXXXXXXXXXSOMETHINGSOMETHING}
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Finished initializing platform: Tapo Smart Platform
[8/29/2021, 2:49:00 AM] [miot] Initializing miot platform...
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Loading accessory from cache: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [miot] Found cached accessory Miot device
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Executed didFinishLaunching callback
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Restoring existing accessory from cache: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Start adding accessory: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Constructing P100 on host: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Handshake P100 on host: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [miot] Removing all cached accessories
[8/29/2021, 2:49:00 AM] [miot] Initializing devices
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Got device configuration, initializing device with name: Miot device
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Device info file does not exist yet!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Device model known: chuangmi.plug.212a01! Creating device!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Creating miot device!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Device Factory - Creating device instance by model: chuangmi.plug.212a01!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Initializing device properties
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Device properties: [
  "power",
  "led",
  "power_off_time",
  "temperature",
  "working_time",
  "power_consumption",
  "electric_current",
  "voltage",
  "electric_power",
  "surge_power"
]
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Initializing device actions
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Successfully created a Outlet device! It is a Mi Smart Power Plug 2.
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Initializing accessory!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Accessory Factory - Creating Outlet accessory for device Miot device!
[8/29/2021, 2:49:00 AM] [miot] [Miot device] Accessory successfully initialized!
Preparing Advertiser for 'Homebridge FD8B FE68' using bonjour-hap backend!
Setup Payload:
XXXXXXXXXXXSOMETHINGSOMETHING
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 180-33-218 │     
    └────────────┘     

Starting to advertise 'Homebridge FD8B FE68' using bonjour-hap backend!
[8/29/2021, 2:49:00 AM] Homebridge v1.3.4 (Homebridge FD8B) is running on port XXXXX.
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Received Handshake P100 on host response: 192.168.XXX.XXX
[8/29/2021, 2:49:00 AM] [Tapo Smart Platform] Device Info:  {XXXXXXXXXXXSOMETHINGSOMETHING}
[8/29/2021, 2:49:01 AM] [Tapo Smart Platform] Triggered GET OutletInUse
[8/29/2021, 2:49:01 AM] [Tapo Smart Platform] Get Characteristic On -> true
[8/29/2021, 2:49:01 AM] [Tapo Smart Platform] Triggered GET OutletInUse
[8/29/2021, 2:49:01 AM] [Tapo Smart Platform] Get Characteristic On -> true
[8/29/2021, 2:49:04 AM] [Tapo Smart Platform] Triggered GET OutletInUse
[8/29/2021, 2:49:04 AM] [Tapo Smart Platform] Device Info:  {XXXXXXXXXXXSOMETHINGSOMETHING}
[8/29/2021, 2:49:04 AM] [Tapo Smart Platform] Get Characteristic On -> true
[8/29/2021, 2:49:13 AM] [miot] [Miot device] Error: Could not connect to device, token might be wrong
[8/29/2021, 2:49:13 AM] [miot] [Miot device] Could not connect to the device! Retrying in 30 seconds!
[8/29/2021, 2:49:55 AM] [miot] [Miot device] Error: Could not connect to device, token might be wrong
[8/29/2021, 2:49:55 AM] [miot] [Miot device] Could not connect to the device! Retrying in 30 seconds!

Why would the token be wrong - I took the token from three different methods and all of them showed the same one.

merdok commented 3 years ago

[8/29/2021, 2:49:13 AM] [miot] [Miot device] Error: Could not connect to device, token might be wrong

I am pretty certain that if you see this message, that your token is wrong. It might also be that the ip you specified cannot be reached. I would recommend you to use this tool for the token, this usually work without any issues: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor

KingCZE commented 3 years ago

[8/29/2021, 2:49:13 AM] [miot] [Miot device] Error: Could not connect to device, token might be wrong

I am pretty certain that if you see this message, that your token is wrong. It might also be that the ip you specified cannot be reached. I would recommend you to use this tool for the token, this usually work without any issues: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor

Thank you very much! Working now. I will close the issue (and PM).