YinHangCode / homebridge-mi-aqara

a homebridge plugin for XiaoMi Aqara plugin.
1.08k stars 154 forks source link

wireless switch problem #2

Open KnNLmS opened 7 years ago

KnNLmS commented 7 years ago

Hi,

The plugin working almost perfect and stable. But there is an issue about Wireless button. The button shown on homekit but does not show any actions(single press, long press, double press etc) for it. So any automation function does not work in homekit.

Thanks.

YinHangCode commented 7 years ago

Hi: I decided that "wireless switch" renamed "single/duplex button 86" at version 0.2.0, because of I observed it has no status information, so it's more like a button, not a switch. If you want to automation, you must be have apple tv 4 or iPad(ios 10 later) as the central administration, I haven't personally tested this part yet. If there is a bug in this part, please describe the details.

KnNLmS commented 7 years ago

[image: Inline image 1] The wireless button i'm using above. This item shown on the homekit but it does not show any action when it does activated. I also have an ipad and defined for homekit server but because of it doesn't see any action on the button the automation commands doesn't work too.

On Wed, Jun 14, 2017 at 6:29 AM, Mr.Yin notifications@github.com wrote:

Hi: I decided that "wireless switch" renamed "single/duplex button 86" at version 0.2.0, because of I observed it has no status information, so it's more like a button, not a switch. If you want to automation, you must be have apple tv 4 or iPad(ios 10 later) as the central administration, I haven't personally tested this part yet. If there is a bug in this part, please describe the details.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308309722, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eGQcKiPLrMWJarEzAlUy584ZJ9Mnks5sD1N8gaJpZM4N5CoC .

YinHangCode commented 7 years ago

iPad can't disconnected when it's a center administration. You can also refer to the official documents: https://support.apple.com/en-us/HT207057

KnNLmS commented 7 years ago

It doesn't an issue. The button press doesn't recognized by homebridge or ho ekit.

14 Haz 2017 17:25 tarihinde "Mr.Yin" notifications@github.com yazdı:

iPad can't disconnected when it's a center administration. You can also refer to the official documents: https://support.apple.com/en-us/HT207057

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308447776, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eNZjkkmJqrlNcqrY2t3AFTMJT1H6ks5sD-0_gaJpZM4N5CoC .

YinHangCode commented 7 years ago

when the button is pressed, the icons in home app will zoom in a little bit and then recover.

KnNLmS commented 7 years ago

I know it but it doesn't do that. I used another homebridge plugin(homebridge-mijia) and button zoom in a bit and recover. But in your plugin only the button doesn't work properly. But all other stuff works very stable(But still i need gas sensor implemantation to the plugin :) ).

On Wed, Jun 14, 2017 at 5:37 PM, Mr.Yin notifications@github.com wrote:

when the button is pressed, the icons in home app will zoom in a little bit and then recover.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308451693, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eKkQKlecXKHwpqwrFW29rKwFg74Lks5sD_ArgaJpZM4N5CoC .

YinHangCode commented 7 years ago

I tested button, It seems nothing wrong, you try again.double-click and long press have reflect? button_test

gas sensor has already added at version 0.3.0, but I don't have that device. you can test it. if it have bugs, contact me.

frolov32 commented 7 years ago

Hello! And as already said thank you for the great work! I can confirm that my wireless button also does not shows any action when you click on it.

FaintGhost commented 7 years ago

Thanks a lot for your great work. But I also have the problem with wireless button. Sometime worked the wireless button. But sometime the button doesn't work.

YinHangCode commented 7 years ago

Hi friends, What's your IOS version?

KnNLmS commented 7 years ago

Hi Yin,

My ios version 10.3.2. I tried it with ipad mini4 & ipod touch 6.

On Thu, Jun 15, 2017 at 5:47 AM, Mr.Yin notifications@github.com wrote:

Hi friends, What's your IOS version?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308613370, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eKQS9mT3jOHYQyTWNRrp14TDQYbNks5sEJsrgaJpZM4N5CoC .

YinHangCode commented 7 years ago

Hi KnNLmS: I've made some changes(button, natgas detector etc.) and you can have a try on version 0.3.2.

YinHangCode commented 7 years ago

Hi friends: @KnNLmS @frolov32 @FaintGhost what's your homebridge version? "homebridge -V" can get it.

FaintGhost commented 7 years ago

Hi Yin,

My homebridge version is 0.4.20.

YinHangCode commented 7 years ago

