socalgene Posted December 8, 2023 Posted December 8, 2023 Is it possible to add the new Eagle 3 to this project? Good job with the 200. Thanks, Gene
bpwwer Posted December 8, 2023 Posted December 8, 2023 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.
residualimages Posted December 20, 2023 Posted December 20, 2023 (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: https://www.rainforestautomation.com/support/developer/ https://support.rainforestautomation.com/support/solutions/articles/66000480916-eagle-200-local-api-documentation https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/81 https://community.home-assistant.io/t/custom-component-rainforest-eagle-200-local-meter-reader/110656/27?page=2 https://github.com/home-assistant/core/issues/85388 https://community.home-assistant.io/t/rainforest-eagle-3-installation/566347/6 https://flows.nodered.org/flow/f2e96859b597b2eba61d20aa784efd24 Edited December 20, 2023 by residualimages
bpwwer Posted December 20, 2023 Posted December 20, 2023 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.
residualimages Posted December 20, 2023 Posted December 20, 2023 Their documentation is a mess, but I've been using their Local API for years (first under via ISY with @tgutwin's PowerEYE, then my own Node.js based one since Polisy). Maybe this is what I used more? https://rainforestautomation.com/wp-content/uploads/2014/07/EAGLE-Uploader-API_06.pdf See also some decent walkthroughs here: https://community.hubitat.com/t/release-rainforest-eagle/38883
bpwwer Posted December 21, 2023 Posted December 21, 2023 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
residualimages Posted December 21, 2023 Posted December 21, 2023 (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. 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. 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. 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 December 21, 2023 by residualimages
bpwwer Posted December 21, 2023 Posted December 21, 2023 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. 1
residualimages Posted December 21, 2023 Posted December 21, 2023 Thanks! I'm curious to see how you do it, especially if the repo is public (or if you feel comfortable adding me to it), as my nascent UDI development efforts and GitHub familiarization proceed.
Recommended Posts