You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require('events').EventEmitter.prototype._maxListeners = 0;
const greenBean = require("green-bean");
function report(name) {
return function(data) {
console.log('');
if (typeof data == 'number') {
console.log(name + ': ' + data + '; 0x' + data.toString(16) + '; 0b' + data.toString(2));
} else if (typeof data == 'string') {
console.log(name + ': "' + data + '"');
} else if (typeof data == 'object') {
var s = '';
for (var f in data) {
s += ' ' + f + '=' + data[f];
}
console.log(name + ': ' + s);
} else {
console.log(name + ': (' + typeof data + ') ' + data);
}
console.log('');
}
}
var fields = [
'cycleStatus', 'operatingMode', 'disabledFeatures', 'reminders', 'rates', 'turbidityCalibration', 'doorCount',
'userConfiguration', 'error', 'cycleCounts', 'continuousCycle', 'controlLock', 'personality',
'diverterCalibration', 'cycleState', 'analogData', 'cycleData0', 'cycleData1', 'cycleData2', 'cycleData3',
'cycleData4', 'dryDrainCounters', 'tubLight'
];
var dishwasher;
greenBean.connect("dishwasher", function(dw) {
dishwasher = dw;
var fields = [
'cycleStatus', 'operatingMode', 'disabledFeatures', 'reminders', 'rates', 'turbidityCalibration', 'doorCount',
'userConfiguration', 'error', 'cycleCounts', 'continuousCycle', 'controlLock', 'personality',
'diverterCalibration', 'cycleState', 'analogData', 'cycleData0', 'cycleData1', 'cycleData2', 'cycleData3',
'cycleData4', 'dryDrainCounters', 'tubLight'
];
for (var index = 0; index < fields.length; index += 1) {
var field = fields[index];
if (field in dishwasher)
dishwasher[field].subscribe(report(field));
else
console.log('API doesn\'t have ', field);
}
});
Here's the output from running it:
$ sudo node listen-dishwasher.js
cycleStatus: cycleRunning=0 activeCycle=0 activeCycleStep=0 stepsExecuted=0 stepsEstimated=0
cycleData1: cycleTime=112962 cycleNumber=0 cycleDurationInMinutes=118 cycleCompleted=1 cycleMinimumTemperatureInFahrenheit=70 cycleMaximumTemperatureInFahrenheit=142 cycleFinalCirculationTemperatureInFahrenheit=142 cycleMinimumTurbidityInNTU=32 cycleMaximumTurbidityInNTU=3962
cycleData2: cycleTime=114539 cycleNumber=0 cycleDurationInMinutes=114 cycleCompleted=1 cycleMinimumTemperatureInFahrenheit=69 cycleMaximumTemperatureInFahrenheit=143 cycleFinalCirculationTemperatureInFahrenheit=142 cycleMinimumTurbidityInNTU=4 cycleMaximumTurbidityInNTU=1161
buffer.js:625
throw new RangeError('index out of range');
^
RangeError: index out of range
at checkOffset (buffer.js:625:11)
at Buffer.readUInt8 (buffer.js:663:5)
at readUInt8 (/home/ianh/node_modules/green-bean/node_modules/gea-sdk/node_modules/binary-stream/index.js:69:23)
at Adapter.<anonymous> (/home/ianh/node_modules/green-bean/node_modules/gea-sdk/src/erd.js:177:56)
at emitOne (events.js:82:20)
at Adapter.emit (events.js:169:7)
at onPacketReceived (/home/ianh/node_modules/green-bean/node_modules/gea-adapter-usb/index.js:103:26)
at /home/ianh/node_modules/green-bean/node_modules/gea-adapter-usb/index.js:128:17
The text was updated successfully, but these errors were encountered:
Here's my code:
Here's the output from running it:
The text was updated successfully, but these errors were encountered: