ianmichell / homebridge-w215

Homebridge D-Link w215 plugin
Apache License 2.0
7 stars 4 forks source link

multiple devices in control, single result! #2

Closed thecalle closed 7 years ago

thecalle commented 7 years ago

RESULT of 4 devices, different IPs and password..

[2017-03-01 21:47:41] Homebridge is running on port 51826. Values { power: false, consumption: 0, totalConsumption: 0.094184, temperature: 38 } Values { power: false, consumption: 0, totalConsumption: 0.094184, temperature: 38 } Values { power: false, consumption: 0, totalConsumption: 0.094184, temperature: 38 } Values { power: false, consumption: 0, totalConsumption: 0.094184, temperature: 38 }

urbok commented 7 years ago

problem confirmed.

With one unit all seems working correct. Connecting more than one plug results in a clone reply of the first unit. here the output of firmware version and details of 1 plug.

Firmware External Version: V2.22 Firmware Internal Version: V2.22b05 Date: Wed, 3 Feb 2016 Checksum: 0x06CDB68D 2.4GHz regulation domain: EU 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 Firmware Query: http://wrpd.dlink.com/router/firmware/query.aspx?model=DSP-W215_Bx_Default_FW_0222_54B80A7C2194 LAN MAC: XXXXXXXXXX Kernel: 2.6.31, B0015, Date=Tue, 1 Dec, 2015 Apps: 1.1, B0141, Date=Wed, 03 Feb, 2016 WLAN Driver: AR9531, 10.2-00082-4, B0012, Date=Fri, 15 Jan, 2016 2.4GHz WLAN MAC 0: XXXXXXXXXXXX 2.4GHz SSID: DSP-2194 Factory Default: 0 DCH_ID: 2c3e4d86028e90365d331522fe772e1c

and here the config.json used for tests:


{
    "bridge": {
        "name": "RaspNik",
        "username": "XX:XX:XX:XX:XX:XX",
        "port": 51826,
        "pin": "XXX-XX-XXX"
    },

    "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creati$

    "accessories": [
        {
        "accessory": "w215",
        "name": "Boiler",
        "host": "boiler_ip",
        "username": "admin",
        "password": "XXXXXX"
        },
        {
        "accessory": "w215",
        "name": "Giorno",
        "host": "giorno_ip",
        "username": "admin",
        "password": "XXXXXX"
        },
        {
        "accessory": "w215",
        "name": "Notte",
        "host": "notte_ip",
        "username": "admin",
        "password": "XXXXXX"
        },
        {
        "accessory": "w215",
        "name": "Studio",
        "host": "studio_ip",
        "username": "admin",
        "password": "XXXXXX"
        }
    ]

}
ianmichell commented 7 years ago

Sorry I've been really slow with this. I will spin up the other socket I have laying around and see if I can figure out the issue.

rittet commented 7 years ago

Seeing this too, in my case it's the last w215 that id duplicated. If I use Apple home app to toggle the switches, only the last one on config.json gets toggled. My config.json looks like urbook's

ianmichell commented 7 years ago

Strange. OK Shouldn't be a problem to fix.

pumamood commented 7 years ago

Same issue for me with two plug only last one is targeted

ianmichell commented 7 years ago

OK so I have managed to find my other plug, so will look into it.

ianmichell commented 7 years ago

Issue found. dsp-w215-hnap is a singleton (one instance), so was looking in the wrong place, so will require a bit of modification and a pull request back to bikerp

pumamood commented 7 years ago

you could use this https://github.com/sindresorhus/require-uncached fixed like that in my setup

index.zip

turbidWaters commented 7 years ago

First, thank you @thunderbird for this plugin. I am new to homebridge and npm. A novice in fact. And this is my first ever post on it. So, I request you to bear with me if I have made a noob mistake. Thanks.

I have setup homebridge on a pi2 and everything is working well. Just that I am unable to use more than 1 w-215 plug, as mentioned by the others here. @pumamood, you've mentioned that you fixed this in your setup and have included a file in your post. May I request you for some help in having that installed in my setup? What do I do with that file you've attached to resolve multiple plugs- single result issue?

Thank you!

turbidWaters commented 7 years ago

here is my config:

{ "accessory": "w215", "name": "HEATER", "host": "172.20.1.115", "username": "admin", "password": "XXXXXX" }, { "accessory": "w215", "name": "BEDROOM AIRCON", "host": "172.20.1.116", "username": "admin", "password": "XXXXXX" }, { "accessory": "w215", "name": "BEDROOM GEYSER", "host": "172.20.1.117", "username": "admin", "password": "XXXXXX" }

I only get results for the last entry (i.e.) BEDROOM GEYSER

pumamood commented 7 years ago

Basically you should replace index.js inside homebridge-w215 folder and install in the same folder (or globally) require-uncached with npm. $ npm install -g require-uncached let me kno if you need more help

turbidWaters commented 7 years ago

Thank you for the reply, @pumamood. Appreciate it much. Unfortunately for me, I don't know how to do what you've said. I am simply following the fine grained instructions to install stuff on the pi by all the enthusiasts here. Ill try and read up on installing from local folders and then come back to you. I am sure I will still need help after that too.

