uEagle – MicroPython interface for the Rainforest EAGLE

In the process of porting my DIY power meter to run on a microcontroller I ended up writing a MicroPython module to access the Rainforest Auomation EAGLE gateway.

The results of that effort can be found at github.com/jcalbert/uEagle. The usage is fairly similar to RainEagle, but differ in that uEagle:

  • requests JSON responses from the device, rather than XML
  • only uses modules from the MicroPython library
  • uses the EAGLE’s HTTP REST API only, and uses urequests to make POST requests
  • only works by accessing the EAGLE locally / doesn’t use Rainforest’s cloud
  • performs many fewer safety checks & rarely sanitizes input

With it, a basic request for energy demand is:

from uEagle import Eagle

CLOUD_ID = '012abc'
INSTALL_CODE = '0123456789abcdef'
ADDRESS = '' #microcontrollers can't resolve .local addresses

eagle = Eagle(CLOUD_ID, INSTALL_CODE, address=ADDRESS)

demand_data = eagle.get_instantaneous_demand()
print('Current Usage: {:.3f} kW'.format(demand_data['Demand']))

Joseph Albert

Leave a Reply

Your email address will not be published. Required fields are marked *