@KnNLmS @frolov32 @FaintGhost

I try print some logs: for(item in Characteristic.ProgrammableSwitchEvent) { this.log.info("Characteristic.ProgrammableSwitchEvent: " + item + " - value: " + Characteristic.ProgrammableSwitchEvent[item]); } this.log.info("Characteristic.ProgrammableSwitchEvent: CLICK - value: " + Characteristic.ProgrammableSwitchEvent.CLICK);

the result: [6/16/2017, 12:36:14 AM] Characteristic.ProgrammableSwitchEvent: SINGLE_PRESS - value: 0 [6/16/2017, 12:36:14 AM] Characteristic.ProgrammableSwitchEvent: DOUBLE_PRESS - value: 1 [6/16/2017, 12:36:14 AM] Characteristic.ProgrammableSwitchEvent: LONG_PRESS - value: 2 [6/16/2017, 12:36:14 AM] Characteristic.ProgrammableSwitchEvent: CLICK - value: undefined

come to conclusion: there is no "CLICK" event in Characteristic.ProgrammableSwitchEvent, so use "SINGLE_PRESS"(version 0.3.1) maybe right, use "CLICK"(version 0.3.2) is wrong. but I down know why do you say "CLICK" is usable "SINGLE_PRESS" not work. My environment is IOS 10.3.2+homebridge 0.4.20+node v7.9.0, use "SINGLE_PRESS" can work, and "DOUBLE_PASS", "LONG_PRESS" is work too.

you can try print logs, observe the value of Characteristic.ProgrammableSwitchEvent.CLICK and Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS.

YinHangCode commented 7 years ago

here is a test video which is a tester sent to me. increase video volume. you can hear the first volume is click, second volume is double click, third volume is long press. and do different automation linkage. so I'm very strange. Is it I wrong understand your mean? my English is amateur, do you have Chinese speaker?

button_test_video.zip

FaintGhost commented 7 years ago

大神原来你是中国人啊!!!我一直以为你是外国人 英语把我说的累的 就是上个版本的插件无线开关不工作 而且在homekit里会自动跳会默认名称和默认房间 你更新0.3.2之后 我试了一下 只有偶尔会没响应 非常感谢大神的工作!

YinHangCode commented 7 years ago

@FaintGhost 我理解你们的问题是 单击按钮 双击按钮 长按按钮 homekit里没有响应,不知道我理解的对不对?这个问题我一个朋友帮我试了,是可以的,就是我发的那个zip包里的那个测试视频。KnNLmS哥们跟我说homebridge-mijia的那个按钮好用,我看了下homebridge-mijia的代码,他用的是Characteristic.ProgrammableSwitchEvent.CLICK,但是我拿日志打了下分明没有Characteristic.ProgrammableSwitchEvent.CLICK这个事件,值是undefined。for打印了一下Characteristic.ProgrammableSwitchEvent里的所有值只有SINGLE_PRESS, DOUBLE_PRESS , LONG_PRESS,所以我感觉用SINGLE_PRESS应该是对的,所以我0.3.3版本又改回去了。但是为什么你们说不管用呢?还是说我理解的和你们要表达的不是一个意思?

FaintGhost commented 7 years ago

@YinHangCode 0.3.1的时候 设置好动作之后 怎么按homekit里面都只是闪动但实际上什么都没发生点进去之后发现设定好的动作变成空的了 位置变回默认名字也变成一串代码 更新了0.3.2之后就都正常了 只不过偶尔会失效不知道为什么

YinHangCode commented 7 years ago

@FaintGhost 可惜我手里的ipad2没法升到ios10 那0.3.3呢?你再观察观察 不早了 早点休息吧 回头我也再试试 晚安

FaintGhost commented 7 years ago

@YinHangCode 我现在更新一下0.3.3测试一下 我在德国 现在才晚上七点多 感谢你的工作 早点休息 晚安!

YinHangCode commented 7 years ago

@FaintGhost 好吧、国内现在已经快凌晨2点了、那我先休息了、回头测有问题再反馈、

FaintGhost commented 7 years ago

@YinHangCode 升级完0.3.3目前没碰到什么问题 做了三个测试视频http://pan.baidu.com/s/1gfN3C11

KnNLmS commented 7 years ago

Hi,

Would you please right the exact command for my raspberry pi("sudo homebridge -v" only give me some warnings)? I also uninstalled and reinstalled plugin & i experienced that; feedback doesn't stable but sometimes i read single click from button.

WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see < http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs> WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see < http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>

