@nightspark77/node-red-charlie-home-assistant 1.0.0 → 1.0.2

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Charlie assistant
2
+
3
+ Create and control your own device with Charlie within nodered
package/device.html CHANGED
@@ -5,7 +5,7 @@
5
5
  color: '#fff',
6
6
  defaults: {
7
7
  name: { value: '', required: true },
8
- id: { value: '', required: true },
8
+ deviceId: { value: '', required: true },
9
9
  deviceType: { value: 'light', required: true },
10
10
  externalId: { value: '', required: true },
11
11
  outputs: { value: 2 },
@@ -32,8 +32,8 @@
32
32
  <script type="text/x-red" data-template-name="charlie-device">
33
33
  <form id="dialog-form" class="form-horizontal" autocomplete="off">
34
34
  <div class="form-row">
35
- <label for="node-input-id">Id</label>
36
- <input id="node-input-id" />
35
+ <label for="node-input-deviceId">Id</label>
36
+ <input id="node-input-deviceId" />
37
37
  </div>
38
38
 
39
39
  <div class="form-row">
package/device.js CHANGED
@@ -10,7 +10,7 @@ module.exports = function (RED) {
10
10
 
11
11
  (async () => {
12
12
  if (
13
- !config.id ||
13
+ !config.deviceId ||
14
14
  !config.name ||
15
15
  !config.externalId ||
16
16
  !config.deviceType
@@ -26,7 +26,7 @@ module.exports = function (RED) {
26
26
  'Content-Type': 'application/json',
27
27
  },
28
28
  body: JSON.stringify({
29
- _id: config.id,
29
+ _id: config.deviceId,
30
30
  name: config.name,
31
31
  externalId: config.externalId,
32
32
  provider: conf.provider.id,
@@ -37,7 +37,7 @@ module.exports = function (RED) {
37
37
  client = mqtt.connect(mqttHost());
38
38
 
39
39
  client.on('connect', () => {
40
- client.subscribe(`device/${config.id}/state`);
40
+ client.subscribe(`device/${config.deviceId}/state`);
41
41
  });
42
42
 
43
43
  client.on('message', (topic, payload) => {
@@ -51,7 +51,7 @@ module.exports = function (RED) {
51
51
 
52
52
  const outputs = [null, null, null];
53
53
  outputs[oi] = {
54
- topic: config.id,
54
+ topic: config.deviceId,
55
55
  payload: { state: res.power, level: res.level },
56
56
  };
57
57
 
@@ -75,7 +75,7 @@ module.exports = function (RED) {
75
75
  client.publish(
76
76
  `device/state`,
77
77
  JSON.stringify({
78
- id: config.id,
78
+ id: config.deviceId,
79
79
  power: payload.state,
80
80
  level: payload.level ?? 100,
81
81
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nightspark77/node-red-charlie-home-assistant",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Create and control your own device with Charlie within nodered",
5
5
  "license": "ISC",
6
6
  "keywords": [
package/provider.html CHANGED
@@ -4,7 +4,7 @@
4
4
  paletteLabel: 'Provider',
5
5
  color: '#fff',
6
6
  defaults: {
7
- id: { value: '', required: true },
7
+ providerId: { value: '', required: true },
8
8
  name: { value: '', required: true },
9
9
  charlieHost: { value: 'localhost' },
10
10
  apiPort: { value: 9300 },
@@ -22,8 +22,8 @@
22
22
  <script type="text/x-red" data-template-name="charlie-provider">
23
23
  <form id="dialog-form" class="form-horizontal" autocomplete="off">
24
24
  <div class="form-row">
25
- <label for="node-input-id"><i class="fa fa-tag"></i> ID</label>
26
- <input type="text" id="node-input-id" />
25
+ <label for="node-input-providerId"><i class="fa fa-tag"></i> ID</label>
26
+ <input type="text" id="node-input-providerId" />
27
27
  </div>
28
28
 
29
29
  <div class="form-row">
package/provider.js CHANGED
@@ -18,7 +18,7 @@ module.exports = function (RED) {
18
18
  'Content-Type': 'application/json',
19
19
  },
20
20
  body: JSON.stringify({
21
- _id: config.id,
21
+ _id: config.providerId,
22
22
  name: config.name,
23
23
  codesource: 'default_custom',
24
24
  }),