Skip to main content

PyLoopEnergy

This provides a python API to Loop Energy who provide electricity and gas monitors.

It uses their service to provide readings that are updated every 10 seconds for electricity, and every 15 minutes for gas.

To use the service you need the the client serial number and secret keys for your devices.

You can get this by logging into your-loop.com, opening your browser's console, and typing in Drupal.settings.navetas_realtime.

(There is more detailed documentation about how to do this here https://home-assistant.io/components/sensor.loop_energy/)

You should keep your secret keys, secret!

Thanks to Marcos Scriven for producing a node implementation that I've shamelessly copied. https://github.com/marcosscriven/loop

Data is returned in kw.

Dependencies

PyLoopEnergy depends on socketIO-client. It needs version 0.5.6 which supports socket.IO version 0.9, rather than 1.0.

How to use

>> import pyloopenergy
>> elec_serial = 'your serial'
>> elec_secret = 'your_secret'
>> le = pyloopenergy.LoopEnergy(elec_serial, elec_secret)
>> le.electricity_useage

0.602

>> le.terminate()

Notes:

  1. Data is fetched asynchronously, so le may not be populated if you call electricity_useage straight after creating it. The API provides callback functions on update (there is a simple example below).
  2. It can take 15s to terminate the monitoring thread after calling terminate.

Simple subscription example

import pyloopenergy
import time

def gas_trace():
    print("Gas =", le.gas_useage)

def elec_trace():
    print("Electricity =", le.electricity_useage)

elec_serial = '00000';
elec_secret = 'YYYYYY';

gas_serial = '11111';
gas_secret = 'ZZZZZ';

le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret)
le.subscribe_gas(gas_trace)
le.subscribe_elecricity(elec_trace)

time.sleep(120)
le.terminate()
time.sleep(60)

This produces the following output.

Electricity = 1.13
Gas = 0.0
Electricity = 1.116

Gas Meter Types and Calorific values

The library supports metric and imperial gas meters (reading cubic metres or 100s of cubic feet)

The default is a metric meter, but you can specify an imperial or metric meter.

le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret, pyloopenergy.IMPERIAL)

le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret, pyloopenergy.METRIC)

To convert from a volume reading into kw, the library needs to know how much energy is in each metre of gas. The default is 39.11, but you can use the real number from your supplier if you like.

le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret, pyloopenergy.IMPERIAL, 39.1)

le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret, pyloopenergy.METRIC, 39.1)

Release files for pyloopenergy 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyloopenergy 0.2.1
File Size Uploaded
pyloopenergy-0.2.1.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyloopenergy 0.2.1
File Interpreter ABI Platform
pyloopenergy-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / pyloopenergy-0.2.1.tar.gz

Download URL pyloopenergy-0.2.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
84f44b3601a9438b52bbbf9bc9cc8241d8263c35f99b9237ef4240d4e2ed7e61
BLAKE2b-256 checksum
How to use checksums
a43f63e8e62229eb20708b732fde1640969097b87d0a8bb50a25b10c6773b025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.9 Linux/5.4.0-1025-azure

Release files / pyloopenergy-0.2.1-py3-none-any.whl

Download URL pyloopenergy-0.2.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d83f4b2814e1a7f18739e3c7325fe53c0bec1b7767d503fe35534bab6cbd41e4
BLAKE2b-256 checksum
How to use checksums
25afb68eb31c70e8a8bc67e08afaf33be3dae4a6f6e3daf40e4005883a262222
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.9 Linux/5.4.0-1025-azure

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.17

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page