Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push server instructions #21309

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 74 additions & 44 deletions source/_integrations/xiaomi_miio.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Some gateways (lumi.gateway.mieu01) do not support getting the connected subdevi

### Gateway Features

- Gateway alarm control (Turn on/off; see status `armed_away`, `disarmed`, `arming`)
- Gateway alarm control (Turn on/off; see status `armed_away`, `disarmed`, `arming`, status `triggering` (push instead of poll))
- Gateway light control (Turn on/off; change brightness; change color; see status)
- Gateway illuminance sensor readout (illuminance value in lux)

Expand All @@ -101,59 +101,89 @@ Not yet implemented features (but possible):

### Supported subdevices

These subdevices are fully implemented in HomeAssistant:

| Subdevice name | Zigbee id | model | features |
| -------------------------------- | ----------------------- | --------------- | ------------------------------------------------ |
| Weather sensor | lumi.sensor_ht | WSDCGQ01LM | readout `temperature` and `humidity` |
| Weather sensor | lumi.weather.v1 | WSDCGQ11LM | readout `temperature`, `humidity` and `pressure` |
| Wall switch single | lumi.ctrl_ln1 | QBKG11LM | load_power, status, turn_on, turn_off, toggle |
| Wall switch single | lumi.ctrl_ln1.aq1 | QBKG11LM | load_power, status, turn_on, turn_off, toggle |
| Wall switch no neutral | lumi.ctrl_neutral1.v1 | QBKG04LM | status, turn_on, turn_off, toggle |
| Wall switch double | lumi.ctrl_ln2 | QBKG12LM | load_power, status, turn_on, turn_off, toggle |
| Wall switch double | lumi.ctrl_ln2.aq1 | QBKG12LM | load_power, status, turn_on, turn_off, toggle |
| Wall switch double no neutral | lumi.ctrl_neutral2 | QBKG03LM | status, turn_on, turn_off, toggle |
| D1 wall switch triple | lumi.switch.n3acn3 | QBKG26LM | load_power, status, turn_on, turn_off, toggle |
| D1 wall switch triple no neutral | lumi.switch.l3acn3 | QBKG25LM | load_power, status, turn_on, turn_off, toggle |
| Wall outlet | lumi.ctrl_86plug.v1 | QBCZ11LM | status, turn_on, turn_off, toggle |
| Wall outlet | lumi.ctrl_86plug.aq1 | QBCZ11LM | load_power, status, turn_on, turn_off, toggle |
| Plug | lumi.plug | ZNCZ02LM | load_power, status, turn_on, turn_off, toggle |
| Relay | lumi.relay.c2acn01 | LLKZMK11LM | load_power, status, turn_on, turn_off, toggle |
| Smart bulb E27 | lumi.light.aqcn02 | ZNLDP12LM | on/off, brightness, color temperature |
| IKEA smart bulb E27 white | ikea.light.led1545g12 | LED1545G12 | on/off, brightness, color temperature |
| IKEA smart bulb E27 white | ikea.light.led1546g12 | LED1546G12 | on/off, brightness, color temperature |
| IKEA smart bulb E12 white | ikea.light.led1536g5 | LED1536G5 | on/off, brightness, color temperature |
| IKEA smart bulb GU10 white | ikea.light.led1537r6 | LED1537R6 | on/off, brightness, color temperature |
| IKEA smart bulb E27 white | ikea.light.led1623g12 | LED1623G12 | on/off, brightness, color temperature |
| IKEA smart bulb GU10 white | ikea.light.led1650r5 | LED1650R5 | on/off, brightness, color temperature |
| IKEA smart bulb E12 white | ikea.light.led1649c5 | LED1649C5 | on/off, brightness, color temperature |
These subdevices are fully implemented in Home Assistant:

| Subdevice name | Zigbee id | model | features | push events |
| -------------------------------- | ----------------------- | --------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Weather sensor | lumi.sensor_ht | WSDCGQ01LM | readout `temperature` and `humidity` | |
| Weather sensor | lumi.weather.v1 | WSDCGQ11LM | readout `temperature`, `humidity` and `pressure` | |
| Wall switch single | lumi.ctrl_ln1 | QBKG11LM | load_power, status, turn_on, turn_off, toggle | |
| Wall switch single | lumi.ctrl_ln1.aq1 | QBKG11LM | load_power, status, turn_on, turn_off, toggle | |
| Wall switch no neutral | lumi.ctrl_neutral1.v1 | QBKG04LM | status, turn_on, turn_off, toggle | |
| Wall switch double | lumi.ctrl_ln2 | QBKG12LM | load_power, status, turn_on, turn_off, toggle | |
| Wall switch double | lumi.ctrl_ln2.aq1 | QBKG12LM | load_power, status, turn_on, turn_off, toggle | |
| Wall switch double no neutral | lumi.ctrl_neutral2 | QBKG03LM | status, turn_on, turn_off, toggle | |
| D1 wall switch triple | lumi.switch.n3acn3 | QBKG26LM | load_power, status, turn_on, turn_off, toggle | |
| D1 wall switch triple no neutral | lumi.switch.l3acn3 | QBKG25LM | load_power, status, turn_on, turn_off, toggle | |
| Wall outlet | lumi.ctrl_86plug.v1 | QBCZ11LM | status, turn_on, turn_off, toggle | |
| Wall outlet | lumi.ctrl_86plug.aq1 | QBCZ11LM | load_power, status, turn_on, turn_off, toggle | |
| Plug | lumi.plug | ZNCZ02LM | load_power, status, turn_on, turn_off, toggle | |
| Relay | lumi.relay.c2acn01 | LLKZMK11LM | load_power, status, turn_on, turn_off, toggle | |
| Smart bulb E27 | lumi.light.aqcn02 | ZNLDP12LM | on/off, brightness, color temperature | |
| IKEA smart bulb E27 white | ikea.light.led1545g12 | LED1545G12 | on/off, brightness, color temperature | |
| IKEA smart bulb E27 white | ikea.light.led1546g12 | LED1546G12 | on/off, brightness, color temperature | |
| IKEA smart bulb E12 white | ikea.light.led1536g5 | LED1536G5 | on/off, brightness, color temperature | |
| IKEA smart bulb GU10 white | ikea.light.led1537r6 | LED1537R6 | on/off, brightness, color temperature | |
| IKEA smart bulb E27 white | ikea.light.led1623g12 | LED1623G12 | on/off, brightness, color temperature | |
| IKEA smart bulb GU10 white | ikea.light.led1650r5 | LED1650R5 | on/off, brightness, color temperature | |
| IKEA smart bulb E12 white | ikea.light.led1649c5 | LED1649C5 | on/off, brightness, color temperature | |
| Door sensor | lumi.sensor_magnet.v2 | MCCGQ01LM | is_open | xiaomi_miio.Magnet open/close |
| Door sensor | lumi.sensor_magnet.aq2 | MCCGQ11LM | is_open | xiaomi_miio.Magnet open/close |
| Motion sensor | lumi.sensor_motion.v2 | RTCGQ01LM | motion | xiaomi_miio.Motion motion/no_motion |
| Motion sensor | lumi.sensor_motion.aq2 | RTCGQ11LM | motion | xiaomi_miio.Motion motion/no_motion |
| Cube | lumi.sensor_cube.v1 | MFKZQ01LM | last_event | xiaomi_miio.Cube move/flip90/flip180/taptap/shakeair/rotate |
| Cube | lumi.sensor_cube.aqgl01 | MFKZQ01LM | last_event | xiaomi_miio.Cube move/flip90/flip180/taptap/shakeair/rotate |
| Vibration sensor | lumi.vibration.aq1 | DJT11LM | last_event | xiaomi_miio.VibrationSensor vibrate/tilt/free_fall |
| Button | lumi.sensor_switch.v2 | WXKG01LM | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| Button | lumi.sensor_switch.aq2 | WXKG11LM 2015 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| Button | lumi.sensor_switch.aq3 | WXKG12LM | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0/l_click_press/shake |
| Button | lumi.remote.b1acn01 | WXKG11LM 2018 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| Remote switch single | lumi.sensor_86sw1.v1 | WXKG03LM 2016 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| Remote switch single | lumi.remote.b186acn01 | WXKG03LM 2018 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| D1 remote switch single | lumi.remote.b186acn02 | WXKG06LM | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0 |
| Remote switch double | lumi.sensor_86sw2.v1 | WXKG02LM 2016 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0/l_click_ch1/click_ch1/d_click_ch1/both_l_click/both_click/both_d_click |
| Remote switch double | lumi.remote.b286acn01 | WXKG02LM 2018 | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0/l_click_ch1/click_ch1/d_click_ch1/both_l_click/both_click/both_d_click |
| D1 remote switch double | lumi.remote.b286acn02 | WXKG07LM | last_press | xiaomi_miio.RemoteSwitch l_click_ch0/click_ch0/d_click_ch0/l_click_ch1/click_ch1/d_click_ch1/both_l_click/both_click/both_d_click |

