Custom Component: Rainforest Eagle-200 local meter reader

@fxcoolby Do you still have the error for sensor.py from the log?

No, unfortunately, I restored my HA from snapshot already.

This has been merged into the Home Assistant dev branch. Hopefully it will be included in one of the next releases!

1 Like

Great job, @gregtd! Has been working flawlessly for me.

I am currently trying to pull rates from SDG&E using UtilityAPI, so i could add them to this.

The component is now apart of Home Assistant 0.97! Please remove the rainforest_eagle directory from the custom_components directory so that you are using the bundled version rather than the custom one.

Greg

Greg, is it possible to pull in the current rate info?

@poldim Yeah it should be possible. The Local API from the Eagle-200 device does return the Price variable.

        <Variable>
          <Name>zigbee:Price</Name>
          <Value>undefined</Value>
          <Units></Units>
          <Description>Price of electricity</Description>
        </Variable>

Mine is currently undefined but I’d imagine it can be changed. I tried changing the value from the Rainforest Web Portal but my device did not update. I’m not sure if I have to wait for an extended period of time of it’s just a bug. I’ll investigate and let you know what I find out in a few days.

Greg

@poldim I got a response from Rainforest Tech Support and they think it’s a bug. The workaround they gave me was to use the Cloud API to retrieve the Price value. I don’t want to do that as the Local API should be fixed to retrieve this value, and as well I don’t want to rely on Internet access.

Hello Greg,

Thanks for contacting Rainforest Support.
When you set the price from the user portal, the local API call should return the price that was set. We suspect that this is a bug, and we are having our developers look into it. In the meantime, there is a cloud API call that should return a value, although we are unsure of what value you have set. To make this API call, please go to EAGLE Cloud REST API and click on the “Data” tab. Then select the /data/metering/price/latest/{deviceGuid} call. Next, click on “Try it out” and enter [removed my deviceGuid] as the deviceGuid and click “Exectue”. If you have any further questions or concerns, please do not hesitate to contact us; we are more than happy to help!

When they fix this then I can implement the change to retrieve the Price value via the Local API.

Greg

Where can I get more information on system requirements? I’m running Ubuntu on a NUC with a hass.io install.

@GaryK The system requirements are very minimal. I run hassio with this component on a Pi 3 without any problems.

Greg

Is there a list of compatible utility meters? I have smart meters but am unsure of their com specs. Also, is LAN all that’s required, or would I need to add a zigbee receiver?

@GaryK I don’t know what all Smart Meters are supported by the Eagle-200 device itself. To use this component you’ll need the Eagle-200 device from Rainforest Automation.

Here’s the link to the device Eagle-200. Also a link to check if the Eagle-200 is supported by your utility company Supported Utilities

The Eagle-200 communicates with your Smart Meter via Zigbee and the component in Home Assistant communicates with the Eagle-200 to retrieve the power usage data over the LAN.

Hope this helps
Greg

Yes, thank you. Unfortunately my utility isn’t listed, but have contacted them to see what they say.

@poldim I was thinking last night that it is possible to implement the rate info yourself. The Price value that would come from the Eagle-200 is a static value that is set by you through the Rainforest Web Portal. Since this value is static, you can create a sensor in HA through the configuration.yaml in the sensor: section

  - platform: template
    sensors:
      utility_energy_rate:
        friendly_name: "Utility Company Energy Rate ($/kWh)"
        value_template: '0.15'

If I implemented the Price value coming from the Eagle-200 (if Rainforest fixes the bug) this is what would be created anyway. Is this what you were looking for? Or were you looking for Rate info that is dynamic coming from the Utility company?

Greg

Yea, a static value could just be an input number. I’m interested in pulling the actual current utility rate from my utility as I have time of use rates that vary by time of day and season of the year.

I don’t believe the Eagle-200 device can pull the utility’s current price rate. That may have to be implemented with some script, AppDaemon, or maybe scrape it directly from the utility’s web site.

I did notice a reference to PriceCluster and PriceTiers in one of the Rainforest API developer docs, which retrieves the price info that is loaded into the meter. I’ll investigate this a bit more and let you know what I find out.

I looked a bit into the Pricing values coming from the Eagle-200, and it appears if the utility company sets the price to the smartmeter than the Eagle should pick it up. I’m using PG&E and they do not appear to do that so all I see is my user defined rate.

You can run this simple HTTP Server and setup the Eagle-200 to Upload data from the Rainforest Portal, to see what data the Eagle-200 device has. Any data uploaded from the Eagle to your IP address will be local to your network and will not be sent out to the Internet, unless you give the IP/Hostname of an external server.

"""
Very simple HTTP server in python for logging requests
Usage::
    ./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging

class S(BaseHTTPRequestHandler):
    def _set_response(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/html')
        self.end_headers()

    def do_GET(self):
        logging.info("GET request,\nPath: %s\nHeaders:\n%s\n", str(self.path), str(self.headers))
        self._set_response()
        self.wfile.write("GET request for {}".format(self.path).encode('utf-8'))

    def do_POST(self):
        content_length = int(self.headers['Content-Length']) # <--- Gets the size of data
        post_data = self.rfile.read(content_length) # <--- Gets the data itself
        logging.info("POST request,\nPath: %s\nHeaders:\n%s\n\nBody:\n%s\n",
                str(self.path), str(self.headers), post_data.decode('utf-8'))

        self._set_response()
        self.wfile.write("POST request for {}".format(self.path).encode('utf-8'))

def run(server_class=HTTPServer, handler_class=S, port=8000):
    logging.basicConfig(level=logging.INFO)
    server_address = ('', port)
    httpd = server_class(server_address, handler_class)
    logging.info('Starting httpd...\n')
    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        pass
    httpd.server_close()
    logging.info('Stopping httpd...\n')

if __name__ == '__main__':
    from sys import argv

    if len(argv) == 2:
        run(port=int(argv[1]))
    else:
        run()

Through the Rainforest portal you enable the Uploader under Settings >> Cloud tab, select Destination as Custom, Label can be whatever you want, Protocol select HTTP, Hostname is the local IP address of the machine the above HTTP server is running on, URL can be whatever /rest, Port is 8000, Username and Password are blank, and Format choose XML (Raw). Than click Add. Start the HTTP Server code and you should see some output. Look for the XML tag <PriceCluster>.

If you need help PM me.

Greg

Thanks. I’d like to figure out if I can have the Eagle upload directly into influx. Do you have any experience with that?

That’s odd as I’m on PGE too and my cloud login shows this $/KWH field:

That’s interesting. Did you ever manually configure the $ through the portal, under Settings >> Metering?
image

I currently have InfluxDB running on my Pi3 and HA persists some values to the DB. If you have HASSIO you can install InfluxDB through the Store, than setup the which entities you want to save in the configuration.yaml

Example portion of the configuration.yaml

influxdb:
  host: 10.0.20.200
  username: home-assistant
  password: password
  include:
    entities:
      - sensor.router_wan_in_counter
      - sensor.router_wan_out_counter
      - sensor.enphase_panel_1
      - sensor.enphase_panel_2
      - sensor.enphase_panel_3

Than restart HA and the DB should be populated with entity values.