Energenie mihome integration

Hi is there a easy way to put in energenie mihome integration for controlling light switchs and power switchs, or can someone make one please?

Tim

1 Like

It’s relatively straight forward, add the following to your config.yaml


Switch:
  platform: command_line
  switches:
    Switch_name:
      command_on: 'curl -u "username:password" -X POST -H "Content-Type: application/json" -d "{\"id\":000000}" https://mihome4u.co.uk/api/v1/subdevices/power_on'
      command_off: 'curl -u "username:password" -X POST -H "Content-Type: application/json" -d "{\"id\":000000}" https://mihome4u.co.uk/api/v1/subdevices/power_off'
      friendly_name: Switch Name


Swap Switch_name and Switch Name to whatever you choose, change 000000 to your device ID (use the Mihome website, login, click the device in question and it’ll be the second number in the URL). Finally change username and password in the code to your energenie account.

1 Like

Hi jadamou, I’ve added the above to my configuration.ymal file, but I can’t see how to use it in automatons.
I’m new to HA and any help you could give me would be appreciated. Do I need to reboot for it to pick up the changes, or is there something else that I need to do?
Thanks.

I know I’m over a year late to this but if anyone else ran into tthe same problem it seems like the configuration format has changed since the original code snippit. The following modified yaml code works for me:

command_line:
 - switch:
      name: Friendly Name
      command_on: 'curl -u "username:password" -X POST -H "Content-Type: application/json" -d "{\"id\":000000}" https://mihome4u.co.uk/api/v1/subdevices/power_on'
      command_off: 'curl -u "username:password" -X POST -H "Content-Type: application/json" -d "{\"id\":00000}" https://mihome4u.co.uk/api/v1/subdevices/power_off'

Hi, unfortunately I could not get either of these to work on my system, and stopped using HA. I have decided to get my Raspberry Pi reimaged and have another go, and I can see that a lot has changed. But I am still very much a Novice, and so I don’t really know what I am doing still. I have been quite successful with other aspects of HA that have existing Integrations etc. However as the Energenie MiHome system is not integrated I am struggling (again) trying to get my Energenie Sockets working with HA. Using jadamou’s set of code gives the warning that it doesn’tlike “switch”, and richmbeer’s set of code just gave loads of errors and HA will not run. I realise that it is probably not just a case of adding your respective code, but I have no idea even where to place your code, and what other supporting/supported code is require to make it run. Do I have to add a switch.yaml block, or do I have to add your set of code at a strategic location in the configuration.yaml code? A lot to ask, but if someone has got there Energenie Sockets working could they share more details with me? Kind regards