Package: meter-reader
Meter Reader~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.. image:: https://api.codacy.com/project/badge/Grade/06a4909b69f947c4a70b9938ff0fc942:alt: Codacy Badge:target: https://www.codacy.com/app/emansl/meter_reader?utm_source=github.com&utm_medium=referral&utm_content=eman/meter_reader&utm_campaign=badgerRelease 1.1.2Meter Reader is a client library and command line client for retrievingnearly realtime energy usage data from a smart meter via the Eagle™ HomeEnergy Gateway. See`Rainforest™ Automation <http://www.rainforestautomation.com>`_ for moreabout the Eagle™ Home Energy Gateway.Meter Reader is not affiliated with the Eagle™ Home Energy Gateway orRainforest™ Automation.Installation-------------------------------------------------------------------------------.. code-block:: bash$ pip install meter-readerUsage-------------------------------------------------------------------------------Meter Reader is intended to be used as a library for other applicationsbut it does contain a command line application called mr... code-block:: bash$ mr < ip address >This will run the ``list_devices`` devices command on the gateway and displaya formatted response. Other commands, such as ``get_device_data``, will firstrun the ``list_devices`` command to determine the MAC address of the gateway.Commands can be specified with the `'-c'` option. For example.. code-block:: bash$ mr -c get_device_data < ip address >MessageClusterDeviceMacId          xx:xx:xx:xx:xx:xx:xx:xxMeterMacId           xx:xx:xx:xx:xx:xx:xxTimeStamp            0Id                   0Priority             NoneText                 NoneConfirmationRequired NConfirmed            NRead                 YQueue                activeCurrentSummationDeviceMacId          xx:xx:xx:xx:xx:xx:xx:xxMeterMacId           xx:xx:xx:xx:xx:xx:xxTimeStamp            2014-04-19 16:01:22+00:00SummationDelivered   12949746SummationReceived    0Multiplier           1Divisor              1000DigitsRight          3DigitsLeft           15SuppressLeadingZero  YNetworkInfo...$ mr -c get_summation_values < ip address >2014-04-18 16:30:00+00:00, Summation, 0.3502014-04-18 17:30:00+00:00, Summation, 0.3222014-04-18 18:30:00+00:00, Summation, 0.1932014-04-18 19:30:00+00:00, Summation, 0.2852014-04-18 20:30:00+00:00, Summation, 0.2862014-04-18 21:30:00+00:00, Summation, 0.351...There are two ways to retrieve instantaneous demand:1. Send the ``get_instantaneous_demand`` command directly to the gateway. Thiswill return a nearly raw response from the gateway (formatting is applied)... code-block:: bash$ mr -c get_instantaneous_demand < ip address >InstantaneousDemandDeviceMacId         xx:xx:xx:xx:xx:xx:xx:xxMeterMacId          xx:xx:xx:xx:xx:xx:xxTimeStamp           2014-04-19 15:35:27+00:00Demand              297Multiplier          1Divisor             1000DigitsRight         3DigitsLeft          15SuppressLeadingZero Y2. Supply the ``--get-instant-demand`` argument. This will post-process theresponse before displaying it... code-block:: bash$ mr --get-instant-demand < ip address >2014-04-19 15:58:39+00:00, 0.292kWRaw and unformatted data returned by the gatway, can be viewed by using the`'-r'` option... code-block:: bash$ mr -r -c get_device_data < ip address >Including Meter Reader in an application-------------------------------------------------------------------------------.. code-block:: pythonfrom meter_reader import GatewayGATEWAY_ADDRESS = '192.168.1.10'gw = Gateway(GATEWAY_ADDRESS)response = gw.run_command('get_device_data')print('Network Info')print(response['NetworkInfo'])timestamp, demand = gw.get_instantaneous_demand()print('Demand {0!s} at {1!s}'.format(demand, timestamp))License===============================================================================Copyright © 2017, Emmanuel LevijarviAll rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:* Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Notice===============================================================================Eagle™ is a trademark of Rainforest™ Automation