UK smart meter integration

I’ve been playing around with an API to get data from my smart meter for gas and electricity. There’s a free API provided by these folks (https://glowmarkt.com/) which seems to work pretty well and gives me data up to the end of the previous day.

I’ve ordered one of their devices for £69 which should connect to most any uk smart meter and give live readings every 10s for electricity and 30m for gas. I’ve been teaching myself JavaScript and looking into how to create homey apps and I’m planning to have a go at integrating this device as a source of whole house electricity and gas usage info plus live unit pricing etc for the uk market.

Any interest in this / anyone else tried something similar?

1 Like

For Holland this is done many times, search for P1, this is the universal name for the connection from the smart meter here.

Just registered for bright myself, going to look if there’s a way to push the values out to JS in homey or use mqtt in some way!

I’ve not played with the MQTT yet but the API works well and is very easy to use. Using advanced flow it’s pretty straight forward to get the data into homey. One main reason for me that i wanted an app is to make the data appear as a whole house smart meter in the energy tab in homey. That way it automatically treats that as the total house consumption and creates an ‘other’ category with all the other energy meter readings from individual devices subtracted from the smart meter reading.

I’ve got this working now in my test app but right now the API keys and so on are hard coded in! So lots of work left to build the pieces that will get meter ids via the api in the app, allow the app to manage the api key from username and password and so on. Taking time as I’m having to teach myself JavaScript as I go so it’s going to be quite a project for me. But the proof of concept is there.

1 Like

Nice, I’ve bought a few JS and Node.JS books myself, is there any resources you’ve used you’ve found helpful? I’m finding it difficult with the app development side but wondering if I’m jumping in the deep end too quick. Is your code open source for the app you’ve done so far?

Think I’ll try with the MQTT and advanced flow to start with! Perhaps an advanced virtual device may allow updates and the ability to show as a smart meter?

The book I am using to learn JavaScript is “JavaScript: The Definitive Guide” from O’Reilly, which seems pretty good and has chapters on node and asynchronous. I found the developer series videos on Homey YouTube channel helpful too to get started with app development.

I am just working out how to get GitHub connected up with VS Code so I can manage the code in a repository. I also need to work out a way to make the authentication work without having to have my username and password hard coded into the app which was my very hacky way to get the proof of concept working. Once I’ve got those sorted, I will make the repository public and keep developing from there.

I did also wonder whether an advanced virtual device would work but I also kinda wanted to try writing an app so I’m going down that path for now. I think the MQTT + advanced flows approach would be doable as well. Who knows, if I really get handy with the JavaScript maybe I can add that to the app later.

1 Like

Thanks for the heads up, will take a look!

Keep us updated and I’ll let you know how I get on when I get a chance to try a few things!

Good luck!

You can store them in the env.json file and don’t publish that to GitHub. The format of the file is standard json with key: value pairs.

I am just working out how to get GitHub connected up with VS Code.

There are plugins for github in VS Code.

Thanks @Adrian_Rockall i have made some good progress today and got GitHub working with vs code. I think I’m well on the way now also to be able to sort the username and password issue. The challenge there was that I can’t use the env.json since each user will need to create their own account for the glowmarkt api and then enter their username and password into this app in order for it to connect and read their smart meter data. But Arie has very helpfully pointed me in the right direction to use the device store for this in another thread I opened on this question How to securely store username and password for an API within my app - #12 by DaneedeKruyff

1 Like