# \[New Binding\] Rainforest Eagle 200 local binding

**URL:** <https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448>\
**Category:** Bindings\
**Tags:** openhab2, development, binding\
**Created:** [May 3, 2018, 3:41am UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448 "2018-05-03T03:41:47Z")\
**Posts on this page:** 6\
**Page:** 5

<div class="post-metadata">

**Author:** ![jswim788](https://community.openhab.org/user_avatar/community.openhab.org/jswim788/32/36341_2.png) [@jswim788](https://community.openhab.org/u/jswim788)\
**Post date:** [October 11, 2021, 4:15pm UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/81 "2021-10-11T16:15:56Z")

</div>

That’s my experience as well. I have 2 of the Eagle’s and they appear to be happier pushing data. Polling is a little problematic with them. If you are going to poll, you have to be ready for timeouts and other error conditions. I found them to be far more reliable when they push data. No errors, no issues.

---

<div class="post-metadata">

**Author:** ![raaahbin](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/e47774/32.png) [@raaahbin](https://community.openhab.org/u/raaahbin)\
**Post date:** [September 24, 2022, 3:48am UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/82 "2022-09-24T03:48:31Z")

</div>

Thank you for this - I’d been battling with a Python-\>MQTT solution (which was working until I updated mosquitto), and then last night I tried setting this up and within a matter of minutes had it working better and more smoothly than either the binding or the Python version ever did. Set it up as a LaunchAgent this morning.

---

<div class="post-metadata">

**Author:** ![raaahbin](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/e47774/32.png) [@raaahbin](https://community.openhab.org/u/raaahbin)\
**Post date:** [April 14, 2025, 3:00pm UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/83 "2025-04-14T15:00:08Z")

</div>

I seem to have a new problem with what had been a very robust solution for a long time - possibly since updating to openHAB 5.0.0.M1? For some reason, post2put.js no longer seems happy to talk to my openHAB installation… which is weird, because if I send the same request using curl it seems to work. Here’s the error output from post2put being run at the command line:

```auto
PUT Instantaneous Demand: 0.774
{ Error: Parse Error
    at TLSSocket.socketOnData (_http_client.js:440:20)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at TLSSocket.Readable.push (_stream_readable.js:208:10)
    at TLSWrap.onread (net.js:597:20) bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' }

```

But if I send the same data with a curl, it works fine:

```auto
curl -k -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "0.774" "https://192.168.11.5:8443/rest/items/elecDemand/state"

```

Any ideas why post2put would be failing now?

---

<div class="post-metadata">

**Author:** ![jswim788](https://community.openhab.org/user_avatar/community.openhab.org/jswim788/32/36341_2.png) [@jswim788](https://community.openhab.org/u/jswim788)\
**Post date:** [April 14, 2025, 4:10pm UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/84 "2025-04-14T16:10:45Z")

</div>

I haven’t tried this with 5.0M1 yet. Google search says this:

_The HPE\_INVALID\_CONSTANT error in Node.js typically arises when the HTTP parser encounters an issue interpreting the response from a server. This often indicates that the response is malformed or doesn’t conform to expected HTTP standards._

You could add some console.log statements for debugging and see if that gives any additional info.

By the way, if I were to start over on this, I think I would look at the [webhook](https://community.openhab.org/t/webhook-http-binding/152184) binding as then there is no need for the external script. I haven’t done that yet, but it seems like a good solution. However, node.js should work, there’s probably a simple problem.

---

<div class="post-metadata">

**Author:** ![raaahbin](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/e47774/32.png) [@raaahbin](https://community.openhab.org/u/raaahbin)\
**Post date:** [April 15, 2025, 1:15am UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/85 "2025-04-15T01:15:13Z")

</div>

Thanks for the reply - still no idea why node.js’s https wasn’t working, but I’ve rewritten it to send the request to openHAB using curl (since that worked fine from the command line), and that seems to have done the job nicely. Here’s the code chunk I inserted, with everything else that post2put did with https commented out.

```auto
const curlStart = 'curl -k -s -S -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "';
const curlEnd = '" "https://192.168.11.5:8443/rest/items/elecDemand/state"';
var curlString;

// 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);
      console.log('PUT Instantaneous Demand: ' + req.body.body[0].data.demand);

  // for some reason sending it using node.js https was not working... but curl works!

      curlString = curlStart;
      curlString += req.body.body[0].data.demand.toString();
      curlString += curlEnd;
		exec(curlString, (error, stdout, stderr) => {
			if (error) {
				console.log(`error: ${error.message}`);
				return;
			}
			if (stderr) {
				console.log(`stderr: ${stderr}`);
				return;
			}
		});
    }
  }

```

---

<div class="post-metadata">

**Author:** ![jswim788](https://community.openhab.org/user_avatar/community.openhab.org/jswim788/32/36341_2.png) [@jswim788](https://community.openhab.org/u/jswim788)\
**Post date:** [April 15, 2025, 2:49pm UTC](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448/86 "2025-04-15T14:49:18Z")

</div>

Thanks for the workaround.

I’m curious if you tried using node.js to put to the http (not https) port? Possibly there is an issue using https now?

[Previous page](https://community.openhab.org/t/new-binding-rainforest-eagle-200-local-binding/44448.md?page=4)