error: unknown option `-v'

On Thu, Jun 15, 2017 at 8:47 PM, Mr.Yin notifications@github.com wrote:

@FaintGhost https://github.com/faintghost 好吧、国内现在已经快凌晨2点了、那我先休息了、 回头测有问题再反馈、

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308817844, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eAptXbthoj6OV5grKDF3BqgRjqXNks5sEW43gaJpZM4N5CoC .

YinHangCode commented 7 years ago

@KnNLmS -V, not -v upper case

KnNLmS commented 7 years ago

Then it is 0.4.20 :)

On Fri, Jun 16, 2017 at 12:51 AM, Kenan kenanelmas@gmail.com wrote:

Hi,

Would you please right the exact command for my raspberry pi("sudo homebridge -v" only give me some warnings)? I also uninstalled and reinstalled plugin & i experienced that; feedback doesn't stable but sometimes i read single click from button.

WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi- compat?s=libdns_sd&e=nodejs WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi- compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister

error: unknown option `-v'

On Thu, Jun 15, 2017 at 8:47 PM, Mr.Yin notifications@github.com wrote:

@FaintGhost https://github.com/faintghost 好吧、国内现在已经快凌晨2点了、那我先休息了、回头测有问题再反馈、

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308817844, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eAptXbthoj6OV5grKDF3BqgRjqXNks5sEW43gaJpZM4N5CoC .

YinHangCode commented 7 years ago

@KnNLmS what's ur node version?

KnNLmS commented 7 years ago

8.1.0

On Fri, Jun 16, 2017 at 2:31 AM, Mr.Yin notifications@github.com wrote:

@KnNLmS https://github.com/knnlms what's ur node version?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-aqara/issues/2#issuecomment-308892838, or mute the thread https://github.com/notifications/unsubscribe-auth/AcA3eEkUgctPSncLIdq_Fb5Fg_X1dXFyks5sEb7MgaJpZM4N5CoC .

astrojetson8 commented 7 years ago

I had similar issue as above. I can see in Home app all 3 states are being triggered but it's neither turning on or off any devices (zigbee, yeelights and wi-fi plugs) that I've assigned to them. I had automation turned off within mi app. I've restarted my homebridge few times too.

I'm using iPad Air 2 as Hub. Eventually, I noticed button data wasn't updated on iPad (after 30min or so). I tested with iPad, and it works great! However, I went back to mi app as it offer lot more customisation

I think above issue might be delay on preferences being sync across devices on Apple side.

timh1004 commented 7 years ago

I had also troubles with StatelessProgrammableSwitch (the round button) which were caused by an outdated HAP-NodeJS version. The old version did not register the same button event more than once in a row. So try updating homebridge, which also updates HAP-NodeJS and try again.

liliass commented 7 years ago

Same here.

I think I am using old mi button?

jayqizone commented 7 years ago

iOS 11 DP 6,homebridge 相关插件都是最新版

目前问题在于,事件不是靠值触发,而是靠边沿触发,如 1 -> 0,2 -> 0 都能触发单击事件,而 0 -> 0 则不能

解决思路是先把状态更新为其它值,然后再次更新为目标值来触发事件

但是 updateValue(undefined) 不会改变值、updateValue(-1) 会更新为 0、updateValue(3) 会更新为 2,因为 updateValue 方法对参数有约束,不能更新为 0,1,2 之外的值(setValue 也是)

所以可以直接用 buttonCharacteristic.value 先预设一个无意义的值,避免 updateValue 的拦截,再用 updateValue 来更新到目标值

即: buttonCharacteristic.value = undefined; buttonCharacteristic.updateValue(Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS); 可以保证触发单击事件

同理 buttonCharacteristic.value = undefined; buttonCharacteristic.updateValue(Characteristic.ProgrammableSwitchEvent.DOUBLE_PRESS); 来触发双击事件

以及 buttonCharacteristic.value = undefined; buttonCharacteristic.updateValue(Characteristic.ProgrammableSwitchEvent.LONG_PRESS); 触发长按事件

cube 也一样

没有 iOS 10 机器,不确定问题是什么时候引入的,不过这个 workaround 应该是兼容的

antongitnow commented 6 years ago

On Wed, Jun 14, 2017 at 5:37 PM, Mr.Yin @.***> wrote: when the button is pressed, the icons in home app will zoom in a little bit and then recover.

But that button does not show up in the Eve app. Homekit tells me that I need a homehub to add automation.