[RELEASE] MiHome (Connect) V2.0.1 [Energenie] (not Xiaomi MiHome)


(Fiachra McVicker) #43

Excuse my stupid question but Im new to this website. How do i send you a dm and not just clutter up the post with all the code?

(Alex Lee) #44

@Lloyd_Williams Try updating your MiHome Adapter Plus device to the latest 2.0.1. I’m hoping this resolves your chart issue you mentioned way back. Can you let me know if it works?

[RELEASE] NST Manager v5.0
(Lloyd Williams) #45

looks good thanks.

(Alex Lee) #46

Updated to support MiHome Double Wall Sockets device with MiHome (Connect) v2.0.1.

(Kevin P) #47

Double Wall Socket update just installed and it works a treat. Thanks.

(Alex Lee) #48

Excellent. We finally have the full MiHome set compatible with this smart app! Thanks to all who gave me pointers along the way with the undocumented device type labels in the MiHome API. I’ll crack open the wine in celebration. :grinning:

(Lloyd Williams) #49

Three cheers for Alex :grinning:

(Kevin P) #50

Great job Alex.
Three cheers from me too. :grinning:
Your Hive and Mi|Home apps have added a lot to my Smart Home adventure.


Hi guys, it might be dumb questions but I just want to make sure…

are any of the in wall sockets and light switches able to report their status?

the devices do not report their status only when they were manually switched on/off, right?

thank you.

(Gary Spender) #52


Thank you for this excellent bit of work, I might have found an issue but it could just as easily be an issue with my setup.

We’ve got single adapters around the house and they all work exactly as expected with your code.

We’ve also got 3 multiplug adapters and when anything inside SmartThings turns on one socket on one of these devices about two minutes later all of the sockets are reported as having been turned on, do you think this could be an issue in the code ?

The selected socket comes on as expected, and the others do not change state, smartthings just thinks they have.

I am more than happy looking at the code myself as long term software developer, but I have no SmartThings / groovy experience, and I don’t want to to introduce any unintended issues by doing so.

I’ve traced the state of all of the output using initial state and this is very repeatable logically with no physical outputs other than those expected.

Any ideas what might be happening ?


(Alex Lee) #53

Hi Gary,

I believe that this might be an API issue, but ultimately it’s difficult to investigate as I do not have these devices.

These adapters do not report their status and so the status in SmartThings cannot necessarily be relied upon. A side effect was when you turn on a MiHome single plug adapter or MiHome light switch via the API, the status is updated as expected.

For multi-plugs, to power on and off you can send a parameter to turn the individual socket on a multiplug on and off. https://mihome4u.co.uk/docs/api-documentation/subdevices-api/power-a-socket-on-off

However, it is not documented whether when calling the API to show subdevice information that the socket id can be used https://mihome4u.co.uk/docs/api-documentation/subdevices-api/show-subdevice-information.

In my code for “MiHome Adapter” line 83 to 87, I am trying to pass the socket ID to the MiHome Show SubDevice Information API just in case it does respond with a state for each individual socket on a multiplug adapter. I believe what you’re explaining shows that this socket ID is ignored and a status for the multiplug device as a whole is returned which would explain the behaviour you’re seeing.

As I don’t have these devices, it’s difficult to test and investigate, but hopefully an explanation on where the code is might allow you to do some digging.


(Gary Spender) #54


That is brilliant , thank you for the advice I will report back if I find anything.


(Gary Spender) #55


It looks like your assertion about the ignored socket id is correct, I have captured the JSON status returned using Hurl.It when talking directly to the API endpoints you mentioned and the socket ID is usable for setting power on and power off but seemingly ignored when reporting status, if I try and send it in a subdevice request the response complains it should be an integer not a string. It is more than possible that I am calling this incorrectly in my test, but it seems to work as you suspected.

When doing a /subdevices/list API call the power_state for the whole unit is returned as a 1 if any socket is on.

If you would like to see it I have captured json state info with one plug on, all off and another plug on, which might help debugging, would you like me to send it to you ?

I am acutely aware that this is not a commercial project for you, so I am not expecting you do anything, but more than happy to help you fix the problem if I can.


(Alex Lee) #56

If you can DM me the JSON state then I’m happy to have a look.

(Gary Spender) #57


JSON trace sent with a brief explanation.

Thank you,


(Mark Gale) #58

Hi Alex,

Great app, (brand new to SmartThings, got the hub starter kit today from Currys £139.99).

It discovers all my devices apart from the door/window “MIHO033 Open Sensor” (https://energenie4u.co.uk/catalogue/product/MIHO033).

I think you may have overlooked the device from scanning the code.

Anything I can do to help complete the package, I tried to “/api/v1/devices/list” but couldn’t work out how to supply my username/password via URL to kept getting back access-denied.


(Olivier) #59

Hey Alex,

I finally managed to install the SmartApp (was struggling with the “Wrong shard” issue).
Loving it, thanks a lot!
Any chance of getting the Open Sensor added there?
MIHO033 (https://energenie4u.co.uk/catalogue/product/MIHO033)

(Nathan) #60

I am prob being a newbie here but I’m thinking of getting the mihome uk wall sockets and although I can see Alex’s great work on here with the smart app I’m stuggling to find the device handler. Please help guys. Looking for the double wall socket DH

Thanks in advance guys

(Bob) #61

When I last checked with them, they didn’t do a slave light switch.
This means if you have 2 switches controlling one light you will struggle.
Lightwave do slave light switches.
Here is the information you require for DH is at the top of this thread.

(Gary Spender) #62


I don’t have any double Wall sockets to test this on, but the code looks like the SmartApp understands ‘sockets’ and uses the MiHome Adapter DTH to operate them.

I would try installing the SmartApp and the MiHome Adapter driver and take it from there.