Jump to content

Eagle 3


socalgene

Recommended Posts

Posted

Does the existing node server not work with the Eagle 3?  Does the log show anything useful if it doesn't?

I've found two API documents for Rainforest Automation, one specifically for the Eagle-200 and the other is a more generic Eagle API.  

The current library that I used for the node server is no longer being maintained and appears to use yet another API (not what's documented either of the two documents above). 

So I think I'd have to write a new node server using the generic API docs.  If that API works with the 200, then it might not be too hard, but if it doesn't, it gets a lot harder as I don't have the Eagle 3 hardware to test and debug with.  I'll do some testing later, but at this time, I can't really promise anything.

  • 2 weeks later...
Posted (edited)

@bpwwer -- happy to help test anything with a revision or new NS.
Eagle 3 is compatible with existing Eagle-200 APIs (both Cloud Poll and Local Push).

In fact, one thing that keeps me from using your current NS is the fact that it's the Cloud version API and using Polling, from what I can tell, vs using the Rainforest's Local API (which is a push instead of a poll).

Instead, since I haven't taken the time to make a local-API version of a NS in developer mode, I actually point to a non-UDI/Polisy/eISY Node.js server on my network, which then pushes updated variable values to variables on the Polisy.

Resources:

Edited by residualimages
Posted

Is this the API that you're using?  https://rainforestautomation.com/wp-content/uploads/2017/02/EAGLE-200-Local-API-Manual-v1.0.pdf

I've been looking at that and at https://rainforestautomation.com/wp-content/uploads/2015/03/EAGLE_REST_API-1.0.pdf which seems to be cloud based.  

I don't think either of these were available when I first wrote the plug-in.  At least not publicly.

Posted

Looks like that's almost the same as the "local API 1.0", but one pushes data to a web server and the other pulls data from the internal web server.

What's not clear from the document you have is how to configure the web server that the gateway will push to.  It's not too hard to create a node server that runs a simple web server that would accept and parse the POST data from the gateway

Posted (edited)
1 hour ago, bpwwer said:

but one pushes data to a web server and the other pulls data from the internal web server.

Yes. Many many folks (myself included) have issues with polling eventually / sporadically locking up the Eagle (where no new polls generate a response).
The "listen for the push" method is much more stable.

1 hour ago, bpwwer said:

What's not clear from the document you have is how to configure the web server that the gateway will push to. 

There are two pieces.

  1. Make a server process that listens for, and responds to, UDP packets on the same network as the Rainforest Eagle.
    There is a somewhat redacted version of my Node / npm script below, as I've hastily deleted the lines which post to ISY variables through REST. Originally adapted from: https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/73 -- that post also links to a perhaps more robust Listener API document.
     
  2. Configure the Eagle through Rainforest's portal to attempt to send to the local IP_address/path:port that is running the server process from #1.
    RainforestLocalListener-forUDIForum.thumb.png.ed12d8f8d0fc8640cce1716a564139ef.png

For step #1, it can be entirely basic:

const express = require('express');
const http = require('http');
const app = express();
const bodyParser = require('body-parser');

const InstaneousDemandTimeLimit = 1000;
const SummationTimeLimit = 1000;
var LastInstantaneousDemandTimestamp = 0;
var LastSummationTimestamp = 0;
var LastInstantaneousDemandWh = 0;

// Tell express to use the body-parser middleware and to not parse extended bodies
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json()); // for parsing application/json

// this one handles the Eagle 200 packets
app.post('/eagle200', (req, res) => {
  if (req.body.body[0].dataType == 'InstantaneousDemand') {
    if (parseInt(req.body.body[0].timestamp) > (LastInstantaneousDemandTimestamp + InstaneousDemandTimeLimit)) {
      LastInstantaneousDemandTimestamp = parseInt(req.body.body[0].timestamp);
      LastInstantaneousDemandWh = req.body.body[0].data.demand*1000
      console.log('Instantaneous Demand (in Watts): ' + LastInstantaneousDemandWh);
      console.log('     Instantaneous Timestamp: ' + req.body.body[0].timestamp);
      });
    };
  }
  if (req.body.body[0].dataType == 'CurrentSummation') {
    if (parseInt(req.body.body[0].timestamp) > (LastSummationTimestamp + SummationTimeLimit)) {
      LastSummationTimestamp = parseInt(req.body.body[0].timestamp);
      console.log('***Current Meter Read (Total kWh): ' + req.body.body[0].data.summationDelivered);
      console.log(req.body.body[0].data);
      });
    };
  }
  res.set('Content-Type', 'text/plain')
  res.send('Okay')
})

// choose an unused port for this use:
app.listen(xxxx)

 

Edited by residualimages
Posted

So there's a web interface that allows you to set up the listener. That's what I missing.  Thanks! I was looking at the mobile app and it didn't seem to have any way to configure that.

It's on my list of things to work on.  Not sure when I'll get to it, but I'm intrigued so maybe sooner than later. 

  • Thanks 1
Guest
This topic is now closed to further replies.

×
×
  • Create New...