It's all well and good doing cool things with MiHome and IFTTT, but what if you really want to get geeky... well it's time to try out the API.
While I must praise Energenie for having a documented API, I initially found the lack of real world examples confusing. Through trial and error, I eventually worked out that you need the following details to start using the API.
List the device groups:
curl -u "a<email address>:<password>" https://mihome4u.co.uk/api/v1/device_groups/list
Up will come a long stream, somewhere in there will be the device group ID number you want.. but rather than struggle to work out where it is, I suggest you log on to the website, find the group you want to action and hover over the Edit link. In the URL you will see the device group id number.
From there it's a simple case of using the credentials you use to log on to https://mihome4u.co.uk, and you can use CURL to action your request.
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
Simple!
Sunday, 31 July 2016
Automating with the Energenie MiHome controller: The Android app, and IFTTT
First things first... opening the Mi|Home app plays a little jingle... how very Windows 95. Let's hope the developers take notice of the comments on the reviews and at least make it an option, or preferably get rid of it altogether.
The app itself is quite pretty and gets the job done. Here you can see all my devices and the device groups.
On my Samsung Galaxy S6 Plus with a 5.7" screen at 1440 x 2560 resolution the buttons are on the small side, but usable.
Never mind, I thought to myself, I'm sure they have a widget that would enable me to turn all the lights off with a click of a single button on the homescreen as I blearily stumble off to bed.
Hmm, so no widget eh? Well this just became a bit less useful.
I wonder if the IFTTT integrations can help?
First you'll need to connect to IFTTT through the phone app
Create a new recipe
Select the action i.e. power on or off a device or group. Give the recipe a pithy name, and click Add
Congratulations, you now have a big full screen button to do your bidding.
But it's still not quite as easy as I want, so the next step is to go to your home screen, press and hold in a blank space and choose to add a widget. Select DO button and you will be presented with a list of your recipes, choose the appropriate one, and you are all set!
Click the Do button widget and run around amazing you friends and family with the awesomeness!
The app itself is quite pretty and gets the job done. Here you can see all my devices and the device groups.
On my Samsung Galaxy S6 Plus with a 5.7" screen at 1440 x 2560 resolution the buttons are on the small side, but usable.
Never mind, I thought to myself, I'm sure they have a widget that would enable me to turn all the lights off with a click of a single button on the homescreen as I blearily stumble off to bed.
Hmm, so no widget eh? Well this just became a bit less useful.
I wonder if the IFTTT integrations can help?
First you'll need to connect to IFTTT through the phone app
Then install the IFTTT DO Button app
Fire up Do and click on the grey pestle and mortar icon to create your recipe.
Click on the grey plus bar, choose Channels, scroll down and select "Enegenie Mi|Home"
Create a new recipe
Select the action i.e. power on or off a device or group. Give the recipe a pithy name, and click Add
Congratulations, you now have a big full screen button to do your bidding.
But it's still not quite as easy as I want, so the next step is to go to your home screen, press and hold in a blank space and choose to add a widget. Select DO button and you will be presented with a list of your recipes, choose the appropriate one, and you are all set!
Click the Do button widget and run around amazing you friends and family with the awesomeness!
Saturday, 23 July 2016
Automating with the Energenie MiHome controller: Initial setup
I recently bought an Energenie MiHome MIHO027 Starter Bundle from Amazon at a knockdown price. Feeling flush I decided to get an extra set of three adapters to get the numbers of sockets up to 6 which should be enough to handle all my lights.
Initial setup was simple, I did it from my laptop, but found out that it was probably even simpler to use the app.. once I worked out which one to install.
A quick note to the developers... Xiaomi will always come up first in searches as they have much bigger market presence and better SEO. It might be better to admit defeat and choose a unique name (no matter who registered what first). Also, using the "pipe" line to separate Mi and Home - Mi|Home probably isn't going to help make SEO easier, especially as you don't use it in the play store.
Anyway, once I was all connected, it was a simple task to go round all the new sockets holding down the power button to link them to the Gateway and thus to the account.
I created a group called "Lounge lights" and could power them on and off.
Performance is acceptable, with an average 2.5 period between the lights responding to my request. I have 5 lights wired up, and they all switch at a slightly different time, so it looks like the commands are sent out serially. Hmm, I wonder if there is a way to schedule the order and delay of the lights switching, there is potential for some funky lighting effects.
In the next article, I will give my thoughts on the App and IFTTT integration.
Initial setup was simple, I did it from my laptop, but found out that it was probably even simpler to use the app.. once I worked out which one to install.
A quick note to the developers... Xiaomi will always come up first in searches as they have much bigger market presence and better SEO. It might be better to admit defeat and choose a unique name (no matter who registered what first). Also, using the "pipe" line to separate Mi and Home - Mi|Home probably isn't going to help make SEO easier, especially as you don't use it in the play store.
Anyway, once I was all connected, it was a simple task to go round all the new sockets holding down the power button to link them to the Gateway and thus to the account.
I created a group called "Lounge lights" and could power them on and off.
Performance is acceptable, with an average 2.5 period between the lights responding to my request. I have 5 lights wired up, and they all switch at a slightly different time, so it looks like the commands are sent out serially. Hmm, I wonder if there is a way to schedule the order and delay of the lights switching, there is potential for some funky lighting effects.
In the next article, I will give my thoughts on the App and IFTTT integration.
Subscribe to:
Posts (Atom)