howanghk / homebridge-ewelink

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

Sonoff touch t1 2c #6

Closed Jaguaza closed 4 years ago

Jaguaza commented 5 years ago

Hello.

I just added this device to ewelink but it does not recognize it homebridge.

Could you help me find out what the problem is?

Thank you.

iphone, romversion and appversion incorrect

[eWeLink] A total of [0] accessories were loaded from the local cache [1/15/2019, 11:47:50 PM] [eWeLink] Sending login request with user credentials: {"email":"xxxxxxxx@gmail","password":"xxxxxxxxx","version":"6","ts":"xxxxxxxx","nonce":"xxxxxxxxxxxxxxxx","appid":"xxxxxxxxxxxxxxxxxxxxxxx","imei":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx","os":"iOS","model":"iPhone10,6","romVersion":"11.1.2","appVersion":"3.5.3"} [1/15/2019, 11:47:50 PM] [eWeLink] Login signature: xxxxxxxxxxxxxxxxxxxxxxxxxx

[eWeLink] Server did not response with an authentication token. Response was [{"error":400,"info":"msg is not complete"}] [1/15/2019, 11:47:51 PM] [eWeLink] Requesting a list of devices from eWeLink HTTPS API at [https://us-api.coolkit.cc:8080] [1/15/2019, 11:47:51 PM] [eWeLink] An error was encountered while requesting a list of devices. Response was [{"error":401}]

howanghk commented 5 years ago

It seems the login didn't get through. Please double check your email and password. It seems your email address is incomplete? The appid, model, romVersion and appVersion are just hardcoded values. They worked fine for me.

Jaguaza commented 5 years ago

It works now.

But there are two small drawbacks.

My switch is a two-gang one but a three-gang one appears in Homebridge .

Another small problem is that there are no real-time updates in the Home app once you make manual changes.

Example:

If you turn on a light from the switch and the app is open, this change will not be registered.

For it to be updated you have to exit and re-enter the Home app.

This problem causes many Home app environments and settings to fail with this device.

Otherwise excellent work and thanks for help.

Do you know any solution to this problem?

howanghk commented 5 years ago

Hi @Jaguaza, the plugin was written for single switch device only. Would you please share the homebridge log when you toggle the switch manually?

Jaguaza commented 5 years ago

Hi @Jaguaza, the plugin was written for single switch device only. Would you please share the homebridge log when you toggle the switch manually?

Hello again.

This is the console output when I access the Home app.

[1/19/2019, 10:52:02 PM] [eWeLink] Requesting power state for [SALÓN 1 CH 1] [1/19/2019, 10:52:02 PM] [eWeLink] Requesting power state for [SALÓN PASILLO CH 2] [1/19/2019, 10:52:02 PM] [eWeLink] Requesting power state for [SALÓN PASILLO CH 1] [1/19/2019, 10:52:02 PM] [eWeLink] Requesting power state for [SALÓN 1 CH 2] [1/19/2019, 10:52:02 PM] [eWeLink] API reported that [SALÓN ENTRADA] CH 1 is Off [1/19/2019, 10:52:02 PM] [eWeLink] API reported that [SALÓN PASILLO] CH 1 is Off [1/19/2019, 10:52:02 PM] [eWeLink] API reported that [SALÓN PASILLO] CH 2 is Off [1/19/2019, 10:52:02 PM] [eWeLink] API reported that [SALÓN ENTRADA] CH 2 is Off

And this is the output when I manually press a button.

[1/19/2019, 10:54:10 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"0000000000","apikey":"99999999-9999-9999-9999-999999999999","userAgent":"device","ts":0,"params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"} [1/19/2019, 10:54:10 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"11111111111","apikey":"apikey":"99999999-9999-9999-9999-999999999999","userAgent":"server","sequence":"1547934850027","ts":0,"params":{"controlType":8,"switches":[{"outlet":0,"switch":"on"},{"outlet":1,"switch":"off"},{"outlet":2,"switch":"off"},{"outlet":3,"switch":"off"}]},"sceneid":"5c420b5f8e9b7abb0553ff19","sceneHistoryid":"a1408c4487be46b7b0c703e3d7510071"}

howanghk commented 5 years ago

Hi @Jaguaza, I have published a new version of the plugin (0.1.11) which should handle channel counts correctly and should update the status properly. Please let me know if this version works for you.

Jaguaza commented 5 years ago

Thanks for your quick response, but it’s been a change for the worse.

Now, when I start form the Home app, homebridge restarts by itself.


[37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m Requesting power state for [SALÓN 1 CH 1] [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m Requesting power state for [SALÓN PASILLO CH 2] [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m Requesting power state for [SALÓN PASILLO CH 1] [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m Requesting power state for [SALÓN 1 CH 2] [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m API reported that [SALÓN ENTRADA] CH 1 is Off [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m API reported that [SALÓN PASILLO] CH 2 is Off [37m[1/21/2019, 2:07:51 PM] [39m [36m[eWeLink] [39m API reported that [SALÓN PASILLO] CH 1 is Off [37m[1/21/2019, 2:07:53 PM] [39m [36m[eWeLink] [39m API reported that [SALÓN ENTRADA] CH 2 is Off [37m[1/21/2019, 2:07:59 PM] [39m [36m[eWeLink] [39m Setting power state to [on] for device [SALÓN 1 CH 2] [37m[1/21/2019, 2:07:59 PM] [39m [36m[eWeLink] [39m WebSocket messge received: {"error":0,"deviceid":"9999999999","apikey":"99999999-9999-9999-9999-999999999999","sequence":"1548076079481"} [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m WebSocket messge received: {"action":"update","deviceid":"9999999999","apikey":"99999999-9999-9999-9999-999999999999","userAgent":"server","sequence":"1548076079753","ts":0,"params":{"controlType":8,"switches":[{"outlet":0,"switch":"off"},{"outlet":1,"switch":"on"},{"outlet":2,"switch":"off"},{"outlet":3,"switch":"off"}]},"sceneid":"5c4209c18e9b7abb0553ff0b","sceneHistoryid":"946b8cf232fd41be8ae2bd26e93712fe"} [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Updating recorded Characteristic.On for [SALÓN PASILLO CH 1] to [false]. No request will be sent to the device. [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Setting power state to [off] for device [SALÓN PASILLO CH 1] [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Updating recorded Characteristic.On for [SALÓN PASILLO CH 2] to [true]. No request will be sent to the device. [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Setting power state to [on] for device [SALÓN PASILLO CH 2] [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Updating recorded Characteristic.On for [SALÓN PASILLO CH 3] to [false]. No request will be sent to the device. [37m[1/21/2019, 2:08:00 PM] [39m [36m[eWeLink] [39m Setting power state to [off] for device [SALÓN PASILLO CH 3]

howanghk commented 5 years ago

Oh I am sorry to heard about that. As I do not have a multi-channel device, I cannot test the plugin on my own. Your log seems to be fine, which do not contains any error. Do you happen to have an error log too?

Jaguaza commented 5 years ago

Oh I am sorry to heard about that. As I do not have a multi-channel device, I cannot test the plugin on my own. Your log seems to be fine, which do not contains any error. Do you happen to have an error log too?

Good evening.

I have put homebridge in default Mode and this is what the log says:

[1/21/2019, 9:47:42 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"9999999999","apikey":"99999999-9999-9999-9999-9999999999","userAgent":"device","ts":0,"params":{"switches":[{"switch":"on","outlet":0},{"switch":"off","outlet":1},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]},"from":"device"} [1/21/2019, 9:47:42 PM] [eWeLink] Updating recorded Characteristic.On for [SALÓN PASILLO CH 1] to [true]. No request will be sent to the device. [1/21/2019, 9:47:42 PM] [eWeLink] Setting power state to [on] for device [SALÓN PASILLO CH 1] [1/21/2019, 9:47:42 PM] [eWeLink] Updating recorded Characteristic.On for [SALÓN PASILLO CH 2] to [false]. No request will be sent to the device. [1/21/2019, 9:47:42 PM] [eWeLink] Setting power state to [off] for device [SALÓN PASILLO CH 2]

/homebridge/node_modules/homebridge-ewelink-max/index.js:421 platform.log("Updating recorded Characteristic.On for [%s] to [%s]. No request will be sent to the device.", accessory.displayName, isOn); ^ TypeError: Cannot read property 'displayName' of undefined at eWeLink.updatePowerStateCharacteristic (/homebridge/node_modules/homebridge-ewelink-max/index.js:421:124) at /homebridge/node_modules/homebridge-ewelink-max/index.js:234:54 at Array.forEach () at WebSocketClient.platform.wsc.onmessage (/homebridge/node_modules/homebridge-ewelink-max/index.js:232:58) at WebSocket.instance.on (/homebridge/node_modules/homebridge-ewelink-max/index.js:840:14) at WebSocket.emit (events.js:182:13) at Receiver._receiver.onmessage (/homebridge/node_modules/ws/lib/WebSocket.js:141:47) at Receiver.dataMessage (/homebridge/node_modules/ws/lib/Receiver.js:389:14) at Receiver.getData (/homebridge/node_modules/ws/lib/Receiver.js:330:12) at Receiver.startLoop (/homebridge/node_modules/ws/lib/Receiver.js:165:16) at Receiver.add (/homebridge/node_modules/ws/lib/Receiver.js:139:10) at TLSSocket._ultron.on (/homebridge/node_modules/ws/lib/WebSocket.js:138:22) at TLSSocket.emit (events.js:182:13) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at TLSSocket.Readable.push (_stream_readable.js:219:10)

I wanted to tell you that if you want it and if we can contact in private, I can provide you with a Sonoff Touch so you can do testing with it.

howanghk commented 5 years ago

Hi @Jaguaza, thanks for the error log. I have just publish a new version (0.1.12) which should fix the issue.

howanghk commented 4 years ago

Closing due to inactivity.