nathankellenicki / node-poweredup

A Javascript module to interface with LEGO Powered Up components.
https://nathankellenicki.github.io/node-poweredup/
MIT License
483 stars 61 forks source link

Getting hub object if you know hub uuid #11

Closed mihazelnik closed 5 years ago

mihazelnik commented 5 years ago

Is it possible to get hub object if you know hub uuid?

So you do something like that, where you can get hubUuid from params for example?

hub = PUPHub(hubUuid);
hub.setLEDColor(1);
nathankellenicki commented 5 years ago

This should do what you want: https://github.com/nathankellenicki/node-poweredup#PoweredUP+getConnectedHubByUUID

mihazelnik commented 5 years ago

Ah nice, totally missed that one :/

mihazelnik commented 5 years ago

BTW awesome lib!

nathankellenicki commented 5 years ago

No problem, and thanks! :)

mihazelnik commented 5 years ago

@nathankellenicki I did use your package and created REST API on top of it https://github.com/MihaZelnik/PoweredUp-REST-API/ (this is just a quick prototype for now so I know that it is possible)

Idea would be to have raspberry pi as a server so I can communicate with hubs via http and create some kind of web dashboard where I will be able to control it and make scenarios

GianCann commented 5 years ago

Hi, @nathankellenicki can you add a new method called getConnectedHubByName, that use friendly name configured by setName, instead of UUID?