Xiaomi Aqara 2 Channels Smart Home Wireless Relay Two-way Control Module

This product is new from Xiaomi. It must work with gateway using zigbee protocol, but this device is not supported by Xiaomi bonding.How can I connect it with openhab?

It works with Zigbee binding: https://www.openhab.org/addons/bindings/zigbee/

Be careful, on some of these devices the hardware switch connections S1 and S2 are switched.


Thank you for replying.
I don’t understand what you mean here.Do you mean that there is difference between switching the device physically or from the App?

The device has some physical inputs where you connect the wires. In my case (and for some others too), the input which is labeled “S1” on the case of the device actually is “S2” (and vice versa).

Okay :smile:
Thank you very much

Hi Martin,

What I have to do so it start working with zigbee ? Do I have to buy some zigbee receiver ? Or can I use xiaomi gateway with it ?

Hi, you can use a proprietary gateway (like xiaomi gatway or tradfri), but I am not familiar with this.
The other solution is to use the openhab zigbee binding. The explanation in openhab documentation is very detailed: https://www.openhab.org/addons/bindings/zigbee/

Basically you need a coordinator (~zigbee receiver) for you zigbee network (have a look at the documentation section “Suppported Coordinators”). This is more or less a USB stick for your openhab machine.

1 Like

Hi Martin,
USB zigbee arrived > flashed by firmware but still how to use and add item?
I need advice how to setup item in openhab. I have already added my new device LLKZMK11LM (supported), but i have no clue how to define item switch to turn it ON or OFF or getting power value. this is what i see in log:
Nov 20 21:24:34 openhab npm[18254]: zigbee2mqtt:info 2019-11-20T20:24:34: MQTT publish: topic ‘zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen’, payload ‘{“power”:39.43,“consumption”:0.06,“temperature”:40,“linkquality”:39,“state_l1”:“ON”,“state_l2”:“OFF”}’

Please help.

I’m sorry but I can’t help you with zigbee2mqtt. I have no experience in connecting zigbee/Openhab like this. But there should be plenty of examples around?

So at the end i have figured out what to do:

I am using newest openhabian 2.5 image (which is broken and java has to be fixed manually during install … that is shame)

  1. install and configure mosquito
  2. install and configure zigbee2mqtt
  3. flash FW on your cc2531 ordered from Aliexpress for 5euro solder 4 wire to your RPI and flash it via RPI if you forgot to order Debuger :slight_smile: (possible to flash with Debuger kit and Windows PC easy way but cost more)
  4. install mqtt binding in OH 2.5
  5. manually create mqtt Broker thing (localhost)
  6. open zigbee2mqtt logs
sudo journalctl -u zigbee2mqtt.service -f
     reset your Xiaomi Relay Switch until you see it joined your 
     zigbee2mqtt  (from now it will anly be accessible via OH and 
     dissapear from Mi Home)
  1. open zigbee2mqtt config and rename device to some friendly name
nano /opt/zigbee2mqtt/data/configuration.yaml
    Restart service to apply
sudo systemctl restart zigbee2mqtt.service
    Check Status of zigbee2mqtt service
sudo systemctl status zigbee2mqtt.service
  1. manually create generic mqtt Thing in paper UI (just select Broker Bridge Selection there should be only one)
    add Channel to it (every channel will be one function of the relay):
  2. add channel
  3. Channel type: On/Off switch
  4. Channel id: xiaomirelayswitch1switch1
  5. MQTT state topic: zigbee2mqtt/

my friendly name is: XiaomiAqaraRelaySwitchKitchen
so my MQTT state topic is: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen

  1. MQTT command topic: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen/l1/set
  2. SHOW MORE >
  3. Incoming value transformation: JSONPATH:$.state_l1
  4. Retained ON
  5. Do not change anything else and SAVE

Add Channel type: On/Off switch
MQTT state topic: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen
MQTT command topic: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen/l2/set
Incoming value transformation: JSONPATH:$.state_l2
Retained ON

Add Channel type number:
MQTT state topic: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen
Incoming value transformation: JSONPATH:$.power
Do not change anything else and SAVE

Add Channel type number:
MQTT state topic: zigbee2mqtt/XiaomiAqaraRelaySwitchKitchen
Incoming value transformation: JSONPATH:$.consumption
Do not change anything else and SAVE

now link every channel to appropriate item (switch to switch and number to text :slight_smile:

maybe this will help someone lost as i am:)
PS: zigbee binding is not needed at all with this method

1 Like

Wow Peter THANK YOU SO MUCH! that was EXACTELY what I needed and your great tutorial worked out o fthe box. As I never worked with mqtt, I would have never figured out the JSON transformation part :thinking::hugs:

1 Like

It works as mihome:ctrl_ln2.