The push events can be observed by going to the `Developer Tools` in the sidebar of Home Assistant --> `EVENTS` --> `Listen to events`, then fill in eather `*` or one of the specific events listed in the table above, for example `xiaomi_miio.Magnet`.
The events will have a event_type as specifyed in the table above and will include as data the `entity_id` that caused the event, the `action` as listed above in the table and possibly aditional parameters.
A example of such a event is:
```yaml
{
"event_type": "xiaomi_miio.RemoteSwitch",
"data": {
"entity_id": "sensor.last_press_lumi_button",
"action": "click_ch0",
"params": []
},
"origin": "LOCAL",
"time_fired": "2022-01-01T12:00:00.000000+00:00",
"context": {
"id": "123456789abcdefghijklmnopqrstuvw",
"parent_id": null,
"user_id": null
}
}
```
This event can be used as a trigger in a automation, for example:
```yaml
trigger:
- platform: event
event_type: xiaomi_miio.RemoteSwitch
event_data:
entity_id: sensor.last_press_lumi_button
action: click_ch0
```

### Recognized subdevices (not yet implemented)

These subdevices are recognized by the python-miio code but are still being worked on (not yet implemented).

| Subdevice name | Zigbee id | model |
| -------------------------------- | ----------------------- | --------------- |
| Button | lumi.sensor_switch | WXKG01LM |
| Button | lumi.sensor_switch.aq2 | WXKG11LM 2015 |
| Button | lumi.sensor_switch.aq3 | WXKG12LM |
| Button | lumi.remote.b1acn01 | WXKG11LM 2018 |
| Cube | lumi.sensor_cube.v1 | MFKZQ01LM |
| Cube | lumi.sensor_cube.aqgl01 | MFKZQ01LM |
| Motion sensor | lumi.sensor_motion | RTCGQ01LM |
| Motion sensor | lumi.sensor_motion.aq2 | RTCGQ11LM |
| Door sensor | lumi.sensor_magnet | MCCGQ01LM |
| Door sensor | lumi.sensor_magnet.aq2 | MCCGQ11LM |
| Vibration sensor | lumi.vibration.aq1 | DJT11LM |
| Honeywell smoke detector | lumi.sensor_smoke | JTYJ-GD-01LM/BW |
| Honeywell natural gas detector | lumi.sensor_natgas | JTQJ-BF-01LM/BW |
| Water leak sensor | lumi.sensor_wleak.aq1 | SJCGQ11LM |
| Remote switch single | lumi.sensor_86sw1.v1 | WXKG03LM 2016 |
| Remote switch single | lumi.remote.b186acn01 | WXKG03LM 2018 |
| D1 remote switch single | lumi.remote.b186acn02 | WXKG06LM |
| Remote switch double | lumi.sensor_86sw2.v1 | WXKG02LM 2016 |
| Remote switch double | lumi.remote.b286acn01 | WXKG02LM 2018 |
| D1 remote switch double | lumi.remote.b286acn02 | WXKG07LM |
| Curtain | lumi.curtain | ZNCLDJ11LM |
| Curtain | lumi.curtain.aq2 | ZNGZDJ11LM |
| Curtain B1 | lumi.curtain.hagl04 | ZNCLDJ12LM |
Expand Down