Energenie MiHome component

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


@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:


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?


Code below

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

Credits stevehorner above for the code


  - 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

Thanks gpbento, that helps me a lot. Would you say that the Pi-Mote is a good way to go instead of RF Bridge or Mi Home Gateway? Im looking for local control which doesn’t need too much maintenance once its set up.

I took look at your code and it looks really good - posted a few years ago now, so I assume its fairly stable? Could it be ran on the same Pi as HASS.io? or does it need a separate one? Would it work on a Pi Zero?

Sorry for all the questions :smiley:

The Pi-Mote is a good way to go if you have a reasonable knowledge of c code. It is not really for the beginner. There is an alternative approach in Python on github here, but I don’t think it is quite stable yet.

I don’t know of any generic RFBridge that uses the same protocol as the energenie eTRVs. The sockets and plugs and light switches all work, but
they use a more common protocol.

I have never used the Mi Home Gateway, but I understand you have to connect it to the internet, so it is not acceptable for me.

It runs all the time on my Pi, and I haven’t felt the need to tweak it for a couple of years.

I don’t think so. I understand you need to write an addon for that, and I have had no interest in doing so. I currently run homeassistant in a venv on the same Pi.

I have also only ever run the code on a Pi 1 B+. I think it would need to link with different libraries to run on a Pi 2 or 3… I’m not sure about the zero, I can’t remember exactly what the processor is, but it should be possible to do.

Wonder if anyone can help me out, I have a number of Energenie Mi|Home switches and sockets and though I have managed to use the API to send the on/off commands I am struggling to get the current state … below is an example of my code;

Energenie Mi|Home Integration


Now the on/off works … but I get the following error in the logs for getting the current state;

2019-02-11 09:26:50 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: None, template: {{ value_json.data.power_state == 1 }})

Anyone able to shed some light on this ?

It looks like the options for RF control from HASS on a Pi 3 (via venv) are a Pi-mote vs an RFLink arduino kit with pre-soldering from Nodo Shop. I have some questions please:

Using @gpbenton 's engMQTTClient, how do you find the IDs of the devices? Do the Energenie light switches have OpenThing IDs printed on them somewhere?

Will the Pi-mote work with other (non-Energenie) 433mhz devices? e.g. these: https://www.ebay.co.uk/itm/Wireless-Remote-Control-Kinetic-Self-powered-No-Battery-Wall-Light-Smart-Switch/382652254199?hash=item5917da07f7:m:m-Pl97IT0CL-nGCU2cckqMA&frcectupt=true
If so, is there a UI in HASS to find the switch’s ID? I hear there’s a lot of background 433 traffic in UK cities.

Same questions for the RFLink setup - can you use HASS to find the IDs of the Energenie switches and kinetic switches?

Thanks :slight_smile:

The energenie devices work on two different protocols. The switches and sockets are receive only and use a standard 433MHz protocol. These can be used with most 433MHz decode/encode diy kits, including RFLink and OpenMQTTGateway. This is not the OpenThings protocol.

Other Energenie devices are two way, such as the eTRVs and Energy Montoring devices. These use the OpenThings protocol and FSK modulation, and are not controllable with normal 433MHz controllers.

My engMQTTClient spends most of its time listening for OpenThings messages using FSK encoding, but switches to OOK when it receives an MQTT message to send a signal to a switch, so effectively works with both.

I do use some Sensoo light switches I got from AliExpress with the PiMote, but I was surprised they worked, and can make no guarantees about any other 433MHz devices. There are sublte differences about the way each of them works.

As explained above, the light switches are receive only and do not use OpenThings and so do not have an ID. The devices using Openthings broadcast periodically with their ID and this is received by engMQTTClient and sent over MQTT. The MQTT topic contains the OpenThings ID.
You program the light switches (I assume, I don’t have any Energenie Light Switches) like most 433MHz switches by holding down a button for a few seconds until an LED flashes, and then sending a signal to it from a remote (or PiMote).

1 Like

Thanks very much for the explanation!

Ah thanks, I didn’t know that. So if using a PiMote from software you can effectively just send ‘any code’ and as long as it’s the first code the switch receives it stores it? Is there a HASS UI for that? If not what tools do you use? How does programming work if there’s a lot of background 433mhz traffic in a city environment?

Do you send signals to those using engMQTTClient too?