Giter Club home page Giter Club logo

rainforestautomationeagle's Introduction

Rainforest Automation - Eagle API Wrapper

[unofficial] Rainforest Automation Eagle API Wrapper

Dependencies:

Usage:

# import eagle
from RainforestAutomationEagle.eagle import Eagle

# initialize eagle object
eagle = Eagle(user="<cloud-ID>",
              password="<installation-code>",
              ipaddress="<eagle-IP-address>")

# make API request
device_list = eagle.get_device_list()

Making a generic API call

The Rainforest Automation Eagle API receives its commands via an XML structure. Here is an example:

<Command>
  <Name>get_historical_data</Name>
  <Type>demand</Type>
  <Period>Hour</Period>
  <MacId>0xd8d5b90000000000</MacId>
</Command>

This command is created when you run:

historical_data = eagle.get_historical_data(Type="demand", Period="Hour", MacId="0xd8d5b90000000000")

Note that the function name get_historical_data corresponds to the XML Name field. All other fields correspond to the keyword arguments of the function. Knowing this you can now call any get_ Eagle API function. The eagle object will generically generate the XML.

You will need to check the official eagle REST API documentation to get the full list of available functions.

Unfortunately the Eagle API does not return error codes for maleformed API-calls. The only way to know that something is wrong is when you receive an empty response object.

Available API calls

get_device_list

response = eagle.get_device_list()

response.num_devices
response.device_model_id  # list of model IDs
response.device_mac_id    # list of MAC-addresses

get_network_info

response = eagle.get_network_info(MacId="0xd8d5b90000000000")

response.network_status
response.network_ext_pan_id
response.network_short_addr
response.network_channel
response.network_meter_mac_id
response.network_link_strength
response.network_timestamp

get_device_info

response = eagle.get_device_info(MacId="0xd8d5b90000000000")

response.device_date_code
response.device_install_code
response.device_hw_version
reponse.device_zb_version
reponse.device_link_key_lo
response.device_timestamp
response.device_mac_id
response.device_fw_version
response.device_manufacturer
response.device_model_id
response.device_link_key_hi

get_price

response = eagle.get_price(MacId="0xd8d5b90000000000")

response.price_units
response.price
response.price_timestamp
response.price_label

get_message

response = eagle.get_message(MacId="0xd8d5b90000000000")

response.message_queue
response.meter_status
response.message_confirm_required
response.message_confirmed
response.message_read
response.message_timestamp
response.message_id)

get_historical_data

response = eagle.get_historical_data(Type="demand", Period="Hour", MacId="0xd8d5b90000000000")

response.timestamp     # list of timestamps
response.data_size
response.data_type
response.value         # list of KWs
response.data_period

get_device_config

response = eagle.get_device_config(MacId="0xd8d5b90000000000")

response.update_mode
response.update_enabled
response.update_frequency
response.config_ssh_enabled
response.config_vpn_enabled

rainforestautomationeagle's People

Contributors

m3o7 avatar

Watchers

 avatar  avatar

Forkers

disser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.