Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Rainforest EAGLE

David Luther edited this page Mar 30, 2016 · 5 revisions

#Rainforest EAGLE™ Energy Access Gateway# The Eagle lets you retrieve the data from your smart meter locally with out having to pull the data from the cloud.

You will need to add the gateway to your energy meter through your electric company. Here in Texas there is a website devoted for smart meters. SmartMeterTexas.com

After the gateway is added to the meter you will need to disable local security.

In the web portal click the down arrow next to date. at the bottom of that page click the gear.

Gear

uncheck the security box.

Security

While you are in the Eagle gateway page look at the URL at the top and note the IP and MAC for setting up the .RULES file.

MAC

In my setup I created separate item and rule files for power.

power.items

Group	GPersist (All)
Group	GMonitorPower
Group	GMonitorEnergy

Number   HousePowerInstant    "SmartMeter Power [%.3f]" 	<energy>	(GMonitorPower,GPersist)
Number   HouseEnergyDelivered "SmartMeter Energy Delivered [%.3f]" (GMonitorEnergy,GPersist)
Number   HouseEnergySent      "SmartMeter Energy Sent [%.3f]" (GMonitorEnergy,GPersist)
Number   HouseEnergyPrice     "SmartMeter Energy Price [%.3f]" (GMonitorEnergy,GPersist)
Number   HouseEnergyCost      "SmartMeter Energy Cost [%.3f]" (GMonitorEnergy,GPersist)

power.rules

import org.openhab.core.library.types.*
import java.lang.Float
import java.lang.Long
import org.joda.time.DateTime

var DateTime lastTimestamp = null
var float lastDelivered
var float lastReceived
    
rule "Pull Data from Eagle"
when
    Time cron "0 0-59 * * * ?"
then
    var t = now
    val String EAGLE_MAC = "0xe1e100000e1e10"
    val String EAGLE_URL = "http://192.168.1.13/cgi-bin/cgi_manager"
    
    var String postData = String::format("<LocalCommand>
      <Name>get_usage_data</Name>
      <MacId>%s</MacId>
      </LocalCommand>", EAGLE_MAC, EAGLE_MAC)
    
    var result = sendHttpPostRequest(EAGLE_URL, "application/x-www-form-urlencoded", postData)
           
    try {
        var long timestamp = Long::parseLong(transform("JSONPATH", "$.demand_timestamp", result))
        var DateTime currTimestamp = new DateTime(timestamp * 1000)
        var float price = Float::parseFloat(transform("JSONPATH", "$.price", result))
        var float currDemand = Float::parseFloat(transform("JSONPATH", "$.demand", result))
        var float currDelivered = Float::parseFloat(transform("JSONPATH", "$.summation_delivered", result))
        var float currReceived = Float::parseFloat(transform("JSONPATH", "$.summation_received", result))
      
        postUpdate(HousePowerInstant, currDemand * 1000)
    
        if (lastTimestamp != null && !lastTimestamp.equals(currTimestamp)) {
            var float used = currDelivered - lastDelivered
            var float sent = currReceived - lastReceived
    
            logDebug("eagle", String::format("Energy %s demand=%.3f received=%.3f delivered=%.3f", currTimestamp.toString,
              currDemand, used, sent))
            postUpdate(HouseEnergySent, sent * 1000)
            postUpdate(HouseEnergyDelivered, used * 1000)
            postUpdate(HouseEnergyCost, (used - sent) * 1000 * price)
        }
    
        postUpdate(HouseEnergyPrice, price)
    
        lastDelivered = currDelivered
        lastReceived = currReceived
        lastTimestamp = currTimestamp  
    } catch (NumberFormatException nfe) {
        logError("eagle", "Bad Data " + result.replaceAll("\n", " "))
    }
    var long x = now.getMillis - t.getMillis
    logInfo("eagle", "PERF Pull-Data-from-Eagle elapsed: " + String::valueOf(x) + "ms")
end

Note: When you update the EAGLE_URL and the EAGLE_MAC, note the MAC is 18 characters starting with "0x"

==References==

  1. https://community.openhab.org/t/rainforest-zigbee-smart-energy-support/6595

Installation


User Interfaces


Community

(link to openHAB forum)

Development



Misc


Samples

A good source of inspiration and tips from users gathered over the years. Be aware that things may have changed since they were written and some examples might not work correctly.

Please update the wiki if you do come across any out of date information.

Use case examples

Collections of Rules on a single page

Single Rules

Scripts


Release Notes

Clone this wiki locally