Energenie MiHome API help

I’m looking for some guidance on how to post the following request through openhab so that I can then connect it to habpanel.

I have all the specifics for the code just need to know how to run it.

Can anyone help?

curl -u "<email address>:<password>" -X POST -H "Content-Type: application/json" -d "{\"id\":<device_group_id_number>}" https://mihome4u.co.uk/api/v1/device_groups/power_on

Hello @Nathan_Wilcox, we have implemented a binding for Energenie Mi|Home and created a Pull Request in the openhab2-addons repository. - https://github.com/openhab/openhab2-addons/pull/2054

Would you like to try it out ?

1 Like


That’s great news! I’d love to give it a go, I have two openhab systems that I can run this with, one that is an initial install with nothing on, I use this to test whenever I have something new to try out.

I also have one running my actual system that controls various things around the home which is where I want this the most.

Is this all ready to go as it is now? If so can you point me in the direction of installing the binding so I can give it a go.


Great !

The binding now supports the following devices:

  • MIHO001 Home Gateway;
  • MIHO006 House Monitor;
  • MIHO032 Motion Sensor;
  • MIHO033 Open Sensor.

It is still not merged in the OH2 addons master, so I can send you the jar file with the binding. I have tried to upload it here, but it is not allowed extension. You can add this jar file in the addons folder.


I will pm you my email address for the jar to test. When you say it supports the devices can you tell me what exactly it supports with regards to the MIHO001 Home Gateway.

Also any rough idea as to how long until you can look at the MIHO024 1 Gang Light Switch (This is the nickel version that I have installed already but I am led to believe the coding is the same between all the versions and that the only difference being the faceplate material/colour)

I also have MIHO021 Double Wall Socket installed (again I believe coding is the same as the plain original white version)



I have sent you the jar file.

Also any rough idea as to how long until you can look at the MIHO024 1 Gang Light Switch

I also have MIHO021 Double Wall Socket installed

We have bought a starter kit that included the devices listed above (MIHO001, MIHO006, MIHO032 and MIHO033). The API calls for the different devices are the same and the JSON messages look almost identically, but until we have example messages from the devices that you have mentioned (MIHO024 and MIHO021), we can’t add a support for them.

In your original post, I see you had some problems sending requests to the MiHome servers. Have you solved them ? I can help you with the requests and the responses I think will be enough to add the devices (MIHO024 and MIHO021) to the supported one by the binding :slight_smile: .



I’ve finally got around to installing the binding. A first issue I have come across is that my Gateway Code actually has a number appear within it and does not conform to the 10 Capital Letter requirement, resulting in:

Status: OFFLINE - CONFIGURATION_ERROR Invalid gateway code. 10 capital letters expected

from Paper UI.

The number is the 5th character in my gateway code, as symbolised below:


L= Letter N=Number

Thanks! I will fix it and I will send you the updated version.

Great news!

My first post was all about running the curl command from openhab in order to try and control devices. I had come across a link where it gave one example as shown in the first post which is used to turn a group on or off.

The command works perfectly, but I could never issue a command to turn a single socket on or off.

I’d be more than willing to run some things on my end in order to test responses so you could add them to your Binding. The only issue being I’m a complete newbie to programming so would need a rather descriptive way of how to run such things.

For the last few days we have a problem with our gateway. It all started with the upgrade from 1.2.0 to 1.2.1 and now every try to register the gateway leads to error - “Auth code was not recognized. Please ensure that the device is connected to the network.” I was wandering if you have such problem or something went wrong with our gateway.


My gateway hasn’t updated yet, it is still running on version 1.2.0 and has remained registered and fully working both with their independent app and with the openhab Binding you have been working on.

Hope this helps

@svilenvul @m-memova

Hi Both,

Are there any advances on the Binding? I’ve not seen any activity on the GitHub changes for a while and just wanted to check how things were getting on.

I’ve had my energy monitor connected now for roughly 2 weeks and it seems to work perfectly with the system, great response times and work very well inside HABpanel.

Also, how have you found the motion sensors to be? Are they relatively accurate and how do you find the pairing process before I purchase any?


Great to hear that the energy monitor is working good !

And about your questions:

Are there any advances on the Binding?

We are waiting for the PR to be reviewed and merged in the openhab2-addons repository. If you like, you could leave some comments in the GitHub Pull Request as well :).

Also, how have you found the motion sensors to be? Are they relatively accurate and how do you find the pairing process before I purchase any?

We haven’t experienced any issues with them (the sensitivity can be configured by pressing a button) and the paring process doesn’t differ from the process for the other devices.

@svilenvul @m-memova

Hi Both,

Just wondering if you could quickly teach me how I can go about parsing a select piece of information from the response below. The piece I’m after is the section "power_state":0, I want to use this as a way of checking the state of the light Switch to see if it has been turned on.

Hopefully this will help with your future endeavours when including it into the binding.

[16:51:42] openhabian@openHABianPi:~$ curl -u "USERNAME:PASSWORD" -X POST -H "
Content-Type: application/json" -d "{\"id\":42349}" https://mihome4u.co.uk/api/v1/subdevices/show
,"name":"Nathan \u0026 Jess Room","user_id":30732}],"today_wh":0,"today_wh_range":"low","last_data_i


Basically there are several steps which you need to follow in order to extract almost any information you want.

  1. send the request (the response you get is a JsonObject) :
    JsonObject showResponse = apiManager.showSubdevice(42349);

  2. get the data object from the response (again, it’s a JsonObject):
    JsonObject showResponseData = showResponse .get(JSONResponseConstants.DATA_KEY).getAsJsonObject();

  3. get the property you need as JsonElement - once you have the data object, you can use the get(String memberName) method to extract what you need.
    JsonElement stateElement = showResponseData.get("power_state");

  4. Parse the JsonElement to its corresponding type (String, int, double…)
    int powerState = stateElement.getAsInt();

Of course, you can combine the last two steps :
int powerState = showResponseData.get("power_state").getAsInt();

Keep in mind, that it is a little more complicated if you want to extract the errors from the data, for example. In that case there are some objects into arrays into objects and so on :slight_smile: You can see it in one of the last commits to PR.

I hope I helped.


we’ve made some changes to the binding. Here’s the PR for the latest version:

You can try it if you want.
If you find anything disturbing feel free to share with us.


How do i intalls this, and where is it available to download from?

How do you install the socket adaptors?


Forgive my newbie-ness. How do I get to install your module for the Energienie MiHome. Just got one of these with the door sensor and want to hook it into my OpenHab2 setup.