gemakers / gea-sdk Goto Github PK
View Code? Open in Web Editor NEWThe GE Appliances Software Development Kit
License: GNU General Public License v2.0
The GE Appliances Software Development Kit
License: GNU General Public License v2.0
Code attempts to use a time parameter but none is sent per the message spec.
Hi folks,
I tried out examples/display-info.js with my laundry pair and couldn't get it to output anything. After doing some digging, it appears that the culprit is appliance.applianceType.read() as all the other read() functions appear to be working.
Here is my sample re-written version of examples/display-info.js without the nested functions:
var gea = require("gea-sdk");
var adapter = require("gea-adapter-usb");
var app = gea.configure({
//address: 0xcb
address: 0xe4
});
app.bind(adapter, function (bus) {
bus.once("appliance", function (appliance) {
appliance.applianceType.read(function (applianceType) {
console.log("type:", applianceType);
});
appliance.modelNumber.read(function (modelNumber) {
console.log("model:", modelNumber.trim());
});
appliance.serialNumber.read(function (serialNumber) {
console.log("serial:", serialNumber.trim());
});
console.log("address:", appliance.address);
console.log("version:", appliance.version.join("."));
});
});
Output from my washing machine:
address: 37
version: 0.1.1.46.1.91.1.1.3
model: GFWR4805F0MC
serial: ZxxxxxxxG
Note the conspicuously missing type. The way examples/display-info.js is written, not getting a result from appliance.applianceType.read() causes it to not descend into the inner functions resulting in no output.
application.bind(adapter, callback)
This function will use the adapter to bind to an address on the bus. The callback will be called for each instance of the bus that was found. Note that the adapters are separate node.js packages, and are not included in the SDK. This allows the community to create unique adapters for different communication protocols. The supported adapters are USB and UDP.
Link in the docs for the UDP adapter is dead: https://github.com/GEMakers/gea-adapter-udp
Hi folks,
I originally posed this question on the 1B forums, but @MylesCaley recommended that I open an issue here as well.
I recently started doing some testing with my laundry pair and discovered an oddity with how the gea-sdk handles more than one Green Bean (and it's associated appliance) attached to my development machine. For example, if I call appliance.modelNumber.read() it will fire once for each connected appliance. This also seems to happen for the subscribe() function. Since there is no clear source to what GB/appliance is responding to the read() and subscribe() functions it can lead to confusion in handling the results.
Per @MylesCaley's suggestion, I tried defining different addresses for two sample applications (0xE5 for the dryer and 0xE4 for the washing machine), but this seems to have no bearing on the behavior. The first script to run appears to claim all the USB-attached Green Beans, resulting in a USB read error when the next script is started. I have posted full details of the scripts and the output to Gist here.
I was running my first trivial green been application this morning (source included below) on a Raspberry Pi (Raspbian GNU Linux 7 / Linux redbox-raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l GNU/Linux), and it appeared to be working fine -- it immediately reported a bunch of values from my Hawk dryer:
$ sudo /home/pi/nodejs-local/bin/node status.js
machine status changed: 0
machine sub-cycle changed: 0
cycle count changed: 611
time remaining changed: 0
selected cycle changed: 8
operating mode changed: 0
I left it running and walked away from my computer. About 1.5 hours later, I returned to see the following stack trace on the screen:
events.js:74
throw TypeError('Uncaught, unspecified "error" event.');
^
TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at Adapter.emit (events.js:74:15)
at sendPacket (/home/pi/node_modules/green-bean/node_modules/gea-adapter-usb/index.js:55:18)
at Adapter.send (/home/pi/node_modules/green-bean/node_modules/gea-adapter-usb/index.js:150:9)
at Adapter.bus.send (/home/pi/node_modules/green-bean/node_modules/gea-sdk/src/command.js:46:9)
at null.<anonymous> (/home/pi/node_modules/green-bean/node_modules/gea-sdk/src/appliance.js:464:13)
at wrapper [as _onTimeout] (timers.js:261:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
I'm out of time to dig deeper right now, but I'm curious to know if you have seen such errors before. Are there typical causes / bozo errors that cause this kind of thing?
You'll have to forgive me; I'm entirely new to Javascript (I'm a C dev in my day job); what's the typical way to get more information from a sub-module that emits an amorphous error?
I notice that the error occurs in Adaper.send at this block (https://github.com/GEMakers/gea-adapter-usb/blob/master/index.js#L51):
try {
hid.write(writer.toArray());
}
catch (error) {
self.emit("error", error);
}
It's unfortunate that it's not more descriptive on what the error is, but clearly it erred in trying to write to the GB device.
It looks like node-hid is a dependent module; I see C++ source code for HID::write() (i.e., Javascript hid.write()) under ~/node_modules/green-bean/node_modules/gea-adapter-usb/node_modules/node-hid
. The only error I see occurring in there is at https://github.com/node-hid/node-hid/blob/master/src/HID.cc#L172, where hid_write() fails. Looking into the source for node-hid, it looks like on Linux, hid_write() is essentially a wrapper around write(2) (see https://github.com/signal11/hidapi/blob/master/linux/hid.c#L666).
On my RPi, I simply used "npm install green-bean", which installed all the GEA sub-modules for me, to include node-hid (which seems to have sub-included hidapi). I see the source under ~/node_modules/.../node-hid
, but it doesn't look like it was compiled there, so it's not just a trivial "add errno to the JSException string" and recompile.
I can figure out to compile hidapi for myself later (e.g., to see the errno value), but I'm out of time for now. Hence, I'm just curious as to whether you've seen this kind of error before, and if it's due to a bozo user error. :-)
The trivial application is below.
var greenBean = require("green-bean");
greenBean.connect("laundry", function(laundry) {
laundry.machineStatus.subscribe(function (value) {
console.log("machine status changed:", value);
});
laundry.machineSubCycle.subscribe(function (value) {
console.log("machine sub-cycle changed:", value);
});
laundry.endOfCycle.subscribe(function (value) {
console.log("end of cycle changed:", value);
});
laundry.cycleCount.subscribe(function (value) {
console.log("cycle count changed:", value);
});
laundry.dryerServiceErrorCodes.subscribe(function (value) {
console.log("dryer service error codes changed:", value);
});
laundry.maximumWaterTemperature.subscribe(function (value) {
console.log("maximum water temperature changed:", value);
});
laundry.timeRemainingInSeconds.subscribe(function (value) {
console.log("time remaining changed:", value);
});
laundry.tankStatus.subscribe(function (value) {
console.log("tank status changed:", value);
});
laundry.tankSelected.subscribe(function (value) {
console.log("selected tank changed:", value);
});
laundry.cycleSelected.subscribe(function (value) {
console.log("selected cycle changed:", value);
});
laundry.operatingMode.subscribe(function (value) {
console.log("operating mode changed:", value);
});
laundry.delayTimeRemainingInMinutes.subscribe(function (value) {
console.log("delay time remaining changed:", value);
});
});
Hello,
I am trying to use your SDK for appliances. I have a green-bean and I wanted to apply it somehow. I cannot use npm and the link provided to get the SDK.
Seth
P.S. If you understand, please try to reply. I would like to know what is going on with the SDK. Oh and node --version: v6.11.4.
I don't see any plugins for the GE Appliance window air conditioners. Will a plugin or SDK be available for these in the future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.