Energenie MiHome API help

Hi - did this get finished in the OH2.2 release ?

Thanks

Paul

Hi, I have just bought a energenie mihome gateway and power clamp on monitor.
I’m interested in getting the readings into my Linux mint sysytem and myswl database.
I see you have developed a binding for openhab which I haven’t used yet.
Would be pleased of any help you can give.
Im familure with basic c ++ etc.
Thanks

Hello Everyone! Please could someone tell me the add-on software, etc for Energine OpenHAB 2 because I can’t seem to get it to work with V2 :slight_smile:

Thanks

It doesn’t seem like any of the attempts at a binding for Energenie MiHome devices have been merged yet, despite positive comments, the latest one went stale and had another naming collision with other bindings.

You could try pulling the code in the PR, updating the naming, compiling it yourself and plugging the jar/kar file into your existing setup, but it’s a fairly involved process, and I’m not sure the original author has been active recently so you might not get much support there.

The binding contributions integrate using the energenie api, which is documented here. The api doesn’t appear to provide a way to stream updates from the sensors, so the binding appears to rely on polling, which might not be great if you want timely actions e.g. the requirement “motion sensor turns on a light switch” might be delayed by the length of the polling cycle. It also results in multiple messages going up and down to the cloud and being dependent on connectivity. The example would result in the following flow:
motion sensor detects motion -> gateway receives alert, forwards to cloud -> cloud receives alert -> binding polls cloud, receives alert -> binding triggers switch -> sends switch update to cloud -> cloud sends update to gateway -> gateway sends update to switch

It’d be great if the gateway device offered a local api, but it doesn’t appear to. (There are other manufacturers which use the brands “Energenie” and “MiHome”, which doesn’t help finding information about integrating this product.)

I’ve gone down a different path to integrate my Energenie MiHome devices. I replaced the gateway with a two way pi mote, which plugs into the GPIO ports on my raspberry pi. There are two types of Energenie devices, some which only receive commands using OOK (light/plug switches), others which can transmit and receive using FSK (sensors etc)
 This can handle both, but if you only want to transmit to the receive only devices you can use https://energenie4u.co.uk/catalogue/product/ENER314.

I installed https://github.com/webash/pyenergenie-mqtt/, which builds on https://github.com/whaleygeek/pyenergenie, and can both publish messages from sensor to mqtt, and subscribe to messages from mqtt and send them onto engergenie devices. I had to recompile the C code to make it work on a raspberry pi (src/energenie/drv/build_rpi), and tweak the python to work with the OOK devices (https://github.com/webash/pyenergenie-mqtt/pull/3). Follow the readme to configure your devices and tweak the python script to connect to your MQTT and publish/subscribe to appropriate topics.

If you haven’t got MQTT setup then you’ll also need to install something like mosquitto on your pi, and the MQTT binding to OpenHAB. You then need setup some items & channels mapping to the names you configured in pyenergenie to bring it all together.

This has the advantage that all the connections are local, and there is no polling of sensor status, all the changes propagate through the system as events. I’ve currently got a motion sensor linked up to a light switch, which toggles in a fairly timely manner, and now that control is within openHAB I can use the astro binding so the light is only turned on at night-time.

James

1 Like