joe-ng / homebridge-dyson-link

MIT License
207 stars 40 forks source link

Accessories show up as available but are unresponsive and cause conflict with the Next Accessory #15

Open BernardoDesigns opened 6 years ago

BernardoDesigns commented 6 years ago

I suspect that it's an issue with the json file but would you be available to help diagnose what the issue really is?

To reset it to where my Nest accessory works again, I have to sudo uninstall the Dyson plugin > remove all mention of it in the config > then fire up homebridge again.

The odd thing is when I do this, the Dyson accessories still show up img_6fe16e07d96e-1

Any help would be greatly appreciated. I've installed Node v9.4.0

joe-ng commented 6 years ago

Can you send me the log you saw from homebridge that tagged with [DysonPlatform] when you tried to start homebridge? That would help to understand if the dyson plugin was running fine

aleszczynskig commented 6 years ago

Hi, I am seeing a similar issue where I have two sets of devices added for a single device. One set are working correctly, the others are just there but do not respond or display any information. I only have one accessory configured in my config.json.

The issue seems to have started after I initially started Homebridge with he config.json pointing to the wrong up address. After I corrected it, I got a second set of devices.

I do not know how to remove the incorrect set so the only work around I have is to remove hem from favourites and notifications and assign them to the default room.

Do you know how to resolve this?

joe-ng commented 6 years ago

@aleszczynskig , did you try to rename cachedAccessories in your homebridge accessories directory to see if that works?

aleszczynskig commented 6 years ago

I will give it ago.

aleszczynskig commented 6 years ago

So I renamed the file and restarted Homebridge and the additional set of devices are still showing in default room as before.

It doesn’t seem to have worked.

BernardoDesigns commented 6 years ago

@joe-ng sorry I never saw your response. Here is the error I'm getting

TypeError: Cannot read property 'indexOf' of undefined at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:50:12) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:660:30) at Object.Module._extensions..js (module.js:671:10) at Module.load (module.js:573:32) at tryModuleLoad (module.js:513:12) at Function.Module._load (module.js:505:3) at Function.Module.runMain (module.js:701:10) at startup (bootstrap_node.js:190:16) at bootstrap_node.js:662:3

BernardoDesigns commented 6 years ago
screen shot 2018-08-18 at 2 21 10 pm

Here's a screenshot of the terminal, if it's useful.. also there is no mention of spotify in my config file so I suspect there is an old cache or something that I need to clear?

joe-ng commented 6 years ago

did you uninstall that plugin as well?

BernardoDesigns commented 6 years ago

I must have forgotten to do that, but after I did I am still receiving the following errors in terminal

screen shot 2018-08-25 at 11 11 22 am
BernardoDesigns commented 6 years ago

Perhaps its something I did wrong in the config? I ran it through a json validator and there werent any errors there tho.

joe-ng commented 6 years ago

maybe you can try to delete/rename for your cache(cachedAccessories) to see if that works it's in .homebridge/accessories folder

joe-ng commented 6 years ago

the config should be something like below, it seemed that you have mixed that up with other platforms. i.e. Dyson config should be all put udner platform

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" }, "platforms": [ { "platform": "DysonPlatform", "name": "Dyson", "accessories": [ { "ip": "192.168.1.124", "displayName": "Dyson TP02", "serialNumber": "DYSON-xxx-US-xxx1836A-475", "password": "xxxxxxxxx" } ] } ] }

joe-ng commented 6 years ago

to merge it with your existing config, it would be

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" }, "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.", "accessories": [ { "accessory": "LGTv2", "name": "Loft TV", "mac": "14:C9:13:15:C1:07", "ip": "10.0.0.2" } ], "platforms": [ { "platform": "Nest", "token": "masked", "clientId": "masked", "clientSecret": "masked", "code": "masked", "username": "your account", "password": "your password" }, { "platform": "DysonPlatform", "name": "Dyson", "accessories": [ { "ip": "ip of your dyson device", "displayName": "Dyson Fan", "serialNumber": "your dyson serial number", "password": "your dyson password" } ] } ] }

BernardoDesigns commented 6 years ago

Thank you so much for your help thus far. I did what you suggested and now the homebridge launches successfully and I can see the devices in my homekit, but now the Nest and the Dyson items are in a perpetual state of "updating".

Here is the what is in terminal.. something about "max listeners" and a memory leak

[Dyson] Request for current state update (node:17346) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 16 undefined listeners added. Use emitter.setMaxListeners() to increase limit

Any idea what to do next?

BernardoDesigns commented 6 years ago

I ran homebridge in a diagnostic mode and it listed the steps as it was building, there seems to be something about a username and pw not found, see below

screen shot 2018-08-26 at 10 51 18 am
BernardoDesigns commented 6 years ago

