howanghk / homebridge-ewelink

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

sonoff iFan #11

Closed netRunner0 closed 4 years ago

netRunner0 commented 5 years ago

Please add and fix) PSF-B04-GL (34)

[1/30/2019, 11:41:34 AM] [eWeLink] Adding accessory for deviceId [100054afe5CH1].
[1/30/2019, 11:41:34 AM] [eWeLink] Found Accessory with Name : [iFan туалет CH 1], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7]
[1/30/2019, 11:41:34 AM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH1].
[1/30/2019, 11:41:34 AM] [eWeLink] Adding accessory for deviceId [100054afe5CH2].
[1/30/2019, 11:41:34 AM] [eWeLink] Found Accessory with Name : [iFan туалет CH 2], Manufacturer : [iFan02], Status : [on], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7]
[1/30/2019, 11:41:34 AM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH2].
[1/30/2019, 11:41:34 AM] [eWeLink] Adding accessory for deviceId [100054afe5CH3].
[1/30/2019, 11:41:34 AM] [eWeLink] Found Accessory with Name : [iFan туалет CH 3], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7]
[1/30/2019, 11:41:34 AM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH3].
[1/30/2019, 11:41:34 AM] [eWeLink] Adding accessory for deviceId [100054afe5CH4].
[1/30/2019, 11:41:34 AM] [eWeLink] Found Accessory with Name : [iFan туалет CH 4], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7]
[1/30/2019, 11:41:34 AM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH4].
[1/30/2019, 11:41:41 AM] [eWeLink] WebSocket messge received:  {"action":"update","deviceid":"10004e5ab7","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"rssi":-45},"from":"device"}
[1/30/2019, 11:41:42 AM] [eWeLink] WebSocket messge received:  {"action":"update","deviceid":"100054afe5","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"app","sequence":"1548837702184","ts":0,"params":{"switches":[{"switch":"off","outlet":0},{"outlet":1,"switch":"on"},{"switch":"off","outlet":2},{"switch":"off","outlet":3}]}}
[1/30/2019, 11:41:42 AM] [eWeLink] Adding accessory for deviceId [100054afe5CH1].
[1/30/2019, 11:41:42 AM] [eWeLink] Found Accessory with Name : [iFan туалет CH 1], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7]
/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:266
      throw new Error("Cannot add a bridged Accessory with the same UUID as another bridged Accessory: " + existing.UUID);
homebridge.service: Main process exited, code=exited, status=1/FAILURE
homebridge.service: Unit entered failed state.
homebridge.service: Failed with result 'exit-code'.
pam_unix(sudo:session): session closed for user root
homebridge.service: Service hold-off time over, scheduling restart.
Stopped Node.js HomeKit Server.
Started Node.js HomeKit Server.
howanghk commented 5 years ago

Hi @netRunner0, how was the error triggered? The bug seems to be related to multi-channel device. Unfortunately I don't own a multi-channel device myself so I cannot reproduce the bug on my side. It's hard to fix a bug that is not reproducible. 🙈

netRunner0 commented 5 years ago

Can I give you remote access?

The error was caused when channels were added to the homekit, but after the homebridge error, they disappeared from the homekit ...

Now 1 switch is displayed and it does not work.

The device itself supports 3 modes of fan operation (and shutdown), 1 light mode

netRunner0 commented 5 years ago

[1/30/2019, 1:07:06 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100054afe5","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"app","sequence":"1548842825764","ts":0,"params":{"switches":[{"outlet":0,"switch":"off"},{"outlet":1,"switch":"off"},{"outlet":2,"switch":"off"},{"outlet":3,"switch":"off"}]}} [1/30/2019, 1:07:06 PM] [eWeLink] Adding accessory for deviceId [100054afe5CH1]. [1/30/2019, 1:07:06 PM] [eWeLink] Found Accessory with Name : [iFan туалет CH 1], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7] [1/30/2019, 1:07:06 PM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH1]. [1/30/2019, 1:07:06 PM] [eWeLink] Adding accessory for deviceId [100054afe5CH2]. [1/30/2019, 1:07:06 PM] [eWeLink] Found Accessory with Name : [iFan туалет CH 2], Manufacturer : [iFan02], Status : [on], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7] [1/30/2019, 1:07:06 PM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH2]. [1/30/2019, 1:07:06 PM] [eWeLink] Adding accessory for deviceId [100054afe5CH3]. [1/30/2019, 1:07:06 PM] [eWeLink] Found Accessory with Name : [iFan туалет CH 3], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7] [1/30/2019, 1:07:06 PM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH3]. [1/30/2019, 1:07:06 PM] [eWeLink] Adding accessory for deviceId [100054afe5CH4]. [1/30/2019, 1:07:06 PM] [eWeLink] Found Accessory with Name : [iFan туалет CH 4], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [26951b0e-a2ac-4a20-b230-e42c1b14f7a7] [1/30/2019, 1:07:06 PM] [eWeLink] Error updating non-exist accessory with deviceId [100054afe5CH4]. [1/30/2019, 1:07:08 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2206"},"from":"device"} [1/30/2019, 1:07:10 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2203"},"from":"device"} [1/30/2019, 1:07:12 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2200"},"from":"device"} [1/30/2019, 1:08:26 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2190"},"from":"device"} [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [POW R2] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [iFan туалет CH 1] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [4ch CH 2] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [iFan туалет CH 2] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [4ch CH 1] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [iFan туалет CH 4] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [4ch CH 3] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [4ch CH 4] [1/30/2019, 1:08:26 PM] [eWeLink] Requesting power state for [iFan туалет CH 3] [1/30/2019, 1:08:27 PM] [eWeLink] Device [4ch CH 4] was reported to be offline by the API [1/30/2019, 1:08:27 PM] [eWeLink] Device [iFan туалет CH 1] did not exist in the response. It will be removed [1/30/2019, 1:08:27 PM] [eWeLink] Removing accessory [iFan туалет CH 1] [1/30/2019, 1:08:27 PM] [eWeLink] Device [POW R2] was reported to be offline by the API [1/30/2019, 1:08:27 PM] [eWeLink] Device [iFan туалет CH 4] did not exist in the response. It will be removed [1/30/2019, 1:08:27 PM] [eWeLink] Removing accessory [iFan туалет CH 4] [1/30/2019, 1:08:28 PM] [eWeLink] Device [4ch CH 1] was reported to be offline by the API [1/30/2019, 1:08:28 PM] [eWeLink] Device [iFan туалет CH 2] did not exist in the response. It will be removed [1/30/2019, 1:08:28 PM] [eWeLink] Removing accessory [iFan туалет CH 2] [1/30/2019, 1:08:28 PM] [eWeLink] Device [iFan туалет CH 3] did not exist in the response. It will be removed [1/30/2019, 1:08:28 PM] [eWeLink] Removing accessory [iFan туалет CH 3] [1/30/2019, 1:08:28 PM] [eWeLink] Device [4ch CH 3] was reported to be offline by the API [1/30/2019, 1:08:28 PM] [eWeLink] Device [4ch CH 2] was reported to be offline by the API [1/30/2019, 1:08:32 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2189"},"from":"device"} [1/30/2019, 1:08:35 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff2d","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"37"},"from":"device"} [1/30/2019, 1:08:45 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff2d","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"35"},"from":"device"} [1/30/2019, 1:08:46 PM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"100050ff15","apikey":"26951b0e-a2ac-4a20-b230-e42c1b14f7a7","userAgent":"device","ts":0,"params":{"power":"2192"},"from":"device"}

howanghk commented 5 years ago

OK, I guess having remote access to the device might help debugging this. It would be great if you can share your device to me for a while so that I can try to reproduce the bug on my side.

Disclaimer: life is busy, even with the bug reproduced, I may not have time to fix this today.

netRunner0 commented 5 years ago

Ok, just write to the telegram how you will be ready @netrunner0

netRunner0 commented 5 years ago

I can give access to the device for your account)

howanghk commented 5 years ago

Ok, just write to the telegram how you will be ready @netRunner0

sorry I've been really busy recently. you may telegram me @howang

netRunner0 commented 5 years ago

Sorry, I have flashed my ifan firmware with tasmota. I ordered more, as they come, we will definitely solve the problem. Sorry again

dawiz77 commented 5 years ago

Hi,

I'm also having issues with the iFan02:

May 05 11:39:14 raspberrypi homebridge[2557]: [5/5/2019, 11:39:14] [eWeLink] Requesting power state for [Living Room Fan] May 05 11:39:14 raspberrypi homebridge[2557]: [5/5/2019, 11:39:14] [eWeLink] API reported an unknown status for device [Living Room Fan]

It's constantly set to "no response". For some reason, the API returns a "status unknown" for the device. More than willing to work with you on the issue

JangoBritt commented 5 years ago

I'm having the same problem. Will be happy to share remote access to the fan, for development purposes

JangoBritt commented 5 years ago

I'm confused, this repo appears to be missing the codes for the Fan from the MrTomAsh master. Which is considered the most up to date Repo, and how do I make sure I install that one? using npm install -g homebridge-ewelink-max picks up your repo, and not the MrTomAsh one

JangoBritt commented 5 years ago

added PR #30

howanghk commented 5 years ago

Hi @JangoBritt, it seems @netRunner0 (the author of this issue) created a pull request on MrTomAsh's repo to merge with my repo (see https://github.com/MrTomAsh/homebridge-ewelink/pull/6), and somehow MrTomAsh merged it so his repo is now identical to the code in my repo 5 months ago. His version was published on npm as homebridge-ewelink-plus. Although he merged the code on github, he did not publish the new code onto npm.

Regarding the PR, let's continue the discussion there #30.

dk32843 commented 5 years ago

So, I am a little confused. I installed the eWeLink-Max plugin and then got the following errors. In addition, my whole HomeBridge would not load/connect. I would really appreciate someone helping me. I am new to the HomeBridge scene and just trying to figure it all out. - Thanks!

[The last line, WebSocket error, just repeats every 8 minutes]

[6/29/2019, 12:40:30 AM] [eWeLink] Adding accessory for deviceId [10005b2d4aCH1]. [6/29/2019, 12:40:30 AM] [eWeLink] Found Accessory with Name : [Fan CH 1], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [5d5290a6-381f-4af9-accb-1fe96b20305e] [6/29/2019, 12:40:30 AM] [eWeLink] Can't add [Fan CH 1], because device [iFan02] has only [0] switches. [6/29/2019, 12:40:30 AM] [eWeLink] Error updating non-exist accessory with deviceId [10005b2d4aCH1]. [6/29/2019, 12:40:30 AM] [eWeLink] Adding accessory for deviceId [10005b2d4aCH2]. [6/29/2019, 12:40:30 AM] [eWeLink] Found Accessory with Name : [Fan CH 2], Manufacturer : [iFan02], Status : [on], Is Online : [true], API Key: [5d5290a6-381f-4af9-accb-1fe96b20305e] [6/29/2019, 12:40:30 AM] [eWeLink] Can't add [Fan CH 2], because device [iFan02] has only [0] switches. [6/29/2019, 12:40:30 AM] [eWeLink] Error updating non-exist accessory with deviceId [10005b2d4aCH2]. [6/29/2019, 12:40:30 AM] [eWeLink] Adding accessory for deviceId [10005b2d4aCH3]. [6/29/2019, 12:40:30 AM] [eWeLink] Found Accessory with Name : [Fan CH 3], Manufacturer : [iFan02], Status : [off], Is Online : [true], API Key: [5d5290a6-381f-4af9-accb-1fe96b20305e] [6/29/2019, 12:40:30 AM] [eWeLink] Can't add [Fan CH 3], because device [iFan02] has only [0] switches. [6/29/2019, 12:40:30 AM] [eWeLink] Error updating non-exist accessory with deviceId [10005b2d4aCH3]. [6/29/2019, 12:40:30 AM] [eWeLink] Adding accessory for deviceId [10005b2d4aCH4]. [6/29/2019, 12:40:30 AM] [eWeLink] Found Accessory with Name : [Fan CH 4], Manufacturer : [iFan02], Status : [on], Is Online : [true], API Key: [5d5290a6-381f-4af9-accb-1fe96b20305e] [6/29/2019, 12:40:30 AM] [eWeLink] Can't add [Fan CH 4], because device [iFan02] has only [0] switches. [6/29/2019, 12:40:30 AM] [eWeLink] Error updating non-exist accessory with deviceId [10005b2d4aCH4]. [6/29/2019, 12:49:16 AM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"10005b2d4a","apikey":"5d5290a6-381f-4af9-accb-1fe96b20305e","userAgent":"device","ts":0,"params":{"rssi":-52},"from":"device"} [6/29/2019, 12:53:16 AM] [eWeLink] WebSocket messge received: {"action":"update","deviceid":"10005b2d4a","apikey":"5d5290a6-381f-4af9-accb-1fe96b20305e","userAgent":"device","ts":0,"params":{"rssi":-55},"from":"device"}

howanghk commented 4 years ago

Fan support have been added by bassrock in https://github.com/howanghk/homebridge-ewelink/pull/57 and released in version 0.1.18, please install the latest version with

npm install -g homebridge-ewelink-max@latest
JangoBritt commented 4 years ago

The plugin still adds 4 separate device channels (light, On, Med, High)

Would be preferable if this could appear as a fully functional Light fan device type in HomeKit, rather than as 4 separate channels.