peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.18k stars 145 forks source link

Update to api v4 to support Sensors #185

Closed Roaders closed 3 years ago

Roaders commented 3 years ago

Hi

I am currently using your node to control my lights but am using another node to get inputs from sensors (such as dimmer switches). It looks like adding sensor support will require upgrading to v4 of the underlying api. I am working on this now and am struggling a bit. I work with Typescript and the untyped js is causing me some headaches. V4 comes with Typescript declaration files so it is going to be MUCH safer doing this upgrade using typescript. It will catch all interactions with the api that are incorrect and need to be updated.

Would you accept a PR that includes migration to typescript?

I'd rather do this a a PR and have you release it but if you don't want typescript (which I can understand if you don't usually work with TS) then I'll probably release the node myself under a different name - which isn't great but I want the new functionality!

peter-murray commented 3 years ago

I have already migrated a large portion of the code base to TypeScript, the model is now 100% extracted and is a standalone library; https://github.com/peter-murray/hue-bridge-model

I have been busy lately with work, but will be returning to this to complete the refactoring work on the API to move to TypeScript, I am about half way through this now...

The 5.x release will be TypeScript based and include the other outstanding changes that are present but not yet released, like the removal of axios and replacement with node-fetch.

peter-murray commented 3 years ago

I have released 5.0.0-beta.1 of the library to npm just now, it has been converted into a TypeScript library and was built off the typescript branch on this repo.

I have not completed the work entirely yet, but all the tests are passing and the changes in the APIs are minor, but yet to be documented. I will be turning on strict and flushing out any implicit any references in the coming days.