Energenie MiHome component

I can’t test this, none of my devices accept 2 parameters. I think this would be the curl command:

curl -u "<YOURUSERNAME>:<YOURPASSWORD>" -X POST -H "Content-Type: application/json" -d "{\"id\":54321, \"temperature\":25.0}" https://mihome4u.co.uk/api/v1/subdevices/set_target_temperature

If I have that correct it would set the device with id 54321 to 25.0 degrees. It looks slightly more complicated because of the escape character \ when quotes are needed.

It maybe that the Rest component would be easier to use than the command line, don’t think that was available when I first did this.

Thanks Steve

Will test this tomorrow

Paul

Thanks for your help

HiSteve

Happy new year to you

The code worked

just have to change the temperature part of the code to a slider or selection text now

Once again thanks for your help

Paul

Hi,

I’m new to Home assistant and the Pi for that matter, in layman’s terms, could you explain how I add your mqtt client to Home Assistant so I can control my energenie light switches etc?

Cheers,

Lance.

Does this require a pimote?

It isn’t really a layman’s tool, but in summary

  1. You need to buy the two way pi-mote and a rasperry pi 1. A pi 3 or 3+ may work, but I haven’t tried it. I suspect it would require some modification, at least to the included header files.
  2. You need to download, compile and run my client
  3. You need to install an MQTT broker ( although I suppose the embedded broker would work, at least to start).
  4. You need to configure switches in HA with the appropriate MQTT commands.

There is nothing complex if you know have some experience with software development, but I think it would be difficult without some background knowledge.

Mind blown already! :open_mouth:

Hi Lance
I have three energie single pole switches so far and an ERTV valve

First think I did was download the mi home app and start to power them on and off with the remote or from the web

that will vive you a basic idea of how they work especially if you look at the URL and the device ID’s

Second read this full thread Especially the posts from stevehorner as they are 100% spot on

writing them into your config file will make the switch work

Paul

@paullayton Please you got it working. How are you finding the eTRVs, I have been considering them for more than a year but not really sure what I would gain in conjunction with my Nest.

Something for anyone else reading this thread who is thinking of using their light switches, they do work but if you only have one you will need dimmable bulbs if using LEDs otherwise the bulbs will flicker constantly. I removed one of my 2 light switches when renovating the kitchen which then caused the non dimmable bulb in our bedroom to flicker not the best light to have this happen to when trying to sleep. Switched to dimmable LED bulbs and not a problem anymore, this is stated now when you buy them but wasn’t when I got mine. The biggest issue with the light switches and the sockets is not knowing it’s current state, they can easily get out of sync if someone turns it on in Home Assistant but off at the wall. The monitoring socket does report it’s status which could update Home Assistant.

Hi Steve

I only have 1 ETRV in the Bedroom, and it does work well, but I don’t have Hive or anything else set up yet, so the vales are turned up or down at the moment with Alexa

In regards to the LED Bulbs, I have the same problem, I installed miniature LED Spot Lights in the stair Risers that are controlled by MI, and they do flicker when switched off, I don’t have the same problem with normal bulbs, but as you said they tend to lose sync with home assistant especially if you turn them on at the switch. the APP reports correctly but HA doesn’t always report back the true state

The switches in my opinion are good, as is the ETRV but still looking at a system, or a means that will report states back, Unless I can use the API to report back on a regular basis through automation to get the correct state

One again Steve thanks for your help

p.s Still struggling to put the temperature in the example you gave me and change it to use a slider.state :smile:

Paul

I managed to get my MiHome light switches working using the command line script that Steve posted.

But would still like to be able to control my energenie stuff locally without the need of an internet connection!

Thanks for posting Steve, most helpful!

I had issues with the energenie hub stopping working for no reason. Even their tech support couldn’t find the problem.

I was using an arduino mega with 433mhz transceiver and rflink firmware for over a year with no issues.

I’ve recently changed to an esp8266 and openmqttgateway. This has been working fine the rflink option is the simplest.

I ran the update of hassio to 0.86.3 this morning and now my light switches appear to have no entities! :frowning:

I shall have to look and see what has changed!

Ok, this evening I rolled back my install using a snapshot I did of my install at version 0.85.1 and all was well, I then updated it to 0.86.3 and it’s still working properly!

Hey All, really interested in this topic. I’ve been looking at the Energenie TRV’s and thinking of using the Sonoff RF Bridge in order to read the signals and send commands. Has anyone had any luck in integrating these using only the TRV & a Sonoff RF Bridge?

If so, could you also post an example of the packet that the devices send?

I am fairly sure this will not work. The eTRVs use FSK encoding which I am pretty sure is not supported by the Sonoff RF Bridge.

I use a Mihome ERTV and I can read the values as per the recommendations in this thread

I have the current temperature and the voltage of the valve recorded, and don’t use the sonoff bridge

You get the values from the energenie web api?

Yes

Code below

I havnt worked out yet how to add a slider to change the temperature

Credits stevehorner above for the code

sensor:

  - platform: command_line
    command: 'curl -u "email:password" -X POST -H "Content-Type: application/json" -d "{\"id\":146015}" https://mihome4u.co.uk/api/v1/subdevices/show'
    name: mbs_radiator
    unit_of_measurement: °C
    value_template: '{{ value_json.data.last_temperature }}'

  - platform: command_line
    command: 'curl -u "email:password" -X POST -H "Content-Type: application/json" -d "{\"id\":146015}" https://mihome4u.co.uk/api/v1/subdevices/show'
    name: mbs_targettemp
    unit_of_measurement: °C
    value_template: '{{ value_json.data.target_temperature }}'

  - platform: command_line
    command: 'curl -u "email:password" -X POST -H "Content-Type: application/json" -d "{\"id\":146015}" https://mihome4u.co.uk/api/v1/subdevices/show'
    name: mbs_voltage
    unit_of_measurement: v
    value_template: '{{ value_json.data.voltage }}'

This Code Steve gave me to set the target temperature to 25c

I have been trying to learn yaml and put the code in for a slider but cant seem to get the hang of it
the code in a sensor does change the target temp

once again credit stevehorner

curl -u "YOURUSERNAME;:YOURPASSWORD" -X POST -H "Content-Type: application/json" -d "{\"id\":146015, \"temperature\":25.0}" https://mihome4u.co.uk/api/v1/subdevices/set_target_temperature

if you or Stevehorner (hint hint) can help with this part so I can see what I am doing wrong I would be most grateful