howanghk / homebridge-ewelink

Homebridge plugin to control Sonoff relays with OEM firmware
MIT License
81 stars 46 forks source link

Garage door switch type #23

Open PatrikTheDev opened 5 years ago

PatrikTheDev commented 5 years ago

Woudl it be possible to change the type of the switch to garage door? I am using the ewelink connected garage door opener (don’t remember the name) and it’s working great, but I would like to have it show up as a garage door rather than a switch

howanghk commented 5 years ago

Hi @Patrik-svobodik, in HomeKit a GarageDoorOpener is quite different from a Switch. A switch only have a on/off toggle. A GarageDoorOpener have a CurrentDoorState, TargetDoorState and ObstructionDetected characteristics, which I am not sure if your ewelink garage door opener support them or not. Even if it does support them, as I don't personally own such device, it will be hard or impossible for me to implement it.

PatrikTheDev commented 5 years ago

The device supports all info that homekit needs, I researched that (the target door state can be assumed and ObstructionDetected ignored as my garage door detects that automatically), if you want, I can give you as much diagnostic data as you want, it operates as a switch that is on when it is opened and off when closed and on turning on/off changes state (tries to open/close)

S474N commented 5 years ago

+1

All states are user defined. There is no problem :)

PatrikTheDev commented 5 years ago

And one more detail, if it tries to change state (opened/closed) but the sensor doesn’t trigger it automatically overrides it to the real state

S474N commented 5 years ago

Which device do you have as garage door opener?

PatrikTheDev commented 5 years ago

I use this as my garage door opener: https://www.google.com/amp/s/m.aliexpress.com/item/32889505304.html

st 27. 3. 2019 v 23:10 odesílatel S474N notifications@github.com napsal:

Which device do you have as garage door opener?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/howanghk/homebridge-ewelink/issues/23#issuecomment-477366653, or mute the thread https://github.com/notifications/unsubscribe-auth/AYr07WsWAIqMdkAzYFGGsdxnKjsxmMILks5va-xPgaJpZM4cFrav .

S474N commented 5 years ago

I bought this one, it's more cheaper: https://www.aliexpress.com/item/SONOFF-5V-12V-220V-RF-433MHz-Wifi-Switch-Wireless-Relay-Module-Remote-Switch-for-Android-IOS/32978091649.html

Bogdis commented 5 years ago

@S474N can you see if your garage door is open or closed with that relay? I have almost the same one but cant se if it’s open or not so i have set up a camera for that purpose, but I would like to change to the one Patrik linked to but i cant find any good info if it works properly with homebridge and shows the right state and can sent notifications if i forget to close the garage door.

PatrikTheDev commented 5 years ago

@Bogdis the one I linked works perfectly and detects the state, only downside is that it shows up as a switch instead of a garage door opener. It works reliably for me

Bogdis commented 5 years ago

@Patrik-svobotic so you mean that you can see in home app that the switch is on when gragage door is open and off when closed? Do you get notifications if you forget the garage open through home app? I saw that there is a version for tuya to and with the tuya-lan plugin you can get it to show upp as a garage door but there are still som problems there too at least for this user,

https://github.com/AMoo-Miki/homebridge-tuya-lan/issues/7

Could you test if you’re device can work with tuya app or smartlife app and tuya-lan plugin?

PatrikTheDev commented 5 years ago

I don’t know anything about tuya and I don’t plan on trying it, sorry

Bogdis commented 5 years ago

@Patrik-svobodik ok no problem 😁 what about the other things I asked about?

PatrikTheDev commented 5 years ago

The switch thing is right, you don’t get notifications saddly

čt 28. 3. 2019 v 22:02 odesílatel Bogdis notifications@github.com napsal:

@Patrik-svobodik https://github.com/Patrik-svobodik ok no problem 😁 what about the other things I asked about?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/howanghk/homebridge-ewelink/issues/23#issuecomment-477769755, or mute the thread https://github.com/notifications/unsubscribe-auth/AYr07clsjHLczy-Z97p_LajgI5e0Z3bFks5vbS3hgaJpZM4cFrav .

S474N commented 5 years ago

I used wired magnetic sensor to my smart system and up Aqara Door Sensor (via Zigbee do Aqara Hub).

howanghk commented 5 years ago

@S474N, if you are using Aqara Hub, you should look into homebridge-mi-aqara instead, which is more robust and support many type of accessories. Or if you get the latest Aqara Hub, it support HomeKit natively. You should not stick to sonoff / ewelink as they don't bother to support HomeKit, and there is no hobbyist developer adding support for it.

@Patrik-svobodik, I understand you really want it to be implemented. However, I don't have the incentive to work on it, as 1. I don't use the device; 2. I don't get paid to work for ewelink.

Therefore, you are left with 3 choices:

  1. Implement the functionality yourself (best option) This project is open source and have a relaxed license that you are free to modify the code and share your work. You can look into the source code, it's written in Javascript which is fairly easy to understand and write. Once you're done with the extra functions, you are welcome to send a pull request so the functions can be merged into this fork. This way you get what you want, and benefits all users around the world.

  2. Hire a developer to work on the Homebridge ewelink plugin This will probably be the most expensive option. It will cost $300+ USD for the work, and you will have to provide the device to the developer you hire.

  3. Choose another vendor (easiest) There are many other vendors offering home automation devices that come with native HomeKit support or have a decent Homebridge plugin. You may want to look into them. Apple have a list of supported HomeKit garage door on their website: https://www.apple.com/ios/home/accessories/#section-garage

Bogdis commented 5 years ago

@S474N how did you wired the wired magnetic sensor to the relay?

PatrikTheDev commented 5 years ago

@howanghk I will try, do you have any docs for homekit?

PatrikTheDev commented 5 years ago

Ok, so I looked through your code and it is pretty easy to understand, but I ran into one problem, uiid of the device is 1 and I have no other way to identificate it

howanghk commented 5 years ago

@Patrik-svobodik uiid 1 = SOCKET, so it's just a plain simple socket with basic on / off toggle only. 🤔

PatrikTheDev commented 5 years ago

I know that, I read the code, wondering how could I recognise the device

pá 29. 3. 2019 v 17:34 odesílatel Wong Ho Wang notifications@github.com napsal:

@Patrik-svobodik https://github.com/Patrik-svobodik uiid 1 = SOCKET, so it's just a plain simple socket with basic on / off toggle only. 🤔

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/howanghk/homebridge-ewelink/issues/23#issuecomment-478065124, or mute the thread https://github.com/notifications/unsubscribe-auth/AYr07dCdK8_5Gv6IqnIW7zUwz9N1tlrpks5vbkCbgaJpZM4cFrav .

howanghk commented 5 years ago

For documentation you may want to look at the Writing Plugins section in the homebridge README.

howanghk commented 5 years ago

Right, there might be no way to recognize it. You may add new config value to indicate a specific device should be changed to garage door type.

S474N commented 5 years ago

howanghk: this plugin is only for Mijia Gateway (2.gen), not for Aqara Gateway (3.gen with HK support). I have Aqara, and this cannot be added to NodeRED or another systems, because there is no developer mode (as on Mijia).

bogdis: I have smart system and magnet is in connected to this system.

patrik-svobodnik: this is better web and here you are GarageDoorOpener service: http://auto.caitken.com/posts/2018/09/09/nodered-homekit-reference#ServiceGarageDoorOpener