Skip to content

Commit 80a6e44

Browse files
authored
Merge pull request #150 from peter-murray/4.x
4.x Release
2 parents a05b0c6 + dbf5254 commit 80a6e44

File tree

380 files changed

+17013
-14457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+17013
-14457
lines changed

.github/workflows/nodejs.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
name: Node CI
1+
name: Node Tests
22

33
on: [push]
44

55
jobs:
66
build:
7-
8-
runs-on: ubuntu-latest
7+
runs-on: ${{ matrix.os }}
98

109
strategy:
10+
max-parallel: 4
1111
matrix:
12+
os: [ubuntu-18.04, macos-latest, windows-latest]
1213
node-version: [10.x, 12.x]
1314

1415
steps:
1516
- uses: actions/checkout@v1
17+
1618
- name: Use Node.js ${{ matrix.node-version }}
1719
uses: actions/setup-node@v1
1820
with:
1921
node-version: ${{ matrix.node-version }}
22+
2023
- name: npm test
2124
run: |
2225
npm ci

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ node_modules
99
# Scratch Files
1010
scratch.js
1111

12-
.DS_Store
12+
.DS_Store
13+
14+
# TypeScript Definition Files
15+
*.d.ts

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!*.d.ts
2+
.idea

Changelog.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,142 @@
11
# Change Log
22

