To contribute to this page, edit the following file

Xiaomi QBKG12LM

Model QBKG12LM
Vendor Xiaomi
Description Aqara double key wired wall switch
Supports on/off, power measurement
Picture Xiaomi QBKG12LM

Notes

Pairing

Press and hold the button on the device for +- 10 seconds (until the blue light starts blinking and stops blinking), release and wait.

Decoupled mode

Decoupled mode allows to turn wired switch into wireless button with separately controlled relay. This might be useful to assign some custom actions to buttons and control relay remotely. This command also allows to redefine which button controls which relay for the double switch.

Special topics should be used: zigbee2mqtt/[FRIENDLY_NAME]/set to modify operation mode.

Payload:

{
  "operation_mode": {
    "button": "single"|"left"|"right",
    "state": "VALUE"
  }
}
Values Description
control_relay Button directly controls relay (for single switch)
control_left_relay Button directly controls left relay (for double switch)
control_right_relay Button directly controls right relay (for double switch)
decoupled Button doesn’t control any relay

zigbee2mqtt/[FRIENDLY_NAME]/get to read current mode.

Payload:

{
  "operation_mode": {
    "button": "single"|"left"|"right"
  }
}

Response will be sent to zigbee2mqtt/[FRIENDLY_NAME]:

{"operation_mode_right":"control_right_relay"}

Manual Home Assistant configuration

Although Home Assistant integration through MQTT discovery is preferred, manual integration is possbile with the following configuration:

switch:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_off: "OFF"
    payload_on: "ON"
    value_template: "{{ value_json.state_left }}"
    command_topic: "zigbee2mqtt/<FRIENDLY_NAME>/left/set"

switch:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_off: "OFF"
    payload_on: "ON"
    value_template: "{{ value_json.state_right }}"
    command_topic: "zigbee2mqtt/<FRIENDLY_NAME>/right/set"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "W"
    icon: "mdi:factory"
    value_template: "{{ value_json.power }}"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    icon: "mdi:toggle-switch"
    value_template: "{{ value_json.click }}"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "-"
    value_template: "{{ value_json.linkquality }}"