snOOrz / homebridge-aqara

HomeBridge plugin for Aqara gateway and devices
537 stars 74 forks source link

Xiaomi ZigBee Plug doesn't work properly #53

Open dzhankoy opened 7 years ago

dzhankoy commented 7 years ago

Hello! I have read all the issues topics, also regarding this issue, but nothing helps. Please help me)

I have ZigBee plug that has fan on it. That plug works via MiHome, but doesn't work with HomeKit, I can see the status, but can't control it.

I have Gateway and detectors in one wi-fi network (AirPort Express) and Yeelight bulbs working in another wi-fi network (Xiaomi Nano, have to purchase it, because bulb can't connect to AirPort Express). Homebridge is installed on my old iMac.

Everything work somehow, but I have a problem with Plug. Password that I got in Developer Mode of Gateway is correct. All the updates are installed.

P.S. Also I have minor problem with bulbs. It stops to work after Homebridge server has been restarted. I have to hard switch off that bulbs and switch it on then, so Homebridge can see it. If you can advise I will appreciate it.

astrojetson8 commented 7 years ago

I had similar issue not long ago.

Make sure you kill homebridge app before editing config file. Try that.

BonRm commented 7 years ago

my power plug don't work with homebridge too, they only update state on/off to homebridge if I control them with MI home

astrojetson8 commented 7 years ago

@BonRm are they zigbee or non zigbee?

BonRm commented 7 years ago

they are zigbee so I use with the xiaomi gateway

astrojetson8 commented 7 years ago

@BonRm you can control both zigbee and non-zigbee from xiaomi gateway.

i had a similar with zigbee plug. i would toggle on and off, and it wont do anything but it was working fine in mi app. no error mesage what so ever, and siri would say plug is on and off but it wasn't working. i had to delete accessories and persistent folder. please note, this will reset all your accessories names.

the issue arose for me when i deleted and added same plug in mi app. home app still had the same plug but it wont respond. and by deleting accessories and persistent folder i was able to gain access to the zigbee plug from home app.

let me know how you go.

dzhankoy commented 7 years ago

@astrojetson8 why kill the app before editing? I have killed it after saving new config and restarted it after that. Isn't it the same?

Please advise where can I find correct accessories and persistent folder? My experiments with it leads that I have no more accessories in Home app.

Thanks for your advises!

astrojetson8 commented 7 years ago

why kill the app before editing? I have killed it after saving new config and restarted it after that. Isn't it the same?

yes and no. but this is ok too!

Please advise where can I find correct accessories and persistent folder? My experiments with it leads that I have no more accessories in Home app.

it should be in your homebridge folder

BonRm commented 7 years ago

@astrojetson8 thanks for the reply. I tried in the past to delete accessories and persistent folder with no result. I just tried now other 4-5 times. First I just removed the 2 folders and the plug was not working, after this I first delete the gateway from mi home app and reset it and paired it again in mi home app, I delete again the 2 folders in homebridge folder and for a while all the sensors and zigbee plugs of the mi gateway didn't appear in the home app. After this I realize to go and check in mi home app to enable developer mode and I verify that I need to update the password in config.json because it changed after reset the gateway, after this the zigbee plugs are still not working from home app, they work only with mi home app while in home app is just updating the status...

BonRm commented 7 years ago

@astrojetson8 using DEBUG=* homebridge with the home app when i push on the zigbee plug i get

when switching on: EventedHTTPServer [::ffff:192.168.31.105] HTTP request: /characteristics +30s HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +2ms Accessory [Homebridge] Processing characteristic set: [{"aid":13,"iid":9,"value":1}] +3ms Accessory [Homebridge] Setting Characteristic "On" to value 1 +2ms EventedHTTPServer [::ffff:192.168.31.144] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":1}]} +5ms EventedHTTPServer [::ffff:192.168.31.105] Muting event '13.9' notification for this connection since it originated here. +5ms EventedHTTPServer [::ffff:192.168.31.105] HTTP Response is finished +2ms

when switching off EventedHTTPServer [::ffff:192.168.31.105] HTTP request: /characteristics +6s HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +3ms Accessory [Homebridge] Processing characteristic set: [{"aid":13,"iid":9,"value":0}] +6ms Accessory [Homebridge] Setting Characteristic "On" to value 0 +4ms EventedHTTPServer [::ffff:192.168.31.144] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":0}]} +8ms EventedHTTPServer [::ffff:192.168.31.105] Muting event '13.9' notification for this connection since it originated here. +9ms EventedHTTPServer [::ffff:192.168.31.105] HTTP Response is finished +3ms

while the debug when i control the plug with the mi home app is:

when switching off: EventedHTTPServer [::ffff:192.168.31.144] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":false}]} +13s EventedHTTPServer [::ffff:192.168.31.105] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":false}]} +5ms

when switching on: EventedHTTPServer [::ffff:192.168.31.144] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":true}]} +35s EventedHTTPServer [::ffff:192.168.31.105] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":true}]} +5ms

the difference i noticed in the line

EventedHTTPServer [::ffff:192.168.31.144] Sending HTTP event '13.9' with data: {"characteristics":[{"aid":13,"iid":9,"value":false}]}

false instead of 0 the ip ending with .144 is my apple tv3 while .105 is my iPhone

I really have no idea why I'm not able to control my 2 zigbee plugs from home app

sphinger commented 7 years ago

I have the same problem when i use home app control my zigbee plugs. after debug code, i found the problem. i receive a write_ack package which contains error messages "Invalid key". Solution:you need set platforms's password to uppercase in ~/.homebridge/config.json

dzhankoy commented 7 years ago

@sphinger hey bro, that is amazing! That is the first solution that does work for me! Muchas gracias!

fxdpz commented 7 years ago

@sphinger uppercase work like a charm. thx bro.

astrojetson8 commented 7 years ago

@sphinger strange... i'm using password as is which is lowercase, and zigbee plug works for me.

sphinger commented 7 years ago

the password just same with xiaomi Gateway password,not always to uppercase. in my case gate way password is uppercase. @astrojetson8

theo-69 commented 7 years ago

I have the same problem ZigBee 2 Button Switch from Aqara are not showing, password is uppercase. Do I need to set sid in uppercase as well?

theo-69 commented 7 years ago

hey @fxdpz can you actually trigger the live wirer switch? I can see when it get switched in homekit but i can only trigger it via MiJia App not with HomeKit