turbidWaters commented 7 years ago

Hi pumamood, i copied index.js to the w215 directory and installed it globally from there.

I am getting the following error in the journal log:

Jul 01 13:25:07 pi homebridge[32674]: /usr/lib/node_modules/homebridge/lib/api.js:64 Jul 01 13:25:07 pi homebridge[32674]: throw new Error("The requested accessory '" + name + "' was not registered by any plugin."); Jul 01 13:25:07 pi homebridge[32674]: ^ Jul 01 13:25:07 pi homebridge[32674]: Error: The requested accessory 'w215' was not registered by any plugin. Jul 01 13:25:07 pi homebridge[32674]: at API.accessory (/usr/lib/node_modules/homebridge/lib/api.js:64:13) Jul 01 13:25:07 pi homebridge[32674]: at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:254:42) Jul 01 13:25:07 pi homebridge[32674]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:81:38) Jul 01 13:25:07 pi homebridge[32674]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) Jul 01 13:25:07 pi homebridge[32674]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) Jul 01 13:25:07 pi homebridge[32674]: at Module._compile (module.js:569:30) Jul 01 13:25:07 pi homebridge[32674]: at Object.Module._extensions..js (module.js:580:10) Jul 01 13:25:07 pi homebridge[32674]: at Module.load (module.js:503:32) Jul 01 13:25:07 pi homebridge[32674]: at tryModuleLoad (module.js:466:12) Jul 01 13:25:07 pi homebridge[32674]: at Function.Module._load (module.js:458:3) Jul 01 13:25:07 pi homebridge[32674]: at Function.Module.runMain (module.js:605:10) Jul 01 13:25:07 pi homebridge[32674]: at startup (bootstrap_node.js:158:16) Jul 01 13:25:07 pi homebridge[32674]: at bootstrap_node.js:575:3 Jul 01 13:25:07 pi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Jul 01 13:25:07 pi systemd[1]: Unit homebridge.service entered failed state.

Is there something I must replace in the index.js? Need help!! Thanks!!

Also, the following is happening when i try to cd :

pi@pi:/usr/lib/node_modules $ cd homebridge-w215 -bash: cd: homebridge-w215: Too many levels of symbolic links pi@pi:/usr/lib/node_modules $

Sorry!! but did I just do something bad!!

turbidWaters commented 7 years ago

I have reverted back all the changes. Need help with setting up multiple w215s. Appreciate all the help I can get. Thanks.

TimCombridge commented 7 years ago

I am in the same boat as @chietanjain here - I received my Raspberry Pi two days ago and this is my first project. I'm not a programmer but have a little bit of experience in reading/understanding code. I'm a little unsure of the structure of how this is working. Is my Raspberry Pi referencing the code that is online? I cannot see the folder inside of it in FileZilla... otherwise, from my understanding, it is as simple as replacing the index.js file and it should run fine.

Any assistance or advice would be massively appreciated. Thanks!

turbidWaters commented 7 years ago

OK! I got it working! All I had to do was the following:

Download the tar.gz file from @thunderbird 's repository

Download the index.js file from the link pumamood provided

replace the index.js in the tar.gz file (homebridge-w215-0.0.2.tar.gz) (I used 7zip and gvim editor to manually open the existing index.js file and pasted the contents of the new index.js file and saved it back to the tar.gz file).

copy the new homebridge-w215-0.0.2.tar.gz to any location on the pi. (in my case /var/homebridge) and run the following commands

sudo npm install -g require-uncached

sudo npm install -g /var/homebridge/homebridge-w215-0.0.2.tar.gz

and voila! it works!

Thank you @thunderbird and thank you @pumamood

@TimCombridge , hope this is useful for you!

TimCombridge commented 7 years ago

Hey, well done @chietanjain !

Just one question - did you start from scratch, or uninstall the original homebridge-w215 package? And did you install it to root?

I'll give that a whirl tonight if that's the case!

turbidWaters commented 7 years ago

Nope. Just what I wrote. All the best TimCombridge.

On 16-Jul-2017, at 3:50 PM, TimCombridge notifications@github.com wrote:

Hey, well done @chietanjain !

Just one question - did you start from scratch, or uninstall the original homebridge-w215 package? And did you install it to root?

I'll give that a whirl tonight if that's the case!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

pumamood commented 7 years ago

Good! I'm happy if you finally managed it!

jurgverhoeven commented 7 years ago

Hey, I have the same problem here. How do I download the tar.gz file from @thunderbird 's repository? And how to download the index.js form the link? Maybe this sounds very stupid, but I'm new to this all...

turbidWaters commented 7 years ago

from here:

https://github.com/thunderbird/homebridge-w215/releases

turbidWaters commented 7 years ago

thank you @thunderbird and thank you @pumamood !!

ianmichell commented 7 years ago

New release made - 0.0.3. Closing.

Let me know if there are any other issues, feel free to send me a pull request. I've not had much time the last couple months.