Skip to content

Commit e4c19a1

Browse files
AndrewAndrew
Andrew
authored and
Andrew
committed
tweak icon
finish errorcodes LUT
1 parent 40c4636 commit e4c19a1

File tree

6 files changed

+216
-121
lines changed

6 files changed

+216
-121
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ These are in JSON format as the msg payload and look like:
3131
"HORIZONTAL” : "NA",
3232
"EXTCMD" : "UP",
3333
"ERROR" : {
34-
id : 13,
35-
short : "Short Circuit",
36-
long : "Short circuit has been detected while running"
34+
"id" : 13,
35+
"short" : "Short Circuit",
36+
"long" : "Short circuit has been detected while running"
3737
}
3838
}
3939
```

nexus21/errorcodes.js

+197-113
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default {
1+
'use strict';
2+
3+
module.exports = {
24
8: {
35
id: 8,
46
short: 'Unexpected Reset',
@@ -10,119 +12,201 @@ export default {
1012
long: 'An error occur on LIN bus'
1113
},
1214
10: {
13-
id: 9,
15+
id: 10,
1416
short: 'Power fail',
1517
long: 'Power fail occurred or power regulator adjusted below 10%'
16-
}
17-
};
18-
19-
20-
21-
22-
23-
// 11
24-
// Channel count changed
25-
// Number of channels connected to system has changed since last initialization
26-
// 12
27-
// Position difference
28-
// Difference between minimum and maximum position of a reference has been exceeded
29-
// 13
30-
// Short circuit
31-
// Short circuit has been detected while running
32-
// 14
33-
// Checksum
34-
// Position checksum check failed, all channels has position lost
35-
// 15
36-
// Power limit
37-
// System has reached its power limitation
38-
// 16
39-
// Key error
40-
// Illegal key combination or change of keys
41-
// 17
42-
// No Safety
43-
// Safety function has not allowed movement but input active
44-
// 18
45-
// Missing initialization plug
46-
// A special service tool is required to change number of channels to the system
47-
// 19
48-
// LIN power
49-
// LIN power dropped unexpected while system active.
50-
// 23
51-
// Channel 1 missing
52-
// Actuator is missing
53-
// 24
54-
// Channel 2 missing
55-
// 29
56-
// Channel 1 type
57-
// Actuator type has changed since initialization, or detected wrong.
58-
// 30
59-
// Channel 2 type
60-
// Actuator type has changed since initialization, or detected wrong, or not same as first actuator.
61-
// 35
62-
// Channel 1 pulse
63-
// Too many pulse errors.
64-
// 36
65-
// Channel 2 pulse
66-
// 41
67-
// Channel 1 Overload up
68-
// Overload occur outwards
69-
// 42
70-
// Channel 2 Overload up
71-
// 47
72-
// Channel 1 Overload down
73-
// Overload occur inwards
74-
// 48
75-
// Channel 2 Overload down
76-
// 53
77-
// Channel 1 Anti-collision
78-
// Anti-collision limit has been exceeded
79-
// 54
80-
// Channel 2 Anti-collision
81-
// 59
82-
// Channel 1 SLS activation
83-
// SLS input has been activated
84-
// 60
85-
// Channel 2 SLS activation
86-
// 65
87-
// Channel 1B type
88-
// Type of port B of channel has been changed
89-
// 66
90-
// Channel 2B type
91-
// 71
92-
// Channel 1A shorted
93-
// Short circuit detected on output
94-
// 72
95-
// Channel 1B shorted
96-
// 73
97-
// Channel 2A shorted
98-
// 74
99-
// Channel 2B shorted
100-
// 84
101-
// DC-out
102-
// DC unit has been disconnected or failed
103-
// 85
104-
// Radio dead
105-
// Radio circuit has died and has had to be restarted
106-
// 86
107-
// Master
108-
// Connection to master lost OR following messages are from master
109-
// 87
110-
// Slave 1
111-
// Connection to 1st slave lost OR following messages are from 1st slave
18+
},
19+
11: {
20+
id: 11,
21+
short: 'Channel count changed',
22+
long: 'Number of channels connected to system has changed since last initialization'
23+
},
24+
12: {
25+
id: 12,
26+
short: 'Position difference',
27+
long: 'Difference between minimum and maximum position of a reference has been exceeded'
28+
},
29+
13: {
30+
id: 13,
31+
short: 'Position difference',
32+
long: 'Short circuit has been detected while running'
33+
},
34+
14: {
35+
id: 14,
36+
short: 'Checksum',
37+
long: 'Position checksum check failed, all channels has position lost'
38+
},
39+
15: {
40+
id: 15,
41+
short: 'Power limit',
42+
long: 'System has reached its power limitation'
43+
},
44+
16: {
45+
id: 15,
46+
short: 'Key error',
47+
long: 'Illegal key combination or change of keys'
48+
},
49+
17: {
50+
id: 17,
51+
short: 'No Safety',
52+
long: 'Safety function has not allowed movement but input active'
53+
},
54+
18: {
55+
id: 18,
56+
short: 'Missing initialization plug',
57+
long: 'A special service tool is required to change number of channels to the system'
58+
},
59+
19: {
60+
id: 19,
61+
short: 'LIN power',
62+
long: 'LIN power dropped unexpected while system active.'
63+
},
64+
23: {
65+
id: 23,
66+
short: 'Channel 1 missing',
67+
long: 'Actuator is missing'
68+
},
69+
24: {
70+
id: 24,
71+
short: 'Channel 2 missing',
72+
long: 'Actuator is missing'
73+
},
74+
29: {
75+
id: 29,
76+
short: 'Channel 1 type',
77+
long: 'Actuator type has changed since initialization, or detected wrong.'
78+
},
79+
30: {
80+
id: 30,
81+
short: 'Channel 2 type',
82+
long: 'Actuator type has changed since initialization, or detected wrong, or not same as first actuator.'
83+
},
84+
35: {
85+
id: 35,
86+
short: 'Channel 1 pulse',
87+
long: 'Too many pulse errors.'
88+
},
89+
36: {
90+
id: 36,
91+
short: 'Channel 2 pulse',
92+
long: 'Too many pulse errors.'
93+
},
94+
41: {
95+
id: 41,
96+
short: 'Channel 1 Overload up',
97+
long: 'Overload occur outwards'
98+
},
99+
42: {
100+
id: 42,
101+
short: 'Channel 2 Overload up',
102+
long: 'Overload occur outwards'
103+
},
104+
47: {
105+
id: 47,
106+
short: 'Channel 1 Overload down',
107+
long: 'Overload occur inwards'
108+
},
109+
48: {
110+
id: 48,
111+
short: 'Channel 2 Overload down',
112+
long: 'Overload occur inwards'
113+
},
114+
53: {
115+
id: 53,
116+
short: 'Channel 1 Anti-collision',
117+
long: 'Anti-collision limit has been exceeded'
118+
},
119+
54: {
120+
id: 54,
121+
short: 'Channel 2 Anti-collision',
122+
long: 'Anti-collision limit has been exceeded'
123+
},
124+
59: {
125+
id: 59,
126+
short: 'Channel 1 SLS activation',
127+
long: 'SLS input has been activated'
128+
},
129+
60: {
130+
id: 60,
131+
short: 'Channel 2 SLS activation',
132+
long: 'SLS input has been activated'
133+
},
134+
65: {
135+
id: 65,
136+
short: 'Channel 1B type',
137+
long: 'Type of port B of channel has been changed'
138+
},
139+
66: {
140+
id: 66,
141+
short: 'Channel 2B type',
142+
long: 'Type of port B of channel has been changed'
143+
},
144+
71: {
145+
id: 71,
146+
short: 'Channel 1A shorted',
147+
long: 'Short circuit detected on output'
148+
},
149+
72: {
150+
id: 72,
151+
short: 'Channel 1B shorted',
152+
long: 'Short circuit detected on output'
153+
},
154+
73: {
155+
id: 73,
156+
short: 'Channel 2A shorted',
157+
long: 'Short circuit detected on output'
158+
},
159+
74: {
160+
id: 74,
161+
short: 'Channel 2B shorted',
162+
long: 'Short circuit detected on output'
163+
},
164+
84: {
165+
id: 84,
166+
short: 'DC-out',
167+
long: 'DC unit has been disconnected or failed'
168+
},
169+
85: {
170+
id: 85,
171+
short: 'Radio dead',
172+
long: 'Radio circuit has died and has had to be restarted'
173+
},
174+
86: {
175+
id: 86,
176+
short: 'Master',
177+
long: 'Connection to master lost OR following messages are from master'
178+
},
179+
87: {
180+
id: 87,
181+
short: 'Slave 1',
182+
long: 'Connection to 1st slave lost OR following messages are from 1st slave'
183+
},
112184

185+
// Error codes defined by Device Software
113186

114-
// 500
115-
// Rest API argument error
116-
// Rest API argument error
117-
// 501
118-
// LIN Communication error
119-
// IPLINBox communication lost with LIN Controlbox
120-
// 502
121-
// Ref1 position lost
122-
// Ref1 position lost
123-
// 503
124-
// Ref2 position lost
125-
// Ref2 position lost
126-
// 504
127-
// Memory error
128-
// IPLINBox internal eeprom is not working, so wifi ssid/password/date can not be read/stored
187+
500: {
188+
id: 500,
189+
short: 'Rest API argument error',
190+
long: 'Rest API argument error'
191+
},
192+
501: {
193+
id: 501,
194+
short: 'LIN Communication error',
195+
long: 'IPLINBox communication lost with LIN Controlbox'
196+
},
197+
502: {
198+
id: 502,
199+
short: 'Ref1 position lost',
200+
long: 'Ref1 position lost'
201+
},
202+
503: {
203+
id: 503,
204+
short: 'Ref2 position lost',
205+
long: 'Ref2 position lost'
206+
},
207+
504: {
208+
id: 504,
209+
short: 'Memory error',
210+
long: 'IPLINBox internal eeprom is not working, so wifi ssid/password/date can not be read/stored'
211+
},
212+
};

nexus21/icons/icon.png

2.88 KB
Loading

nexus21/tvlift.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
inputLabels: "command",
1212
outputLabels: "status",
1313
color: '#FFFFFF',
14-
icon: "squarelogo.png",
14+
icon: "icon.png",
1515
label: function() {
1616
return this.name || 'TV Lift';
1717
},

nexus21/tvlift.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// const async = require('async');
99
// const io = require("socket.io-client");
1010
const axios = require('axios');
11+
const errorCodes = require('./errorcodes');
1112

1213
module.exports = function(RED) {
1314

@@ -47,18 +48,28 @@ module.exports = function(RED) {
4748
const changed = (oldVertical !== node.VERTICAL) || (oldHorizontal !== node.HORIZONTAL);
4849

4950
if (!node.working) {
50-
node.error(json);
51+
node.error(`JSON Error? ({} = ok): ${JSON.stringify(json)}`);
5152
node.status({
5253
fill: 'red',
5354
shape: 'dot',
5455
text: 'Unknown Error'
5556
});
5657
return;
5758
}
58-
if (changed) {
59+
60+
var errors = null;
61+
62+
if ((node.STATUS === 'ERROR') && node.DESCRIPTION) {
5963
// todo: add decoded error payload if required
64+
// errorCodes contains the error code LUT.
65+
// node.DESCRIPTION is a json list of error codes. Just map them:
66+
//errors = node.DESCRIPTION.map( if in LUT, use that object, otherwise use a standardised "unknown error" object );
67+
}
68+
69+
if (changed || errors) {
70+
6071
const msg = {
61-
payload: Object.assign({}, json)
72+
payload: Object.assign({}, json, { errors: errors || undefined })
6273
};
6374
node.send(msg); // pass on the status update to any listening nodes
6475
node.status({

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-nexus21",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Nodes to help automate Nexus21 TV Lifts.",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1"

0 commit comments

Comments
 (0)