Here's my code required to get reads into Domoticz from Loop via PyLoopEnergy;
Code:
#!/usr/bin/python3
import pyloopenergy
import time
import urllib
def gas_trace():
print("Gas =", le.gas_useage)
f = "http://127.0.0.1/json.htm?type=command¶m=udevice&idx=18&svalue=%s" % int(le.gas_useage*1000)
urllib.request.urlopen(f).read
def elec_trace():
print("Electricity =", le.electricity_useage)
f = "http://127.0.0.1/json.htm?type=command¶m=udevice&idx=17&svalue=%s" % int(le.electricity_useage*1000)
urllib.request.urlopen(f).read
elec_serial = 'REMOVED';
elec_secret = 'REMOVED';
gas_serial = 'REMOVED';
gas_secret = 'REMOVED';
le = pyloopenergy.LoopEnergy(elec_serial, elec_secret, gas_serial, gas_secret, pyloopenergy.IMPERIAL, 39.1)
le.subscribe_gas(gas_trace)
le.subscribe_elecricity(elec_trace)
Just grab your serial and secrets from the Loop portal as described in the PyLoopEnergy instructions, create two dummy electricity sensors in Domoticz and update the IDX values in the script. You can also change from imperial to metric meter and alter the calorific value for the gas consumptions if required.
I have this running constantly using systemd on my Raspberry Pi Domoticz box and it feeds electricity reads in at a rate of one reading every 30 seconds and one every 15 minutes for gas which gives a fairly decent resolution to my graphs.