@joe-ng

Any other thoughts that could help here?

joe-ng commented 6 years ago

the message on the screenshot you sent was not an error unless you are using the 2018 version of Dyson cool device

if you still saw message like below, maybe you can try to have two homebridge instances running, one with Dyson, one with nest because these two plugins might both use event emitter

[Dyson] Request for current state update (node:17346) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 16 undefined listeners added. Use emitter.setMaxListeners() to increase limit

BernardoDesigns commented 6 years ago

That’s an interesting approach, I hadn’t thought of that. How would you make sure that the 2nd instance of home bridge is working with the config that only has the Dyson parameters?

On Sep 8, 2018, at 4:26 AM, joe-ng notifications@github.com wrote:

the message on the screenshot you sent was not an error unless you are using the 2018 version of Dyson cool device

if you still saw message like below, maybe you can try to have two homebridge instances running, one with Dyson, one with nest because these two plugins might both use event emitter

[Dyson] Request for current state update (node:17346) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 16 undefined listeners added. Use emitter.setMaxListeners() to increase limit

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joe-ng/homebridge-dyson-link/issues/15#issuecomment-419634866, or mute the thread https://github.com/notifications/unsubscribe-auth/AEq18_PPuq0n3Sc9EtE9TzXqpFKJYFR5ks5uY6lIgaJpZM4RzhrP.

joe-ng commented 6 years ago

you will need to have two homebridge config file(with different ports set for that as well) and one for Nest, one for Dyson

hawartens commented 5 years ago

@joe-ng Not sure the approach you described is a proper workaround.

I have configured my system to start Nest accessories like so:

/usr/bin/homebridge --user-storage-path ~/.home-bridge-nest

I have configured my system to start Dyson accessories like so:

/usr/bin/homebridge --user-storage-path ~/.homebridge-dyson

Inside my ~/.homebridge-dyson/config.dyson:

{
    "bridge": {
        "name": "Bridgename",
        "username": "Username",
        "port": "UniquePortForDysonHomebridge",
        "pin": "PinNumer"
    },

    "platforms": [
        {
            "platform"     : "DysonPlatform",
            "name"         : "DysonPlatform",
            "email"        : "MyEmail",
            "password"     : "MyPass",
            "country"      : "US",
            "accessories"  : [
                {
                    "ip": "DysonIPAddress",
                    "displayName": "Dyson Purifier",
                    "serialNumber": "DysonSerialNumber"
                }
            ]
        }
    ]
}

However, I am still seeing the issue you mentioned from the Dyson instance:

(node:1381) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 16 undefined listeners added. Use emitter.setMaxListeners() to increase limit

This seems to cause the Dyson device(s) fail to update. The problem seems to be sporadic. The Dyson devices sometimes update correctly and other times show the above warning and fail to update.

RomainMuller commented 5 years ago

I have similar symptoms happening after a while. If I power cycle the Dyson fan (a DYSON-PT4-EU- series), it starts updating it's status again normally.

