Hi there! Is anybody out there using a Discovergy Smart Meter … and having already developed a (private) OpenHAB binding for getting the smartmeter data into our smarthome management system? Well, if yes I would be very happy if I could also use your binding!
If not, would anybody out there be able to help me develop a binding to acces their API with OAuth (see https://api.discovergy.com/docs/)???
I am waiting for my electrician to install my SmartMeter.
This one will work with ZigBee or Z-Wave not sure, have to look into the docs again
When it’s installed I ofc want the data in openHAB so I will report back if and how I made progress.
Is this a DISCOVERGY smart meter? If not, you might want to check the existing smart meter binding(s), then might already serve your needs.
No it’s from https://qubino.com/products/smart-meter/
Well, then it’s neither a real “smart meter” in the sense that it communicates the measured energy consumptions to the supplier for monitoring and billing (see https://en.m.wikipedia.org/wiki/Smart_meter) but just a private energy meter that allows to access your measurement data via Z-Wave … nor is it the specific smart meter from Discovergy that can be accessed via their API with OAuth2 authentication … which is the specific setting for which I am searching a binding (and for which I started this dedicated thread).
But all the best for your energy metering - I’m sure you’ll get you meter connected to OpenHAB easily!
I wrote a tutorial for how to implement OAuth using Rules and a web page. You need to use myopenhab.org but it worked out well for what I was trying. In the end the service I was trying to integrate didn’t provide useful information, but the OAuth part worked. OAuth2 using just OH Rules and myopenhab.org.
That’s really the hard part. Once you’re in to the service, it’s just a matter of making the HTTP calls and parsing the results.
Having said that, given that they provide a full example in Java, a binding wouldn’t be too much effort for someone who would want a relatively easy first binding to implement. I don’t have this meter so have no way to help beyond the link above.
Here is some information that could help:
- I see in their api they can return raw data. I don’t know what that is, but if it’s obis data you might be able to build upon an existing binding. There are several bindings that work with some kind of obis variants. So you might want to research what you can reuse or extend and existing binding with a new thing and reuse the logic of parsing the data.
- They provide an example that might be a good starting point. the api uses OAuth 1. There is no support out-of-the-box in openHAB so you need to add that yourself. However in their example they use a library you could also use. One thing to look into is to use the http service provided by openHAB and not an external library. The OAuth library they use supports different http libraries, but also can be integrated with the http service provided in openHAB.
Any progress here? I would love to see a binding. I am willing to get one and support with testing the binding.
There is an european standard for meters called M-Bus/WM-Bus/OMS. There is a binding for it. It works with radio receivers (WM-Bus/OMS) for now: https://github.com/KuguHome/openhab-binding-wmbus/
Binding works with standard gas, heat, electricity, oil and water meters. Since this is standard mass produced equipment can be really cheap - radio enabled water meters or pulse converter hats start from 25€+ and range to several hundred for more advanced devices variants. Heat and electricity meters are slightly more expensive.
Did I mention that WM-Bus doesn’t need an account on supplier cloud infrastructure? Well, now I did.
I also would appreciate a Discovergy Binding.
I’ll get one of these Smart Meters soon aswell, so I am looking for a way to integrate this into OpenHAB. I am not completely new to binding development, I have done that before but my previous bindings are more of a “do not do it this way”-example, which is why I was never brave enough to make a PR for those. Anyways, here are my first thoughts:
Except that this example uses all sorts of libraries that are not the recommended libraries. So basically it needs to be rewritten with the recommended libraries.
Fortunately there is a demo account available so everybody can help.
The correct approach for this binding would probably be a bridge for the account and then have the individual meters as things. Unfortunately I have never done any bridge-binding development… Anyways, in the bridge’s
initialize() I do the login to the API, if it suceeds I set the bridge to online, otherwise to offline? How do I do the things discovery now? I assume all things wait for their bridge to go online before they are actually initialized? Also does anybody know how long an oauth1 token is valid? How would I automatically refresh it if it is about to expire (or has expired)? As a thing can get it’s bridge object the token is just a variable in the bridge object so the thing can get it from there? Also is someone willing to do all the final work that is still necessary when I have a kinda working binding somehow up and running? Unfortunately I won’t be able to do all the work by myself…
I came up with a binding for now (so disregard all the questions in my previous post ), however I haven’t tested it at all yet and I am sure that once I will do so it will throw all kinds of errors at me. I will probably do that tomorrow.
I’ve tested it now and it works! Just missing auto discovery and I am not sure if I need any additional handling for an expired token (I guess I do), but once that is added it should be pretty much good to go.
It’s defined by the service you integrated with. It should be mentioned in the API docs they provide.
That too should be described in the API docs. For another service I implemented something like this for, you get a refresh token when you first get the auth token that you can use to renew/request a new auth token. See OAuth2 using just OH Rules and myopenhab.org
You should get a specific error coffee when you make a request after the sith token has expired.
They just describe that “when the status code indicates that the token is invalid it should be refreshed”. Very vague in my opinion. I’ll just leave this running for now and see what happens after some time, maybe the library takes care of this already.
I also got the auto discovery working now, so all that’s left is the token refresh and getting this thing merged (which will be quite some effort). Also I probably need to contact Discovergy regarding the license of the published samples, especially to figure out if we can use them at all for an openhab binding (and distribute it under openhabs license).
Little update: Token refresh is now working aswell, unfortunately I didn’t get any clarification on the license yet so this is kinda on hold at the moment. Also there are some special cases that require some minor adaptations but other than that this binding is working absolutely great for me.
Happy New Year to everybody!!!
#push - Did anybody manage to develop a working openHAB-integration of Discovergy Smart Meters?
Yes, as I mentioned earlier I developed a working binding. I’ve been using it for quite some time now and its stable, at least for power meters.
Which smartmeters (or interfaces) does it support?
The wm-bus binding mentioned earlier in this thread does not work with a IMST USB dongle.