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

Return observed devices after established connection #3

Closed twehrmaker closed 6 years ago

twehrmaker commented 6 years ago

With this pull request the observed devices will be returned in addition to the credentials after establishing the connection. Please advice if there is another proposed way to retrieve a list of devices.

CliffS commented 6 years ago

@twehrmaker I'm not convinced that Accessory.devices will necessarily be fully populated by this stage. It depends whether observeDevices() will guarantee to wait until all the events have fired before resolving.

I need to do further testing and also to update the underlying libraries. So please don't think I'm ignoring your PR, it's simply that I don't have time for this project for the next week or so.

Thanks for your interest,

CliffS commented 6 years ago

@twehrmaker I have not implemented this your way for backward compatibility reason.

However, I think that a way to get an array of all the devices is valuable so have implemented:

tradfri.devices

to return an array. This is live in version 3.3.0.

Please let me know if this does not solve your issue and thank you for your contribution.