Smart Meter UK - Build an app / device handler for api?

Thanks for reply. They advised me there isn’t any such firmware :frowning:
Is it possible the unit is sending the export data to them but isn’t on the IHD?

I’ve got mine setup via home assistant now, but just shows import data entities.

Definitely works on mine. Export value displays on the IHD and reported as negative power value in API.

@Stu_A can you share how you got the API working to get data from the Trio? I emailed Geotogether to ask for documentation on the API but they responded that they dont have a customer facing API (I know they have an API but presumably they dont want customers using it!)

Hi! See my message above from August. Link reposted here:

Thanks mostly to Owainlloyd for the python implementation and lmullineux for the initial app API hacking… Reverse engineering at play here not any documented API.

@Purclewan @gavraq

apologies for the late reply. Here is the NodeRed solution

The header value in the injection entity is your N3ergy ID. The flow puts the info in the HomeAsisstant autogen database that is used for capturing the real-time data etc.

Since I put this together it works flawlessly.

@gavraq for N3rgy to work you need to use your MPxN not the MAC of your IHD. These numbers are available on your Elec/Gas bills.

Happy to expand.

PS, It seems that I cannot post a code here as a new user hence I put it in the git.

Thank you! @Aryankids

Many thanks, I shall have a play and see what I can do with it.

Sorry to be thick, just tried your flow and it seems self explanatory but I’m not sure where I get the N3ergy ID from. Ihave an N3ergy account and I can dowload data using their site but don’t see any reference to a user ID. Tryng your flow with my MPxN as the ID just gives me “User is not authorized to access this resource with an explicit deny” so I assume this is not the ID you refer to. Where do I get or find this ID?

Many thanks for your help.

Hello

Has anyone tried “The Caring App” able to API second generation Smart Meters.
The APP — The.

Looks like a new app downloaded from google, has anybody managed to get this working.

Thanks.

@Purclewan Sorry for the delay in responding.
In regard to N3rgy one of your MPxN is your ID.
But I am guessing the problem you are experiencing is related to the last step in the NodeRed flow where you put the information in a db. I am sure you have already created a db, so the ID and password on that step are related to the user who has W/R privilege to the db. Hope this helps.

Not sure if this helps but recently I had a British Gas smartmeter. The engineer gave me a different HDI on my enquiry if I could access. It. He said my best chance was the one designed for prepayments. This says Geo on the display and has built in wifi. I was able to connect it to my home network using the instructions provided It shows as device ESP_0CB329 on my router. I then downloaded the British Gas app on Android and found that it would give me live readings updated for electricity every 10secs. I wish to access these on my computer to control switchable house loads. I have on line clamp meters for mains use and solar panel output but the mains clamp doesn’t know whether I am importing or exporting… I am not a developer but if anyone could point me to a means to get at the data from the B.Gas app I would appreciate it.

My problem is I have an old… SMETS1 meter, tried to get British Gas to upgrade it to SMETS2 but they won’t play ball… I have a new HDI which I can connect over WIFI to my home IP network but I can’t connect to the smart meter and get any data .https://emoji.discourse-cdn.com/google/unamused.png?v=12

I think you need or perhaps have the GEO 3 HDI with wifi. The one I had could be set up from the display to connect to my wifi. I think the installation engineer did some setting up for my account to use the HDI in the first place.
Then the British gas app could give all the usual info but also show Live electricity readings at 10 sec intervals.
My issue is that I want to get the readings into my computer and need an API to to do this, but as I am not a developer I don’t know how to achieve this in a simple manner.

Unfortunately the GEO TRIO I bought will not “pair” with a SMETS1 meter, even with the engineers code . That’s why I think I need a SMETS2 meter for the TRIO pairing to work. I did have a BG engineer who prepared to help , but he failed and stated I needed a SMETS2 meter.

Hi, thanks to everyone who has contributed to this effort.
I have been playing with this Openhab to Geo interface for a few days and made a few crude tweaks to get it to run for longer. I noticed the authorisation to Geo times out after an hour. Most often logging back in works, but sometimes it seems to re-authorise access to the API but does not yield the data thereafter! Logging in again or sometimes after a few more attempts, then yields the data again. Has anyone else made any progress with this ?

# -*- coding: utf-8 -*-
"""
Script to intergrate GeoTogether meter readings into the Openhab
Still needs some work to handle errors
"""
import requests, json
import threading
import time
import openhab
from datetime import datetime
from openhab import OpenHAB
import os

