CliffS / ikea-tradfri

A library to access the IKEA Trådfri lighting system without needing to call a separate binary
GNU Lesser General Public License v3.0
12 stars 6 forks source link

Is node-tradfri-client something for you? #1

Closed AlCalzone closed 6 years ago

AlCalzone commented 6 years ago

Before you invest a lot of work here, I've done most of it already. I used my last 2 evenings extracting the tradfri-related code from my ioBroker adapter into a seperate library, which uses the existing node-coap-client stack: https://github.com/AlCalzone/node-tradfri-client

The documentation is still missing, but I hope a lot of it becomes clear by looking at the annotated TypeScript sources, especially tradfri-client.ts.

CliffS commented 6 years ago

Thanks. I'll take a look right now.

Edit: Having looked, I think I'm going to have to wait for at least some minimal documentation.

AlCalzone commented 6 years ago

I just added a bunch of documentation. Its not complete yet but could serve as a decent starting point.

CliffS commented 6 years ago

Been busy but finally got round to reading your (excellent) documentation. https://github.com/AlCalzone/node-tradfri-client looks amazing. I'll try using it this week. Thanks for all your hard work on it.

CliffS commented 6 years ago

Right. I think I'll scrap my original project and start again based on node-tradfri-client. It seems to work well, better than your original library even. My main issue is that the exposed classes are too complex which makes debugging hard. The fix could be a wrapper class for each Accessory that only exposes what is needed or possibly just a simpler way of extracting just the relevant data; possibly a toString() or toObj() function. What do you think?

Also, maybe you can throw some light on this: I can see lightbulbs updated consistently but I can't see remotes other than (sometimes) the first update. Is this a bug in the controller software? Ideally, I'd like to detach the remotes and the motionSensors from groups, watch them for changes and decide in user software what to do. Do you know if this is possible?

AlCalzone commented 6 years ago

the exposed classes are too complex

Currently I just expose a 1:1 translation of the original CoAP objects, but I'm open to suggestions. What are you trying to do with the objects? And in which way are they too complex?

The remotes and sensors are currently not exposed by the gateway other than "they exist". I believe the remotes get updated when a key is pressed but the sent objects contain no information about the action. IKEA considers CoAP as their internal communication interface and they said they provide no support for it. Maybe they can be convinced to include sensor information in the traffic aswell, but I don't have high hopes.

CliffS commented 6 years ago

@AlCalzone FWIW, I have now written a full interface for those parts of the interface that someone (me!) writing a home automation system would need. It relies totally on your node-tradfi-client library.

All I need now is the work finished on observeGroups and published and I can publish this library. In the meanwhile, I'll work on some documentation. :)

Thanks for all your hard work!

CliffS commented 6 years ago

Actually I've gone ahead and published this anyway. I'll fix it when your library is updated. Thanks.again.

AlCalzone commented 6 years ago

I just released v0.5.0, which contains the recent bugfixes and the changes from the observe PR.