howanghk / homebridge-ewelink

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

Use as Garage Door Opener #20

Open bktz opened 5 years ago

bktz commented 5 years ago

I am looking to use this to open my garage door. I have a sensor attached to the garage door that will allow to detect if the door is fully closed (off) or partially open (on). The issue I am having is that within 2 seconds of opening the door another request is sent to the device. This causes the garage door to stop opening.

I have attached a log below:

[3/17/2019, 2:12:17 PM] [Garage] Setting power state to [on] for device [Garage]
[3/17/2019, 2:12:17 PM] [Garage] WebSocket messge received:  {"error":0,"deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","sequence":"1552846337411"}
[3/17/2019, 2:12:18 PM] [Garage] WebSocket messge received:  {"action":"update","deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device"}
[3/17/2019, 2:12:18 PM] [Garage] Updating recorded Characteristic.On for [Garage] to [false]. No request will be sent to the device.
[3/17/2019, 2:12:18 PM] [Garage] Setting power state to [off] for device [Garage]
[3/17/2019, 2:12:19 PM] [Garage] WebSocket messge received:  {"action":"update","deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","userAgent":"device","ts":0,"params":{"switch":"off"},"from":"device"}
[3/17/2019, 2:12:19 PM] [Garage] Updating recorded Characteristic.On for [Garage] to [false]. No request will be sent to the device.
[3/17/2019, 2:12:19 PM] [Garage] Setting power state to [off] for device [Garage]
[3/17/2019, 2:12:19 PM] [Garage] WebSocket messge received:  {"error":0,"deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","sequence":"1552846338947"}
[3/17/2019, 2:12:20 PM] [Garage] WebSocket messge received:  {"error":0,"deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","sequence":"1552846339493"}
[3/17/2019, 2:12:20 PM] [Garage] WebSocket messge received:  {"action":"update","deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","userAgent":"device","ts":0,"params":{"switch":"on"},"from":"device"}
[3/17/2019, 2:12:20 PM] [Garage] Updating recorded Characteristic.On for [Garage] to [true]. No request will be sent to the device.
[3/17/2019, 2:12:20 PM] [Garage] Setting power state to [on] for device [Garage]
[3/17/2019, 2:12:20 PM] [Garage] WebSocket messge received:  {"error":0,"deviceid":"1000000000","apikey":"xxxx-xxxx-xxxx-xxxx-xxxx","sequence":"1552846340460"}

Has anyone else solved this problem? This is the specific device that I have: https://www.itead.cc/smart-home/inching-self-locking-wifi-wireless-switch.html

howanghk commented 5 years ago

Hi @bktz, the device you're using support a "inching mode" that will toggle its state after 1 second, which match the behaviour in your logs. At 2:12:17, you turn on the switch, and then in the same second the device acknowledged the changes with "error":0, then one second later, at 2:12:18, the device send an update notifying it is turning off.

Quoting from the website link you provided:

When in inching mode, customers can have two wiring ways to select:

Turn on 1s and then auto-off Turn off 1s and then auto-on.

I guess you should change to self-locking mode.

Bogdis commented 5 years ago

@bktz what sensor are you using and how dit you wired it? I have the same device as you but without the sensor thing so i cant se if its opened. Does it show up as a garage door or just a switch in homebridge?