[2/18/2019, 6:45:37 AM] [DysonPlatform] Update fan data from CURRENT-STATE - Dyson Pure
[2/18/2019, 6:45:37 AM] [DysonPlatform] {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-02-18T05:45:34.004Z","data":{"tact":"2953","hact":"0048","pact":"0000","vact":"0000","sltm":"OFF"}}
[2/18/2019, 6:45:37 AM] [DysonPlatform] Update sensor data from ENVIRONMENTAL-CURRENT-SENSOR-DATA - Dyson Pure
[2/18/2019, 6:46:55 AM] [DysonPlatform] {"msg":"STATE-CHANGE","time":"2019-02-18T05:46:52.000Z","mode-reason":"","state-reason":"ENV","product-state":{"fmod":["AUTO","AUTO"],"fnst":["OFF","FAN"],"fnsp":["AUTO","AUTO"],"qtar":["0001","0001"],"oson":["OFF","OFF"],"rhtm":["ON","ON"],"filf":["0111","0111"],"ercd":["NONE","NONE"],"nmod":["ON","ON"],"wacd":["NONE","NONE"],"hmod":["OFF","OFF"],"hmax":["2930","2930"],"hsta":["OFF","OFF"],"ffoc":["ON","ON"],"tilt":["OK","OK"]},"scheduler":{"srsc":"a419","dstv":"0001","tzid":"0001"}}
[2/18/2019, 6:46:55 AM] [DysonPlatform] STATE-CHANGE detected, request update - Dyson Pure
[2/18/2019, 6:46:55 AM] [DysonPlatform] Number of listeners - sensor:0 fan:0
[2/18/2019, 6:46:55 AM] [DysonPlatform] Request for current state update
[2/18/2019, 6:46:55 AM] [DysonPlatform] {"msg":"CURRENT-STATE","time":"2019-02-18T05:46:52.001Z","mode-reason":"","state-reason":"ENV","dial":"OFF","rssi":"-64","product-state":{"fmod":"AUTO","fnst":"FAN","fnsp":"AUTO","qtar":"0001","oson":"OFF","rhtm":"ON","filf":"0111","ercd":"NONE","nmod":"ON","wacd":"NONE","hmod":"OFF","hmax":"2930","hsta":"OFF","ffoc":"ON","tilt":"OK"},"scheduler":{"srsc":"a419","dstv":"0001","tzid":"0001"}}
[2/18/2019, 6:46:55 AM] [DysonPlatform] Update fan data from CURRENT-STATE - Dyson Pure
[2/18/2019, 6:46:55 AM] [DysonPlatform] {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2019-02-18T05:46:52.002Z","data":{"tact":"2955","hact":"0050","pact":"0000","vact":"0001","sltm":"OFF"}}
[2/18/2019, 6:46:55 AM] [DysonPlatform] Update sensor data from ENVIRONMENTAL-CURRENT-SENSOR-DATA - Dyson Pure
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"hmax":2925}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Number of listeners - sensor:0 fan:1
[2/18/2019, 9:59:59 AM] [DysonPlatform] Request for current state update
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"FAN"}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Number of listeners - sensor:0 fan:2
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set target heater cooler state: 2
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"FAN"}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"hmod":"OFF"}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Number of listeners - sensor:0 fan:3
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure Set Fan Auto State according to target fan state: true
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"AUTO"}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Number of listeners - sensor:0 fan:4
[2/18/2019, 9:59:59 AM] [DysonPlatform] Dyson Pure - Set State:{"nmod":"OFF"}
[2/18/2019, 9:59:59 AM] [DysonPlatform] Number of listeners - sensor:0 fan:5
[2/18/2019, 8:02:40 PM] [DysonPlatform] Number of listeners - sensor:0 fan:6
[2/18/2019, 8:02:40 PM] [DysonPlatform] Number of listeners - sensor:0 fan:7
[2/18/2019, 8:02:40 PM] [DysonPlatform] Number of listeners - sensor:0 fan:8
[2/18/2019, 10:29:59 PM] [DysonPlatform] Dyson Pure Set Fan Auto State according to target fan state: true
[2/18/2019, 10:29:59 PM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"AUTO"}
[2/18/2019, 10:29:59 PM] [DysonPlatform] Number of listeners - sensor:0 fan:9
[2/18/2019, 10:29:59 PM] [DysonPlatform] Dyson Pure - Set State:{"nmod":"ON"}
[2/18/2019, 10:29:59 PM] [DysonPlatform] Number of listeners - sensor:0 fan:10
[2/18/2019, 11:21:43 PM] [DysonPlatform] Dyson Pure - Set State:{"ffoc":"ON"}
[2/18/2019, 11:21:43 PM] [DysonPlatform] Number of listeners - sensor:0 fan:11
[2/18/2019, 11:21:43 PM] [DysonPlatform] Dyson Pure Set Fan Auto State according to target fan state: true
[2/18/2019, 11:21:43 PM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"AUTO"}
[2/18/2019, 11:21:43 PM] [DysonPlatform] Number of listeners - sensor:0 fan:12
[2/18/2019, 11:21:43 PM] [DysonPlatform] Dyson Pure - Set State:{"nmod":"ON"}
[2/18/2019, 11:21:43 PM] [DysonPlatform] Number of listeners - sensor:0 fan:13
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"hmax":2925}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Number of listeners - sensor:0 fan:14
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"FAN"}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Number of listeners - sensor:0 fan:15
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set target heater cooler state: 2
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"FAN"}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"hmod":"OFF"}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Number of listeners - sensor:0 fan:16
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure Set Fan Auto State according to target fan state: true
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"fmod":"AUTO"}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Number of listeners - sensor:0 fan:17
[2/19/2019, 10:00:00 AM] [DysonPlatform] Dyson Pure - Set State:{"nmod":"OFF"}
[2/19/2019, 10:00:00 AM] [DysonPlatform] Number of listeners - sensor:0 fan:18
(node:421) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 16 undefined listeners added. Use emitter.setMaxListeners() to increase limit
[2/19/2019, 5:20:05 PM] [DysonPlatform] Number of listeners - sensor:0 fan:19
[2/19/2019, 5:20:05 PM] [DysonPlatform] Number of listeners - sensor:0 fan:20
[2/19/2019, 5:20:05 PM] [DysonPlatform] Number of listeners - sensor:0 fan:21

Looks to me everything goes fine, until the fan value of the Number of listeners starts growing... At which points Homekit shows the fan elements as "updating" until I plug the fan off and on again.