To resurrect this from the dead, this was my project for the morning. The EAGLE doesn't take in HTTP POST or GET requests, you have to connect to a socket, upload the command you want in a fragment XML format, and then read the result.
Here is an example of this exchange that I did manually via a raw socket session in the terminal... the "LocalCommand" block is what I sent to the EAGLE, the rest is the response.
<LocalCommand>
<Name>get_device_data</Name>
<MacId>0xd8d5b90000000d1b</MacId>
</LocalCommand>
<NetworkInfo>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<Status>Connected</Status>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<ExtPanId>0x7fffffffffffffff</ExtPanId>
<ShortAddr>0x0000ffff</ShortAddr>
<Channel>11</Channel>
<LinkStrength>100</LinkStrength>
</NetworkInfo>
<DeviceInfo>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<InstallCode>0x2106382813d3607a</InstallCode>
<LinkKeyHigh>a8710899d02752c0</LinkKeyHigh>
<LinkKeyLow>1c19d104ff5baa2b</LinkKeyLow>
<FWVersion>1.4.27 (5278)</FWVersion>
<HWVersion>3.2.3</HWVersion>
<Manufacturer>Rainforest Automation, I</Manufacturer>
<ModelId>RFA-Z109 EAGLE</ModelId>
<DateCode>20121201EC051052</DateCode>
</DeviceInfo>
<InstantaneousDemand>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Demand>0x000001eb</Demand>
<TimeStamp>0x19aba897</TimeStamp>
<Multiplier>0x00000001</Multiplier>
<Divisor>0x000003e8</Divisor>
<DigitsRight>0x00000003</DigitsRight>
<DigitsLeft>0x00000006</DigitsLeft>
<SuppressLeadingZero>0x0001</SuppressLeadingZero>
</InstantaneousDemand>
<CurrentSummation>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<SummationDelivered>0x000000000048aca6</SummationDelivered>
<SummationReceived>0x0000000000000000</SummationReceived>
<Multiplier>0x00000001</Multiplier>
<Divisor>0x000003e8</Divisor>
<DigitsRight>0x00000003</DigitsRight>
<DigitsLeft>0x00000006</DigitsLeft>
<SuppressLeadingZero>0x01</SuppressLeadingZero>
</CurrentSummation>
<PriceCluster>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Price>0xffffffff</Price>
<Currency>0xffff</Currency>
<TrailingDigits>0xff</TrailingDigits>
<Tier></Tier>
<RateLabel></RateLabel>
</PriceCluster>
<MessageCluster>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Id>0x0000</Id>
<Text></Text>
<ConfirmationRequired>N</ConfirmationRequired>
<Confirmed>N</Confirmed>
<Queue>active</Queue>
</MessageCluster>
<MeterInfo>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Type>0x0000</Type>
<Nickname></Nickname>
<Account></Account>
<Auth></Auth>
<Host></Host>
<Enabled>0x00</Enabled>
</MeterInfo>
So, I know I can query the EAGLE manually and get all of the info I want as a nice XML package. So, I figured I can trigger HaikuHelper to perform the same thing over a Sockets interface, triggered by a Button on the OmniProII. This is the code I have in HaikuHelper:
var eagle_mac = "0xd8d5b90000000d1b";
var eagle_ip = "192.168.1.22";
var eaglereturn ="";
function onButtonActivate(button){
if (button.number == 1) {
helper.sendNotification (controller,"This is a test push!");
}
if (button.number == 2) {
helper.log (controller,"Button #2 was seen.");
helper.log (controller,"Going to initialize EAGLE socket now.");
var socket = helper.openSocket(controller, eagle_ip,5002);
var request = "<LocalCommand>\r <Name>get_device_data</Name>\r <MacId>" + eagle_mac + "</MacId>\r </LocalCommand>\r";
helper.log (controller,"Going to send the following text " + request);
helper.log (controller,"Sending to EAGLE now.");
socket.write(request);
}
if (button.number == 3) {
helper.log (controller,"Button #3 was seen.");
helper.log (controller,"Total result from EAGLE is:\r"+eaglereturn);
eaglereturn="";
}
}
function onSocketBytesAvailable(socket) {
helper.log(controller,"Notified of return EAGLE data.");
var tempresult = socket.read();
helper.log (controller,"Data returned was\r" + tempresult);
if (tempresult != null) {
helper.log (controller,"Adding to cumulative results");
eaglereturn = eaglereturn + tempresult;
}
else {
helper.log (controller,"Undefined result returned");
}
}
So, I press button 2 to kick off the EAGLE query. The request is properly formed, the socket is opened, and the request is sent. However the reply is not getting through. I do a button 3 push as well to show the final result. Here is the log from the exchange:
Aug 24 10:28:37 mac-mini.neillt.com HaikuHelper[44415] <Info>: Lakeside: Initializing scripting environment…
Aug 24 10:28:37 mac-mini.neillt.com HaikuHelper[44415] <Info>: Lakeside: Applying controller script…
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Button #2 was seen.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Going to initialize EAGLE socket now.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Going to send the following text <LocalCommand>
<Name>get_device_data</Name>
<MacId>0xd8d5b90000000d1b</MacId>
</LocalCommand>
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Sending to EAGLE now.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
undefined
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Undefined result returned
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
undefined
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Undefined result returned
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
undefined
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Undefined result returned
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
undefined
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Undefined result returned
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
<Id>0x0000</Id>
<Text></Text>
<ConfirmationRequired>N</ConfirmationRequired>
<Confirmed>N</Confirmed>
<Queue>active</Queue>
</MessageCluster>
<MeterInfo>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Type>0x0000</Type>
<Nickname></Nickname>
<Account></Account>
<Auth></Auth>
<Host></Host>
<Enabled>0x00</Enabled>
</MeterInfo>
Aug 24 10:28:42 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Adding to cumulative results
Aug 24 10:28:44 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Notified of return EAGLE data.
Aug 24 10:28:44 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Data returned was
undefined
Aug 24 10:28:44 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Undefined result returned
Aug 24 10:28:52 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Button #3 was seen.
Aug 24 10:28:52 mac-mini.neillt.com HaikuHelper[44415] <Notice>: Lakeside: Script output: Total result from EAGLE is:
<Id>0x0000</Id>
<Text></Text>
<ConfirmationRequired>N</ConfirmationRequired>
<Confirmed>N</Confirmed>
<Queue>active</Queue>
</MessageCluster>
<MeterInfo>
<DeviceMacId>0xd8d5b90000000d1b</DeviceMacId>
<MeterMacId>0x00078100007ef15c</MeterMacId>
<Type>0x0000</Type>
<Nickname></Nickname>
<Account></Account>
<Auth></Auth>
<Host></Host>
<Enabled>0x00</Enabled>
</MeterInfo>
So it seems that the first few blocks of data are getting lost somewhere, and all I am getting is the last chunk, which isn't particularly useful.
Am I making a basic mistake here? It looks like the flow is right, we just aren't capturing all of the data.
Help is greatly appreciated!