3+
## 4.0.0
4+
- Deprecated v2 API and shim and modules removed from library
5+
6+
- Introduced rate limiting in the Light and Group set States to be compliant with the Hue API documentation best practices.
7+
This only has an impact on this library, so it may be possible if you are running other software on your network
8+
accessing the Bridge, you will still able to overload it.
9+
* The whole API is currently limited to 12 requests per second by default (currently not configurable)
10+
* `lights.setLightState()` is limited to 10 requests per second
11+
* `groups.setState()` is limited to 1 request per second
12+
13+
- `v3.discovery.nupnp()` Now returns a different payload as it no longer accesses the XML Discovery endpoint to return
14+
the bridge data as this can become unreliable when the bridge is overloaded. See the [documentation](./docs/discovery.md#n-upnpsearch)
15+
for specifics.
16+
17+
- `v3.api` removed the `create` function as it was deprecated, use `createRemote()` fro the remote API, `createLocal()`
18+
for the local API or `createInsecureLocal()` for non-hue bridges that do not support https connections
19+
20+
- `v3.Scene` has been removed, use the following functions to create a new Scene instance:
21+
* `v3.model.createLightScene()`
22+
* `v3.model.createGroupScene()`
23+
24+
This change has also allowed for the separation of the attributes and getter/setters locked down properly based on
25+
the type of Scene, i.e. Cannot change the lights in a GroupScene (as they are controlled by the Group).
26+
27+
- `v3.sensors` has been removed, use `v3.model.createCLIPxxx()` functions instead
28+
29+
- `v3.rules` has been moved into `v3.model`
30+
* To create a `Rule` use `v3.model.createRule()`
31+
* To create a `RuleCondition` use `v3.model.ruleConditions.[group|sensor]`
32+
* To create a `RuleAction` use `v3.model.ruleActions.[light|group|sensor|scene]`
33+
34+
- `v3.model` added to support exposing the underlying model objects that represent bridge objects. This module will allow
35+
you to create all of the necessary objects, e.g. `createGroupScene()`
36+
37+
- Capabilities API:
38+
* `capabilities.getAll()` now returns a [`Capabilities` object](./docs/capabilities.md#capabilities-object)
39+
40+
- Groups API:
41+
* The following API functions will accept a Light Object as the `id` parameter as well as an integer value:
42+
* `groups.get(id)`
43+
* `groups.getGroup(id)`
44+
* `deleteGroup(id)`
45+
* `enableStreaming(id)`
46+
* `disableStreaming(id)`
47+
* `groups.createGroup(group)` introduced, it expects a pre-configured Group instance created using the model functions:
48+
* `model.createLightGroup()`
49+
* `model.createEntertainment()`
50+
* `model.createRoom()`
51+
* `model.createZone()`
52+
* `groups.get(id)` has been deprecated, use `groups.getGroup(id)` instead.
53+
* `groups.createGroup(name, lights)` has been deprecated, use `groups.createGroup(group)` instead.
54+
* `groups.createRoom(name, lights, roomClass)` has been deprecated, use `groups.createGroup(group)` instead.
55+
* `groups.createZone(name, lights, roomClass)` has been deprecated, use `groups.createGroup(group)` instead.
56+
* `groups.updateAttributes(id, data)` has been deprecated, Use `groups.updateGroupAttributes(group)` instead.
57+
58+
- Lights API:
59+
* `getLightById(id)` is deprecated use `getLight(id)` instead
60+
* `rename(id, name)` is deprecated, use `renameLight(light)` instead
61+
* The following API functions will accept a Light Object as the `id` parameter as well as an integer value:
62+
* `getLight(id)`
63+
* `getLightById(id)`
64+
* `getLightAttributesAndState(id)`
65+
* `getLightState(id)`
66+
* `setLightState(id, state)`
67+
* `deleteLight(id)`
68+
69+
- Scenes API:
70+
* `getScene(id)` introduced, can take a scene id or `Scene` instance as the id value
71+
* `get(id)` has been deprecated, use `getScene(id)` instead
72+
* `getByName(name)` has been depricated use `getSceneByName(name)` instead
73+
* `updateScene(scene)` introduced to replace `update(id, scene)` for updating Scenes
74+
* `update(id, scene)` has been deprecated, will be removed in `5.x`, use `updateScene(scene)` instead
75+
* `deleteScene(id)` can accept a scene id or a `Scene` object as the `id` parameter
76+
* `activateScene(id)` can accept a scene id value or a `Scene` object
77+
* `updateLightState(id, lightId, sceneLightState)` can take an id value or `Scene`/`Light` for the `id` and `lightId` values respectively
78+
79+
- Sensors API:
80+
* `get(id)` has been depreciated use `getSensor(id)` instead
81+
* `getSensor(id)` will accept a `Sensor` Object as the `id` or the integer `id` value as parameter.
82+
* `updateName(id, name)` has been deprecated, will be removed in `5.x`, use `reanmeSensor(sensor)` instead
83+
* `renameSensor(sensor)` has been added to allow updating of the name only for a sensor (makes API consistent with `lights` and `sensors`)
84+
* `getSensorByName(name)` added to get sensors by `name`
85+
86+
- Rules API:
87+
* The following API functions will accept a Rule Object as the `id` parameter as well as an integer value:
88+
* `get(id)`
89+
* `deleteRule(id)`
90+
* Added `getRuleByName(name)` function to get rules by `name`
91+
* Rule Actions were common to the new `Schedules`, so have been moved from `v3.model.ruleActions` to `v3.model.actions`.
92+
Use of `v3.model.ruleActions` is considered deprecated.
93+
94+
- Schedules API:
95+
* The schedules API is finally properly implemented, along with all the various Hue Bridge TimePatterns
96+
* `model.timePatterns` provides an interface with creating the various timePatterns, consult the [documentation](./docs/timePatterns.mc) for details
97+
98+
* The previous `schedules.update(id, schedule)` function has been removed and replaced with `schedules.update(schedule)`.
99+
100+
_I am fairly sure that the previous version was most likely never used (base on the implmenetation as it would
101+
have likely errored). With this knowledge, it was not deprecated and just removed. If you are impacted by this change, please raise an Issue._
102+
103+
- ResourceLinks API:
104+
* New API interacting with `ResourceLinks` via, `api.resourceLinks`, see [documentation](./docs/resourcelinks.md) for more details.
105+
106+
- Configuration API:
107+
* `get()` has been deprecated, use `getConfiguration()` instead
108+
* `update()` has bee depricated, use `updateConfiguration()` instead
109+
110+
- All creation function calls to the bridge will now return the created model object. This change makes it consistent as
111+
some calls would return the object, others would return the id but no other data.
112+
113+
This changes return object from the promise on the following calls:
114+
* `api.rules.createRule()`
115+
* `api.scenes.createScene()`
116+
* `api.sensors.createSensor()`
117+
118+
- Type system from the `LightState` definitions is now used in all Bridge Object Models to define the attributes/properties
119+
obtained from the Bridge.
120+
121+
This provides a consistent validation mechanism to all bridge related attributes data. As part of this being used in
122+
the models, some validation is performed at the time of setting a value instead of waiting on when sending it to the
123+
hue bridge (some things still have to wait be sent to the bridge) so the validation is closer to the point of call.
124+
125+
- Added ability to serialize a model object into JSON and then restore it to a corresponding object from the JSON
126+
payload. This was requested to aid in server/client side code situations, as the creation of the model objects are
127+
not directly exposed in the library by design. Related to issue #132
128+
129+
- Creating Sensors (CLIP variety) has changed as the classes for the sensor objects are no longer directly accessible.
130+
All `CLIPxxx` sensors need to be built from the `v3.model.createCLIP[xxx]Sensor()` function for the desired type,
131+
e.g. `v3.model.createCLIPGenericStatusSensor()` for a `CLIPGenericStatus` sensor.
132+
133+
The function call to instantiate the sensors also no longer take an object to set various attributes of the sensor,
134+
you need to call the approriate setter on the class now to set the attribute, e.g. `sensor.manufacturername = 'node-hue-api-sensor';`
135+
136+
- TypeScript definitions added to the library
137+
138+
- Adding more in-depth tests to further increase coverage around types and models, and adding more edge case API level tests
139+
3140
## 3.4.3
4141
- Long term fix for supporting older bridge types and creating new users. Issue #147
5142

0 commit comments

Comments
 (0)