@hurenkam/hue-services 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js.yml +31 -0
- package/.nyc_output/ecb1b16f-015c-458b-96d5-32cb9569c1e8.json +1 -0
- package/.nyc_output/processinfo/ecb1b16f-015c-458b-96d5-32cb9569c1e8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.vscode/settings.json +15 -0
- package/.vscode/sftp.json +11 -0
- package/LICENSE +201 -0
- package/README.md +340 -0
- package/Todo.txt +18 -0
- package/coverage/BaseNode.js.html +379 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +101 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/RestApi.js.html +499 -0
- package/coverage/lcov-report/src/all.js.html +208 -0
- package/coverage/lcov-report/src/clip/ClipApi.js.html +1096 -0
- package/coverage/lcov-report/src/clip/Resource.js.html +481 -0
- package/coverage/lcov-report/src/clip/index.html +131 -0
- package/coverage/lcov-report/src/debug.js.html +253 -0
- package/coverage/lcov-report/src/files.js.html +118 -0
- package/coverage/lcov-report/src/index.html +161 -0
- package/coverage/lcov-report/src/nodes/BaseNode.js.html +381 -0
- package/coverage/lcov-report/src/nodes/BridgeConfigNode.js.html +817 -0
- package/coverage/lcov-report/src/nodes/ButtonNode.js.html +241 -0
- package/coverage/lcov-report/src/nodes/DevicePowerNode.js.html +199 -0
- package/coverage/lcov-report/src/nodes/GroupedLightNode.js.html +226 -0
- package/coverage/lcov-report/src/nodes/LightLevelNode.js.html +205 -0
- package/coverage/lcov-report/src/nodes/LightNode.js.html +226 -0
- package/coverage/lcov-report/src/nodes/MotionNode.js.html +205 -0
- package/coverage/lcov-report/src/nodes/RelativeRotaryNode.js.html +253 -0
- package/coverage/lcov-report/src/nodes/ResourceNode.js.html +388 -0
- package/coverage/lcov-report/src/nodes/SceneNode.js.html +124 -0
- package/coverage/lcov-report/src/nodes/ServiceNode.js.html +124 -0
- package/coverage/lcov-report/src/nodes/TemperatureNode.js.html +205 -0
- package/coverage/lcov-report/src/nodes/ZigbeeConnectivityNode.js.html +199 -0
- package/coverage/lcov-report/src/nodes/index.html +311 -0
- package/coverage/lcov-report/src/ui/BaseUI.js.html +484 -0
- package/coverage/lcov-report/src/ui/BridgeConfigUI.js.html +475 -0
- package/coverage/lcov-report/src/ui/ButtonUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/DevicePowerUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/GroupedLightUI.js.html +178 -0
- package/coverage/lcov-report/src/ui/LightLevelUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/LightUI.js.html +178 -0
- package/coverage/lcov-report/src/ui/MotionUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/RelativeRotaryUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/ResourceUI.js.html +511 -0
- package/coverage/lcov-report/src/ui/SceneUI.js.html +160 -0
- package/coverage/lcov-report/src/ui/ServiceUI.js.html +868 -0
- package/coverage/lcov-report/src/ui/TemperatureUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/ZigbeeConnectivityUI.js.html +166 -0
- package/coverage/lcov-report/src/ui/index.html +311 -0
- package/coverage/lcov.info +2217 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/RestApi.js.html +499 -0
- package/coverage/src/all.js.html +208 -0
- package/coverage/src/clip/ClipApi.js.html +1183 -0
- package/coverage/src/clip/Resource.js.html +481 -0
- package/coverage/src/clip/index.html +131 -0
- package/coverage/src/debug.js.html +253 -0
- package/coverage/src/files.js.html +118 -0
- package/coverage/src/index.html +116 -0
- package/coverage/src/nodes/BaseNode.js.html +379 -0
- package/coverage/src/nodes/BridgeConfigNode.js.html +517 -0
- package/coverage/src/nodes/ButtonNode.js.html +238 -0
- package/coverage/src/nodes/DevicePowerNode.js.html +196 -0
- package/coverage/src/nodes/GroupedLightNode.js.html +223 -0
- package/coverage/src/nodes/LightLevelNode.js.html +202 -0
- package/coverage/src/nodes/LightNode.js.html +223 -0
- package/coverage/src/nodes/MotionNode.js.html +202 -0
- package/coverage/src/nodes/RelativeRotaryNode.js.html +250 -0
- package/coverage/src/nodes/ResourceNode.js.html +373 -0
- package/coverage/src/nodes/SceneNode.js.html +124 -0
- package/coverage/src/nodes/ServiceNode.js.html +124 -0
- package/coverage/src/nodes/TemperatureNode.js.html +202 -0
- package/coverage/src/nodes/ZigbeeConnectivityNode.js.html +199 -0
- package/coverage/src/nodes/index.html +311 -0
- package/coverage/src/ui/BaseUI.js.html +484 -0
- package/coverage/src/ui/BridgeConfigUI.js.html +475 -0
- package/coverage/src/ui/ButtonUI.js.html +166 -0
- package/coverage/src/ui/DevicePowerUI.js.html +166 -0
- package/coverage/src/ui/GroupedLightUI.js.html +178 -0
- package/coverage/src/ui/LightLevelUI.js.html +166 -0
- package/coverage/src/ui/LightUI.js.html +178 -0
- package/coverage/src/ui/MotionUI.js.html +166 -0
- package/coverage/src/ui/RelativeRotaryUI.js.html +166 -0
- package/coverage/src/ui/ResourceUI.js.html +511 -0
- package/coverage/src/ui/SceneUI.js.html +160 -0
- package/coverage/src/ui/ServiceUI.js.html +868 -0
- package/coverage/src/ui/TemperatureUI.js.html +166 -0
- package/coverage/src/ui/ZigbeeConnectivityUI.js.html +166 -0
- package/coverage/src/ui/index.html +311 -0
- package/examples/flows.json +959 -0
- package/package.json +53 -0
- package/screenshots/Screenshot from 2022-11-29 00-29-23.png +0 -0
- package/screenshots/Screenshot from 2022-11-29 00-30-16.png +0 -0
- package/screenshots/Screenshot from 2022-11-29 00-30-58.png +0 -0
- package/screenshots/Screenshot from 2022-11-29 00-31-29.png +0 -0
- package/src/RestApi.js +138 -0
- package/src/all.html +52 -0
- package/src/all.js +42 -0
- package/src/clip/ClipApi.js +367 -0
- package/src/clip/Resource.js +132 -0
- package/src/debug.js +56 -0
- package/src/files.js +12 -0
- package/src/hue.js +98 -0
- package/src/nodes/BaseNode.js +98 -0
- package/src/nodes/BridgeConfigNode.js +144 -0
- package/src/nodes/ButtonNode.js +51 -0
- package/src/nodes/DevicePowerNode.js +37 -0
- package/src/nodes/GroupedLightNode.js +46 -0
- package/src/nodes/LightLevelNode.js +39 -0
- package/src/nodes/LightNode.js +46 -0
- package/src/nodes/MotionNode.js +39 -0
- package/src/nodes/RelativeRotaryNode.js +55 -0
- package/src/nodes/ResourceNode.js +95 -0
- package/src/nodes/SceneNode.js +13 -0
- package/src/nodes/ServiceNode.js +13 -0
- package/src/nodes/TemperatureNode.js +39 -0
- package/src/nodes/ZigbeeConnectivityNode.js +38 -0
- package/src/ui/BaseUI.js +133 -0
- package/src/ui/BridgeConfigUI.js +130 -0
- package/src/ui/ButtonUI.js +27 -0
- package/src/ui/DevicePowerUI.js +27 -0
- package/src/ui/GroupedLightUI.js +31 -0
- package/src/ui/LightLevelUI.js +27 -0
- package/src/ui/LightUI.js +31 -0
- package/src/ui/MotionUI.js +27 -0
- package/src/ui/RelativeRotaryUI.js +27 -0
- package/src/ui/ResourceUI.js +142 -0
- package/src/ui/SceneUI.js +25 -0
- package/src/ui/ServiceUI.js +261 -0
- package/src/ui/TemperatureUI.js +27 -0
- package/src/ui/ZigbeeConnectivityUI.js +27 -0
- package/test/BaseNode_spec.js +246 -0
- package/test/BaseUI_spec.js +17 -0
- package/test/BridgeConfigNode_spec.js +184 -0
- package/test/ButtonNode_spec.js +178 -0
- package/test/ClipApi_spec.js +769 -0
- package/test/DevicePowerNode_spec.js +186 -0
- package/test/GroupedLightNode_spec.js +218 -0
- package/test/LightLevelNode_spec.js +154 -0
- package/test/LightNode_spec.js +218 -0
- package/test/MotionNode_spec.js +186 -0
- package/test/RelativeRotataryNode_spec.js +325 -0
- package/test/ResourceNode_spec.js +308 -0
- package/test/Resource_spec.js +392 -0
- package/test/SceneNode_spec.js +33 -0
- package/test/ServiceNode_spec.js +33 -0
- package/test/TemperatureNode_spec.js +153 -0
- package/test/ZigbeeConnectivityNode_spec.js +186 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
+
|
|
4
|
+
name: Node.js CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [ "maturing-v0.5" ]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [ "maturing-v0.5" ]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
node-version: [14.x, 16.x, 18.x]
|
|
20
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
+
uses: actions/setup-node@v3
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
- run: npm ci
|
|
30
|
+
- run: npm run build --if-present
|
|
31
|
+
- run: npm test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":1610421,"argv":["/usr/bin/node","/home/hurenkam/Workspace/node-red-contrib-mh-hue/node_modules/.bin/mocha","test/**/BaseUI_spec.js"],"execArgv":[],"cwd":"/home/hurenkam/Workspace/node-red-contrib-mh-hue","time":1670929477202,"ppid":1610410,"coverageFilename":"/home/hurenkam/Workspace/node-red-contrib-mh-hue/.nyc_output/ecb1b16f-015c-458b-96d5-32cb9569c1e8.json","externalId":"","uuid":"ecb1b16f-015c-458b-96d5-32cb9569c1e8","files":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"processes":{"ecb1b16f-015c-458b-96d5-32cb9569c1e8":{"parent":null,"children":[]}},"files":{},"externalIds":{}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mocha.files.glob": "test/**/*_spec.js",
|
|
3
|
+
"mocha.coverage": {
|
|
4
|
+
"enable": true,
|
|
5
|
+
"decoration": true,
|
|
6
|
+
"runWithInterval": false,
|
|
7
|
+
"autoUpdateInterval": 20000,
|
|
8
|
+
"activeOnStart": true,
|
|
9
|
+
"runAfterTest": false,
|
|
10
|
+
"runCoverageAfterFileSave": false,
|
|
11
|
+
"reporters": []
|
|
12
|
+
},
|
|
13
|
+
"terminal.integrated.defaultLocation": "editor",
|
|
14
|
+
"mochaExplorer.files": "test/**/*_spec.js"
|
|
15
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# node-red-hue-services
|
|
2
|
+
node-red palette to access hue bridge through clip v2 api
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Status
|
|
8
|
+
|
|
9
|
+
(Last update: 2022/12/16)
|
|
10
|
+
This is not complete, but seems to work consistent and reliable for the services I regularly use.
|
|
11
|
+
(motion/temperature/light_level/light/grouped_light/button/relative_rotary/scene).
|
|
12
|
+
|
|
13
|
+
Unit tests are in place for the server side nodes.
|
|
14
|
+
|
|
15
|
+
Editor/UI functionality is currently not being tested apart from my own use in the editor, so your mileage may vary.
|
|
16
|
+
|
|
17
|
+
# Changelog
|
|
18
|
+
|
|
19
|
+
v0.6.0: Warning! This will break existing flows because the type names have been modified to use the @hurenkam/hue-services/ prefix.
|
|
20
|
+
This should address issue #1.
|
|
21
|
+
|
|
22
|
+
## Devices / Behaviors:
|
|
23
|
+
- Removed for now, services should cover all the basics, devices & behaviors will be re-introduced in a later release
|
|
24
|
+
|
|
25
|
+
## Services:
|
|
26
|
+
- Generic Service, in case you need some service that is not supported below, you can use this.
|
|
27
|
+
- Button
|
|
28
|
+
- Device Power
|
|
29
|
+
- Grouped Light
|
|
30
|
+
- Light
|
|
31
|
+
- Light Level
|
|
32
|
+
- Motion
|
|
33
|
+
- Relative Rotary
|
|
34
|
+
- Scene
|
|
35
|
+
- Temperature
|
|
36
|
+
- Zigbee Connectivity
|
|
37
|
+
|
|
38
|
+
## Todo
|
|
39
|
+
- ~~Bridge discovery and automatic key generation has not yet been implemented. Currently the~~
|
|
40
|
+
~~bridge needs to be configured manually with an ip address and known key.~~
|
|
41
|
+
- ~~Provide better low level support for simple resources as 'grouped_light' or 'light'.~~
|
|
42
|
+
- ~~Provide a generic sevice node (to allow using as of yet unsupported services)~~
|
|
43
|
+
- ~~Use scope, this is probably required if i want to upload this as a package.~~
|
|
44
|
+
- ~~Fix packaging, now I'm using a symlink to point to my *UI.js files, this needs a proper solution.~~
|
|
45
|
+
- ~~Upload package to node-red library~~
|
|
46
|
+
- ~~Unit Tests for Clip~~
|
|
47
|
+
- ~~Unit Tests for Nodes~~
|
|
48
|
+
- Unit Tests for UI
|
|
49
|
+
|
|
50
|
+
## Postponed until after 0.5.x release
|
|
51
|
+
- Improve 'smart' modes for Switch and Motion devices
|
|
52
|
+
- Improve the generic device node (which allows using as of yet unsupported devices)
|
|
53
|
+
- Support more devices
|
|
54
|
+
- smart button (should be easy to do, but i don't have one to test)
|
|
55
|
+
- tap dial switch (should be similar to a lutron aurora, but i don't have one to test)
|
|
56
|
+
|
|
57
|
+
# Use
|
|
58
|
+
Using these nodes requires a bit of knowledge on the clip v2 api, as i designed this palette
|
|
59
|
+
to offer an easy low level interface towards clip.
|
|
60
|
+
|
|
61
|
+
The basic principle of the nodes is that you select the proper id on the bridge, then clip events
|
|
62
|
+
associated with that resource id will come out as `msg.payload`, and whatever `msg.payload` is piped in
|
|
63
|
+
at the input will be sent as a put request to the clip v2 interface.
|
|
64
|
+
(See here: https://developers.meethue.com/develop/hue-api-v2 )
|
|
65
|
+
|
|
66
|
+
The following command will for instance switch a light, room or zone on:
|
|
67
|
+
|
|
68
|
+
`{ "rtypes": ["light", "grouped_light"], "payload": { "on": { "on": true } } }`
|
|
69
|
+
|
|
70
|
+
And the following command wil set the brightness to 50%:
|
|
71
|
+
|
|
72
|
+
`{ "rtypes": ["light", "grouped_light"], "payload": { "dimming": { "brightness": 50 } } }`
|
|
73
|
+
|
|
74
|
+
Do note that to address a node, you must either provide an msg.rids array that contains the rid
|
|
75
|
+
of the resource you wish to address, or an msg.rtypes array that contains the rtype of the resource
|
|
76
|
+
you wish to address.
|
|
77
|
+
|
|
78
|
+
# Design
|
|
79
|
+
|
|
80
|
+
## Incoming Event
|
|
81
|
+
```mermaid
|
|
82
|
+
sequenceDiagram
|
|
83
|
+
actor Bridge
|
|
84
|
+
Bridge ->> ClipApi: message
|
|
85
|
+
ClipApi ->> Resource: onEvent
|
|
86
|
+
Resource ->> ResourceNode: update(event)
|
|
87
|
+
ResourceNode ->> Output: msg.payload = event
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Outgoing Message
|
|
91
|
+
```mermaid
|
|
92
|
+
sequenceDiagram
|
|
93
|
+
actor Bridge
|
|
94
|
+
Input ->> ResourceNode: msg.payload, msg.rtypes | msg.rids
|
|
95
|
+
ResourceNode ->> Resource: put msg.payload
|
|
96
|
+
Resource ->> ClipApi: put rid, data
|
|
97
|
+
ClipApi ->> RestApi: put /clip/v2/rid data
|
|
98
|
+
RestApi ->> Bridge: put
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Class Diagram
|
|
102
|
+
```mermaid
|
|
103
|
+
classDiagram
|
|
104
|
+
|
|
105
|
+
class BaseNode {
|
|
106
|
+
+config
|
|
107
|
+
#onInput
|
|
108
|
+
#onClose
|
|
109
|
+
|
|
110
|
+
+constructor(config)
|
|
111
|
+
+logid()
|
|
112
|
+
+getStatusFill()
|
|
113
|
+
+getStatusText()
|
|
114
|
+
+getStatusShape()
|
|
115
|
+
+updateStatus()
|
|
116
|
+
+onInput(msg)
|
|
117
|
+
+destructor()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
class ResourceNode {
|
|
121
|
+
#onUpdate
|
|
122
|
+
#resource
|
|
123
|
+
|
|
124
|
+
+constructor(config)
|
|
125
|
+
+start(resource)
|
|
126
|
+
+resource()
|
|
127
|
+
+rid()
|
|
128
|
+
+bridge()
|
|
129
|
+
+onUpdate(event)
|
|
130
|
+
+onInput(msg)
|
|
131
|
+
+destructor()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
class ServiceNode {
|
|
135
|
+
+constructor(config)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
class BridgeConfigNode {
|
|
139
|
+
#onClose
|
|
140
|
+
#onClipError
|
|
141
|
+
#clip
|
|
142
|
+
|
|
143
|
+
+constructor(config)
|
|
144
|
+
#initClip()
|
|
145
|
+
#uninitClip()
|
|
146
|
+
+onClipError(error)
|
|
147
|
+
+clip()
|
|
148
|
+
+requestStartup(resource)
|
|
149
|
+
+destructor()
|
|
150
|
+
|
|
151
|
+
+DiscoverBridges()$
|
|
152
|
+
+AcquireApplicationKey(ip)$
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
class ClipApi {
|
|
156
|
+
#restApi
|
|
157
|
+
#resources
|
|
158
|
+
#startQ
|
|
159
|
+
#isStarted
|
|
160
|
+
#name
|
|
161
|
+
#ip
|
|
162
|
+
#key
|
|
163
|
+
|
|
164
|
+
+constructor()
|
|
165
|
+
+requestStartup(resource)
|
|
166
|
+
+getResource(rid)
|
|
167
|
+
+get(rtype,rid)
|
|
168
|
+
+put(rtype,rid,data)
|
|
169
|
+
+post(rtype,rid,data)
|
|
170
|
+
+delete(rtype,rid)
|
|
171
|
+
#isResourceRegistered(rid)
|
|
172
|
+
#registerResource(resource)
|
|
173
|
+
#unregisterResource(resource)
|
|
174
|
+
+getSortedServicesById(rid)
|
|
175
|
+
+getSortedResourcesByTypeAndModel(type,models)
|
|
176
|
+
+getSortedResourceOptions(type,models)
|
|
177
|
+
+getSortedTypeOptions()
|
|
178
|
+
+getSortedOwnerOptions()
|
|
179
|
+
+getSortedServiceOptions()
|
|
180
|
+
+destructor()
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class RestApi {
|
|
184
|
+
#ip
|
|
185
|
+
#headers
|
|
186
|
+
#requestQ
|
|
187
|
+
#timeout
|
|
188
|
+
#limiter
|
|
189
|
+
|
|
190
|
+
+constructor(name,ip,throttle,headers)
|
|
191
|
+
#request(url,method,data)
|
|
192
|
+
#handleRequest()
|
|
193
|
+
+get(url)
|
|
194
|
+
+put(url,data)
|
|
195
|
+
+post(url,data)
|
|
196
|
+
+delete(url)
|
|
197
|
+
+destructor()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
class Resource {
|
|
201
|
+
#clip
|
|
202
|
+
#item
|
|
203
|
+
|
|
204
|
+
+constructor(item,clip)
|
|
205
|
+
+clip()
|
|
206
|
+
+item()
|
|
207
|
+
+id()
|
|
208
|
+
+rid()
|
|
209
|
+
+rtype()
|
|
210
|
+
+owner()
|
|
211
|
+
+name()
|
|
212
|
+
+typeName()
|
|
213
|
+
+services()
|
|
214
|
+
+get()
|
|
215
|
+
+put(data)
|
|
216
|
+
+onEvent(event)
|
|
217
|
+
+updateStatus(event)
|
|
218
|
+
+destructor()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
class ButtonNode {
|
|
222
|
+
+constructor(config)
|
|
223
|
+
+onUpdate(event)
|
|
224
|
+
+updateStatus()
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
class DevicePowerNode {
|
|
228
|
+
+constructor(config)
|
|
229
|
+
+onUpdate(event)
|
|
230
|
+
+updateStatus()
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
class GroupedLightNode {
|
|
234
|
+
+constructor(config)
|
|
235
|
+
+onUpdate(event)
|
|
236
|
+
+updateStatus()
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
class LightLevelNode {
|
|
240
|
+
+constructor(config)
|
|
241
|
+
+onUpdate(event)
|
|
242
|
+
+updateStatus()
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
class LightNode {
|
|
246
|
+
+constructor(config)
|
|
247
|
+
+onUpdate(event)
|
|
248
|
+
+updateStatus()
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
class MotionNode {
|
|
252
|
+
+constructor(config)
|
|
253
|
+
+onUpdate(event)
|
|
254
|
+
+updateStatus()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
class RelativeRotaryNode {
|
|
258
|
+
+constructor(config)
|
|
259
|
+
+onUpdate(event)
|
|
260
|
+
+updateStatus()
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
class SceneNode {
|
|
264
|
+
+constructor(config)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class TemperatureNode {
|
|
268
|
+
+constructor(config)
|
|
269
|
+
+onUpdate(event)
|
|
270
|
+
+updateStatus()
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
class ZigbeeConnectivityNode {
|
|
274
|
+
+constructor(config)
|
|
275
|
+
+onUpdate(event)
|
|
276
|
+
+updateStatus()
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
direction LR
|
|
280
|
+
BaseNode <|-- BridgeConfigNode
|
|
281
|
+
BaseNode <|-- ResourceNode
|
|
282
|
+
ResourceNode ..> BridgeConfigNode
|
|
283
|
+
ResourceNode --> Resource
|
|
284
|
+
ResourceNode <|-- ServiceNode
|
|
285
|
+
ResourceNode <|-- ButtonNode
|
|
286
|
+
ResourceNode <|-- DevicePowerNode
|
|
287
|
+
ResourceNode <|-- GroupedLightNode
|
|
288
|
+
ResourceNode <|-- LightLevelNode
|
|
289
|
+
ResourceNode <|-- LightNode
|
|
290
|
+
ResourceNode <|-- MotionNode
|
|
291
|
+
ResourceNode <|-- RelativeRotaryNode
|
|
292
|
+
ResourceNode <|-- SceneNode
|
|
293
|
+
ResourceNode <|-- TemperatureNode
|
|
294
|
+
ResourceNode <|-- ZigbeeConnectivityNode
|
|
295
|
+
|
|
296
|
+
BridgeConfigNode --> ClipApi
|
|
297
|
+
ClipApi --> RestApi
|
|
298
|
+
ClipApi *-- Resource
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
# Debug
|
|
303
|
+
(see src/debug.js)
|
|
304
|
+
The server side classes are instrumented with logging using the debug module, this can be changed
|
|
305
|
+
runtime by sending appropriate GET / POST / DELETE requests to the node-red /debug endpoint
|
|
306
|
+
(default: http://localhost:1880/debug):
|
|
307
|
+
|
|
308
|
+
Use the following command to retrieve the current settings:
|
|
309
|
+
|
|
310
|
+
`curl -i -H "Accept: application/json" 'localhost:1880/debug'`
|
|
311
|
+
|
|
312
|
+
Use the following command to enable error and warning logging:
|
|
313
|
+
|
|
314
|
+
`curl -i -H "Accept: application/json" 'localhost:1880/debug' -d "namespaces='error:*,warn:*"`
|
|
315
|
+
|
|
316
|
+
Use the following command to disable debug logging:
|
|
317
|
+
|
|
318
|
+
`curl -i -H "Accept: application/json" 'localhost:1880/debug' -X "DELETE"`
|
|
319
|
+
|
|
320
|
+
Classes have 4 loglevels:
|
|
321
|
+
- error
|
|
322
|
+
- warn
|
|
323
|
+
- info
|
|
324
|
+
- debug
|
|
325
|
+
|
|
326
|
+
Log messages are typically built like this: `<loglevel>:<class>:<name or id> <logmessage>`, where
|
|
327
|
+
currently the following classes exist (see the code). Each level of each class can be enabled
|
|
328
|
+
or disabled seperately, and even per instance.
|
|
329
|
+
|
|
330
|
+
If running locally, you can set the DEBUG environment variable to enable debuggin:
|
|
331
|
+
`DEBUG="error:*,warn:*,info:*,trace:*" node-red`
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
# Credits
|
|
335
|
+
Credit where credit is due, this was inspired by the node-red-contrib-huemagic project, which stopped working for me at some point.
|
|
336
|
+
That is when i decided to go and dive into this, and create my own wrapper around the hue clip v2 api.
|
|
337
|
+
|
|
338
|
+
I initially licensed this code under GPLv2, but have changed that to Apache v2 because both node-red as well asl the huemagic extension
|
|
339
|
+
use that license, and i want this to be compatible so that in case it might be considered useful by either project, they can easily include it.
|
|
340
|
+
Since Apache v2 is less restrictive than GPLv2, it imposes no limits w.r.t. the original license, the code can still be re-distributed under GPLv2.
|
package/Todo.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
* Split GenericDeviceNode from DeviceNode
|
|
3
|
+
* DeviceNode to function as basis for real devices, offering a 'smart' mode for defined devices.
|
|
4
|
+
* GenericDeviceNode to offer 'raw' mode only, allowing for more control, and a generic way to deal
|
|
5
|
+
with currently unsupported devices.
|
|
6
|
+
|
|
7
|
+
* Refactor ServiceUI / ResourceUI; remove duplicate code as much as possible.
|
|
8
|
+
|
|
9
|
+
* Add help info for:
|
|
10
|
+
* MotionBehaviorUI
|
|
11
|
+
* SceneCyclerUI
|
|
12
|
+
|
|
13
|
+
* Extend help info for:
|
|
14
|
+
* BridgeConfigUI
|
|
15
|
+
* DimmerSwitchUI
|
|
16
|
+
* LutronAuroraUI
|
|
17
|
+
* MotionSensorUI
|
|
18
|
+
* WallSwitchModuleUi
|