BASE_URL='https://api.geotogether.com/'
LOGIN_URL='usersservice/v2/login'
DEVICEDETAILS_URL='api/userapi/v2/user/detail-systems?systemDetails=true'
LIVEDATA_URL = 'api/userapi/system/smets2-live-data/'
PERIODICDATA_URL = 'api/userapi/system/smets2-periodic-data/'
USERNAME= '*******'
PASSWORD = '******'
LOG_DIRECTORY = 'var/log/openhab/'



openhab_URL = 'http://localhost:8080/rest'
openhab = OpenHAB(openhab_URL)
HouseElectricityPower = openhab.get_item('HouseElectricityPower')
#HouseGasMeterReading = openhab.get_item('HouseGasMeterReading')
#HouseGasPower = openhab.get_item('HouseGasPower')

class GeoHome(threading.Thread):
    
    # Thread class with a _stop() method. 
    # The thread itself has to check
    # regularly for the stopped() condition.
  
    def __init__(self, varUserName, varPassword):
        
        log = "Start Intalising: " + str(datetime.now())
        threading.Thread.__init__(self)
        self._stop = threading.Event()
        self.varUserName = varUserName
        self.varPassword = varPassword
        self.headers = ""
        self.deviceId = ""
        self.authorise()
        self.getDevice()
        log = log + os.linesep + "End Intalising: " + str(datetime.now())
        with open(LOG_DIRECTORY+"GeoHomeLog"+time.strftime("%Y%m%d")+".json",mode='a+', encoding='utf-8') as f:
            f.write(log + os.linesep)   
  
    def authorise(self):
       data = { 'identity' : self.varUserName , 'password' : self.varPassword }
       r=requests.post(BASE_URL+LOGIN_URL, data=json.dumps(data), verify=False)
       authToken = json.loads(r.text)['accessToken']
       self.headers = {"Authorization": "Bearer " + authToken}
       return
   
    def getDevice(self):
        r=requests.get(BASE_URL+DEVICEDETAILS_URL, headers=self.headers)
        self.deviceId = json.loads(r.text)['systemRoles'][0]['systemId']
        print( 'Device Id:' + self.deviceId)
        return
  
    # function using _stop function
    def stop(self):
        self._stop.set()
  
    def stopped(self):
        return self._stop.isSet()
  
    def run(self):

        while True:
            if self.stopped():
                return
            
            log ="Start Api Call: " + str(datetime.now())
            
            r=requests.get(BASE_URL+LIVEDATA_URL+ self.deviceId, headers=self.headers)
            if r.status_code != 200:
                #Not sucesful. Assume Authentication Error
                log = log + os.linesep + "Request Status Error:" + str(r.status_code)
                #Reauthenticate. Need to add more error trapping here in case api goes down.

                self.varUserName = USERNAME
                self.varPassword = PASSWORD
                self.headers = ""
                self.deviceId = ""
                self.authorise()
                self.getDevice()
            else:    
                log = log + os.linesep + json.dumps(r.text)
                power_dict =json.loads(r.text)['power']
                #Trye and find the electrivity usage
                try:
                    Electrcity_usage=([x for x in power_dict if x['type'] == 'ELECTRICITY'][0]['watts'])
                except:
                    # Cant find Electricity in list. Add to log file and assuming Geo not responding log in again !
                    log = log + os.linesep + "No Electricity reading found, try logging in again!"

                    self.varUserName = USERNAME
                    self.varPassword = PASSWORD
                    self.headers = ""
                    self.deviceId = ""
                    self.authorise()
                    self.getDevice()


                else:
                    #Code executed ok so update the usage
                    HouseElectricityPower.state= Electrcity_usage
                    log = log + os.linesep + "Electrcity_usage:"+str(Electrcity_usage)
    
                
                time.sleep(10)
            
            with open(LOG_DIRECTORY+"GeoHomeLog"+time.strftime("%Y%m%d")+".json",mode='a+', encoding='utf-8') as f:
                f.write(log + os.linesep)    
            
  

t1 = GeoHome(USERNAME,PASSWORD)
t1.start()


Here’s another implementation of “a thing that polls the GeoTogether API and writes data to another thing”. This time it’s written in Go, and writes to Datadog.