mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-08 09:56:52 +00:00
Add Xiaomi docs for platforms (#3045)
* Add Xiaomi docs for platforms * Add service details * Add Aqara Wireless Switch * Escape templates * Update 'ha_iot_class'
This commit is contained in:
parent
c753de1f4e
commit
ebd6648b0b
@ -1,20 +1,25 @@
|
|||||||
---
|
---
|
||||||
layout: page
|
layout: page
|
||||||
title: "Xiaomi Binary sensors”
|
title: "Xiaomi Binary Sensor"
|
||||||
description: "Instructions how to integrate your Xiaomi Binary sensors within Home Assistant."
|
description: "Instructions how to setup the Xiaomi binary sensors within Home Assistant."
|
||||||
date: 2017-07-21 16:34
|
date: 2017-07-21 16:34
|
||||||
sidebar: true
|
sidebar: true
|
||||||
comments: false
|
comments: false
|
||||||
sharing: true
|
sharing: true
|
||||||
footer: true
|
footer: true
|
||||||
logo: xiaomi.png
|
logo: xiaomi.png
|
||||||
ha_category: Binary sensor
|
ha_category: Binary Sensor
|
||||||
ha_release: "0.50"
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
---
|
---
|
||||||
|
|
||||||
To get your Xiaomi binary sensors working with Home Assistant, follow the instructions for the general [Xiaomi Gateway component](/components/xiaomi/)
|
|
||||||
|
|
||||||
### Type of sensors supported:
|
The `xiaomi` binary sensor platform allows you to get data from your [Xiaomi](http://www.mi.com/en/) binary sensors.
|
||||||
|
|
||||||
|
The requirement is that you have setup the [`xiaomi` component](/components/xiaomi/).
|
||||||
|
|
||||||
|
|
||||||
|
### {% linkable_title Type of sensors supported %}
|
||||||
- Motion
|
- Motion
|
||||||
- Door / Window
|
- Door / Window
|
||||||
- Smoke
|
- Smoke
|
||||||
@ -22,214 +27,268 @@ To get your Xiaomi binary sensors working with Home Assistant, follow the instru
|
|||||||
- Xiaomi Wireless Button
|
- Xiaomi Wireless Button
|
||||||
- Xiaomi Cube
|
- Xiaomi Cube
|
||||||
|
|
||||||
### Some automation examples to get you started:
|
### {% linkable_title Automation examples %}
|
||||||
- Motion
|
|
||||||
|
#### {% linkable_title Motion %}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Trigger for motion sensor
|
- alias: If there is motion and its dark turn on the gateway light
|
||||||
|
trigger:
|
||||||
- alias: If there is motion and its dark turn on the gateway light
|
platform: state
|
||||||
trigger:
|
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
|
||||||
platform: state
|
from: 'off'
|
||||||
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
|
to: 'on'
|
||||||
from: 'off'
|
condition:
|
||||||
to: 'on'
|
condition: numeric_state
|
||||||
condition:
|
entity_id: sensor.illumination_34ce00xxxx11
|
||||||
condition: numeric_state
|
below: 300
|
||||||
entity_id: sensor.illumination_34ce00xxxx11
|
action:
|
||||||
below: 300
|
service: light.turn_on
|
||||||
action:
|
entity_id: light.gateway_light_34ce00xxxx11
|
||||||
service: light.turn_on
|
data:
|
||||||
entity_id: light.gateway_light_34ce00xxxx11
|
brightness: 5
|
||||||
data:
|
- alias: If there no motion for 5 minutes turn off the gateway light
|
||||||
brightness: 5
|
trigger:
|
||||||
|
platform: state
|
||||||
- alias: If there no motion for 5 minutes turn off the gateway light
|
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
|
||||||
trigger:
|
from: 'on'
|
||||||
platform: state
|
to: 'off'
|
||||||
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
|
for:
|
||||||
from: 'on'
|
minutes: 5
|
||||||
to: 'off'
|
action:
|
||||||
for:
|
service: light.turn_off
|
||||||
minutes: 5
|
entity_id: light.gateway_light_34ce00xxxx11
|
||||||
action:
|
|
||||||
service: light.turn_off
|
|
||||||
entity_id: light.gateway_light_34ce00xxxx11
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Door / Window
|
#### {% linkable_title Door and/or Window %}
|
||||||
```yaml
|
|
||||||
# Trigger for door window sensor
|
|
||||||
|
|
||||||
- alias: If the window is open turn off the radiator
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
|
|
||||||
from: 'off'
|
|
||||||
to: 'on'
|
|
||||||
action:
|
|
||||||
service: climate.set_operation_mode
|
|
||||||
entity_id: climate.livingroom
|
|
||||||
data:
|
|
||||||
operation_mode: 'Off'
|
|
||||||
|
|
||||||
- alias: If the window is closed for 5 minutes turn on the radiator again
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
|
|
||||||
from: 'on'
|
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 5
|
|
||||||
action:
|
|
||||||
service: climate.set_operation_mode
|
|
||||||
entity_id: climate.livingroom
|
|
||||||
data:
|
|
||||||
operation_mode: 'Smart schedule'
|
|
||||||
```
|
|
||||||
- Smoke
|
|
||||||
```yaml
|
|
||||||
# Trigger for smoke sensor
|
|
||||||
|
|
||||||
- alias: Send notification on fire alarm
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.smoke_sensor_158d0001574899
|
|
||||||
from: 'off'
|
|
||||||
to: 'on'
|
|
||||||
action:
|
|
||||||
- service: notify.html5
|
|
||||||
data:
|
|
||||||
title: Fire alarm!
|
|
||||||
message: Fire/Smoke detected!
|
|
||||||
- service: xiaomi.play_ringtone
|
|
||||||
data:
|
|
||||||
gw_mac: xxxxxxxxxxxx
|
|
||||||
ringtone_id: 2
|
|
||||||
ringtone_vol: 100
|
|
||||||
```
|
|
||||||
- Gas
|
|
||||||
```yaml
|
```yaml
|
||||||
# Trigger for natgas detected
|
- alias: If the window is open turn off the radiator
|
||||||
|
trigger:
|
||||||
- alias: Send notification on gas alarm
|
platform: state
|
||||||
trigger:
|
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
|
||||||
platform: state
|
from: 'off'
|
||||||
entity_id: binary_sensor.natgas_sensor_158dxxxxxxxxxx
|
to: 'on'
|
||||||
from: 'off'
|
action:
|
||||||
to: 'on'
|
service: climate.set_operation_mode
|
||||||
action:
|
entity_id: climate.livingroom
|
||||||
- service: notify.html5
|
data:
|
||||||
data_template:
|
operation_mode: 'Off'
|
||||||
title: Gas alarm!
|
- alias: If the window is closed for 5 minutes turn on the radiator again
|
||||||
message: 'Gas with a density of {{ states.binary_sensor.natgas_sensor_158dxxxxxxxxxx.attributes.density }} detected.'
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
|
||||||
|
from: 'on'
|
||||||
|
to: 'off'
|
||||||
|
for:
|
||||||
|
minutes: 5
|
||||||
|
action:
|
||||||
|
service: climate.set_operation_mode
|
||||||
|
entity_id: climate.livingroom
|
||||||
|
data:
|
||||||
|
operation_mode: 'Smart schedule'
|
||||||
```
|
```
|
||||||
- Xiaomi Wireless Button (available events are `single`, `double`, `hold`, `long_click_press` and `long_click_release`). For Square version (Aqara brand) only `single` and `double` events are supported. Furthermore the space between two clicks to generate a double click must be quite large now
|
|
||||||
|
#### {% linkable_title Smoke %}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Trigger for the wireless button with different click types
|
- alias: Send notification on fire alarm
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: binary_sensor.smoke_sensor_158d0001574899
|
||||||
|
from: 'off'
|
||||||
|
to: 'on'
|
||||||
|
action:
|
||||||
|
- service: notify.html5
|
||||||
|
data:
|
||||||
|
title: Fire alarm!
|
||||||
|
message: Fire/Smoke detected!
|
||||||
|
- service: xiaomi.play_ringtone
|
||||||
|
data:
|
||||||
|
gw_mac: xxxxxxxxxxxx
|
||||||
|
ringtone_id: 2
|
||||||
|
ringtone_vol: 100
|
||||||
|
```
|
||||||
|
|
||||||
- alias: Toggle dining light on single press
|
#### {% linkable_title Gas %}
|
||||||
trigger:
|
|
||||||
platform: event
|
|
||||||
event_type: click
|
|
||||||
event_data:
|
|
||||||
entity_id: binary_sensor.switch_158d000xxxxxc2
|
|
||||||
click_type: single
|
|
||||||
action:
|
|
||||||
service: switch.toggle
|
|
||||||
entity_id: switch.wall_switch_left_158d000xxxxx01
|
|
||||||
|
|
||||||
- alias: Toggle couch light on double click
|
|
||||||
trigger:
|
|
||||||
platform: event
|
|
||||||
event_type: click
|
|
||||||
event_data:
|
|
||||||
entity_id: binary_sensor.switch_158d000xxxxxc2
|
|
||||||
click_type: double
|
|
||||||
action:
|
|
||||||
service: switch.toggle
|
|
||||||
entity_id: switch.wall_switch_right_158d000xxxxx01
|
|
||||||
|
|
||||||
- alias: Let a dog bark on long press
|
|
||||||
trigger:
|
|
||||||
platform: event
|
|
||||||
event_type: click
|
|
||||||
event_data:
|
|
||||||
entity_id: binary_sensor.switch_158d000xxxxxc2
|
|
||||||
click_type: long_click_press
|
|
||||||
action:
|
|
||||||
service: xiaomi.play_ringtone
|
|
||||||
data:
|
|
||||||
gw_mac: xxxxxxxxxxxx
|
|
||||||
ringtone_id: 8
|
|
||||||
ringtone_vol: 8
|
|
||||||
```
|
|
||||||
|
|
||||||
- Xiaomi Cube (available events are `flip90`, `flip180`, `move`, `tap_twice`, `shake_air`, `swing`, `alert`, `free_fall` and `rotate`).
|
|
||||||
```yaml
|
```yaml
|
||||||
# Trigger for a few cube events
|
- alias: Send notification on gas alarm
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: binary_sensor.natgas_sensor_158dxxxxxxxxxx
|
||||||
|
from: 'off'
|
||||||
|
to: 'on'
|
||||||
|
action:
|
||||||
|
- service: notify.html5
|
||||||
|
data_template:
|
||||||
|
title: Gas alarm!
|
||||||
|
message: 'Gas with a density of {% raw %}{{ states.binary_sensor.natgas_sensor_158dxxxxxxxxxx.attributes.density }}{% endraw %} detected.'
|
||||||
|
```
|
||||||
|
|
||||||
- alias: Cube event flip90
|
#### {% linkable_title Xiaomi Wireless Button %}
|
||||||
trigger:
|
|
||||||
platform: event
|
Available events are `single`, `double`, `hold`, `long_click_press` and `long_click_release`. For Square version (Aqara brand) only `single` and `double` events are supported. Furthermore the space between two clicks to generate a double click must be quite large now.
|
||||||
event_type: cube_action
|
|
||||||
event_data:
|
```yaml
|
||||||
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
- alias: Toggle dining light on single press
|
||||||
action_type: flip90
|
trigger:
|
||||||
action:
|
platform: event
|
||||||
- service: light.turn_on
|
event_type: click
|
||||||
entity_id: light.gateway_light_28xxxxxxxxxx
|
event_data:
|
||||||
data:
|
entity_id: binary_sensor.switch_158d000xxxxxc2
|
||||||
color_name: "springgreen"
|
click_type: single
|
||||||
|
action:
|
||||||
- alias: Cube event flip180
|
service: switch.toggle
|
||||||
trigger:
|
entity_id: switch.wall_switch_left_158d000xxxxx01
|
||||||
platform: event
|
- alias: Toggle couch light on double click
|
||||||
event_type: cube_action
|
trigger:
|
||||||
event_data:
|
platform: event
|
||||||
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
event_type: click
|
||||||
action_type: flip180
|
event_data:
|
||||||
action:
|
entity_id: binary_sensor.switch_158d000xxxxxc2
|
||||||
- service: light.turn_on
|
click_type: double
|
||||||
entity_id: light.gateway_light_28xxxxxxxxxx
|
action:
|
||||||
data:
|
service: switch.toggle
|
||||||
color_name: "darkviolet"
|
entity_id: switch.wall_switch_right_158d000xxxxx01
|
||||||
|
- alias: Let a dog bark on long press
|
||||||
- alias: Cube event move
|
trigger:
|
||||||
trigger:
|
platform: event
|
||||||
platform: event
|
event_type: click
|
||||||
event_type: cube_action
|
event_data:
|
||||||
event_data:
|
entity_id: binary_sensor.switch_158d000xxxxxc2
|
||||||
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
click_type: long_click_press
|
||||||
action_type: move
|
action:
|
||||||
action:
|
service: xiaomi.play_ringtone
|
||||||
- service: light.turn_on
|
data:
|
||||||
entity_id: light.gateway_light_28xxxxxxxxxx
|
gw_mac: xxxxxxxxxxxx
|
||||||
data:
|
ringtone_id: 8
|
||||||
color_name: "gold"
|
ringtone_vol: 8
|
||||||
|
```
|
||||||
- alias: Cube event tap_twice
|
|
||||||
trigger:
|
#### {% linkable_title Xiaomi Cube %}
|
||||||
platform: event
|
|
||||||
event_type: cube_action
|
Available events are `flip90`, `flip180`, `move`, `tap_twice`, `shake_air`, `swing`, `alert`, `free_fall` and `rotate`.
|
||||||
event_data:
|
|
||||||
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
```yaml
|
||||||
action_type: tap_twice
|
- alias: Cube event flip90
|
||||||
action:
|
trigger:
|
||||||
- service: light.turn_on
|
platform: event
|
||||||
entity_id: light.gateway_light_28xxxxxxxxxx
|
event_type: cube_action
|
||||||
data:
|
event_data:
|
||||||
color_name: "deepskyblue"
|
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
||||||
|
action_type: flip90
|
||||||
- alias: Cube event shake_air
|
action:
|
||||||
trigger:
|
- service: light.turn_on
|
||||||
platform: event
|
entity_id: light.gateway_light_28xxxxxxxxxx
|
||||||
event_type: cube_action
|
data:
|
||||||
event_data:
|
color_name: "springgreen"
|
||||||
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
- alias: Cube event flip180
|
||||||
action_type: shake_air
|
trigger:
|
||||||
action:
|
platform: event
|
||||||
- service: light.turn_on
|
event_type: cube_action
|
||||||
entity_id: light.gateway_light_28xxxxxxxxxx
|
event_data:
|
||||||
data:
|
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
||||||
color_name: "blue"
|
action_type: flip180
|
||||||
```
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_28xxxxxxxxxx
|
||||||
|
data:
|
||||||
|
color_name: "darkviolet"
|
||||||
|
- alias: Cube event move
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: cube_action
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
||||||
|
action_type: move
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_28xxxxxxxxxx
|
||||||
|
data:
|
||||||
|
color_name: "gold"
|
||||||
|
- alias: Cube event tap_twice
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: cube_action
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
||||||
|
action_type: tap_twice
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_28xxxxxxxxxx
|
||||||
|
data:
|
||||||
|
color_name: "deepskyblue"
|
||||||
|
- alias: Cube event shake_air
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: cube_action
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
|
||||||
|
action_type: shake_air
|
||||||
|
action:
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_28xxxxxxxxxx
|
||||||
|
data:
|
||||||
|
color_name: "blue"
|
||||||
|
```
|
||||||
|
#### #### {% linkable_title Aqara Wireless Switch %}
|
||||||
|
|
||||||
|
The Aqara Wireless Switch is available as single-key and double-key version. Each key behaves like the Wireless Button limited to the click event `single`. The double key version adds a third device called `binary_sensor.wall_switch_both_158xxxxxxxxx12` which reports a click event called `both` if both keys are pressed.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- alias: Decrease brightness of the gateway light
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: click
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.wall_switch_left_158xxxxxxxxx12
|
||||||
|
click_type: single
|
||||||
|
action:
|
||||||
|
service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_34xxxxxxxx13
|
||||||
|
data_template:
|
||||||
|
brightness: {% raw %}>-
|
||||||
|
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness %}
|
||||||
|
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness - 60 >= 10 %}
|
||||||
|
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness - 60}}
|
||||||
|
{% else %}
|
||||||
|
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness}}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
10
|
||||||
|
{% endif %}{% endraw %}
|
||||||
|
|
||||||
|
- alias: Increase brightness of the gateway light
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: click
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.wall_switch_right_158xxxxxxxxx12
|
||||||
|
click_type: single
|
||||||
|
action:
|
||||||
|
service: light.turn_on
|
||||||
|
entity_id: light.gateway_light_34xxxxxxxx13
|
||||||
|
data_template:
|
||||||
|
brightness: {% raw %}>-
|
||||||
|
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness %}
|
||||||
|
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness + 60 <= 255 %}
|
||||||
|
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness + 60}}
|
||||||
|
{% else %}
|
||||||
|
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness}}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
10
|
||||||
|
{% endif %}{% endraw %}
|
||||||
|
|
||||||
|
- alias: Turn off the gateway light
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: click
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.wall_switch_both_158xxxxxxxxx12
|
||||||
|
click_type: both
|
||||||
|
action:
|
||||||
|
service: light.turn_off
|
||||||
|
entity_id: light.gateway_light_34xxxxxxxx13
|
||||||
|
```
|
||||||
|
20
source/_components/cover.xiaomi.markdown
Normal file
20
source/_components/cover.xiaomi.markdown
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
title: "Xiaomi Cover"
|
||||||
|
description: "Instructions how to setup the Xiaomi cover within Home Assistant."
|
||||||
|
date: 2017-07-21 16:34
|
||||||
|
sidebar: true
|
||||||
|
comments: false
|
||||||
|
sharing: true
|
||||||
|
footer: true
|
||||||
|
logo: xiaomi.png
|
||||||
|
ha_category: Cover
|
||||||
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
The `xiaomi` cover platform allows you to get data from your [Xiaomi](http://www.mi.com/en/) covers.
|
||||||
|
|
||||||
|
The requirement is that you have setup [Xiaomi](/components/xiaomi/).
|
||||||
|
|
20
source/_components/light.xiaomi.markdown
Normal file
20
source/_components/light.xiaomi.markdown
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
title: "Xiaomi Light"
|
||||||
|
description: "Instructions how to setup the Xiaomi light within Home Assistant."
|
||||||
|
date: 2017-07-21 16:34
|
||||||
|
sidebar: true
|
||||||
|
comments: false
|
||||||
|
sharing: true
|
||||||
|
footer: true
|
||||||
|
logo: xiaomi.png
|
||||||
|
ha_category: Light
|
||||||
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
The `xiaomi` light platform allows you to get data from your [Xiaomi](http://www.mi.com/en/) lights.
|
||||||
|
|
||||||
|
The requirement is that you have setup [Xiaomi](/components/xiaomi/).
|
||||||
|
|
20
source/_components/sensor.xiaomi.markdown
Normal file
20
source/_components/sensor.xiaomi.markdown
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
title: "Xiaomi Sensor"
|
||||||
|
description: "Instructions how to setup the Xiaomi sensor within Home Assistant."
|
||||||
|
date: 2017-07-21 16:34
|
||||||
|
sidebar: true
|
||||||
|
comments: false
|
||||||
|
sharing: true
|
||||||
|
footer: true
|
||||||
|
logo: xiaomi.png
|
||||||
|
ha_category: Sensor
|
||||||
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
The `xiaomi` sensor platform allows you to get data from your [Xiaomi](http://www.mi.com/en/) sensors.
|
||||||
|
|
||||||
|
The requirement is that you have setup [Xiaomi](/components/xiaomi/).
|
||||||
|
|
20
source/_components/switch.xiaomi.markdown
Normal file
20
source/_components/switch.xiaomi.markdown
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
title: "Xiaomi Switch"
|
||||||
|
description: "Instructions how to setup the Xiaomi switch within Home Assistant."
|
||||||
|
date: 2017-07-21 16:34
|
||||||
|
sidebar: true
|
||||||
|
comments: false
|
||||||
|
sharing: true
|
||||||
|
footer: true
|
||||||
|
logo: xiaomi.png
|
||||||
|
ha_category: Switch
|
||||||
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
The `xiaomi` switch platform allows you to get data from your [Xiaomi](http://www.mi.com/en/) switches.
|
||||||
|
|
||||||
|
The requirement is that you have setup [Xiaomi](/components/xiaomi/).
|
||||||
|
|
@ -9,10 +9,11 @@ sharing: true
|
|||||||
footer: true
|
footer: true
|
||||||
logo: xiaomi.png
|
logo: xiaomi.png
|
||||||
ha_category: Hub
|
ha_category: Hub
|
||||||
ha_release: 0.50
|
ha_release: "0.50"
|
||||||
|
ha_iot_class: "Local Polling"
|
||||||
---
|
---
|
||||||
|
|
||||||
The `xiaomi_gw` platform allows you to integrate the following devices into HA
|
The `xiaomi_gw` platform allows you to integrate the following [Xiaomi](http://www.mi.com/en/) devices into Home Assistant.
|
||||||
|
|
||||||
- Temperature and Humidity Sensor (old and new version)
|
- Temperature and Humidity Sensor (old and new version)
|
||||||
- Motion Sensor (old and new version)
|
- Motion Sensor (old and new version)
|
||||||
@ -44,34 +45,76 @@ What's not available?
|
|||||||
- Decoupled mode of the Aqara Wall Switches (Single & Double)
|
- Decoupled mode of the Aqara Wall Switches (Single & Double)
|
||||||
- Additional alarm events of the Gas and Smoke Detector: Analog alarm, battery fault alarm (smoke detector only), sensitivity fault alarm, I2C communication failure
|
- Additional alarm events of the Gas and Smoke Detector: Analog alarm, battery fault alarm (smoke detector only), sensitivity fault alarm, I2C communication failure
|
||||||
|
|
||||||
{% linkable_title Getting started %}
|
|
||||||
|
|
||||||
Follow the setup process using your phone and Mi Home app. From here you will be able to retrieve the key from within the app following [this tutorial](https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/1832)
|
Follow the setup process using your phone and Mi Home app. From here you will be able to retrieve the key from within the app following [this tutorial](https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/1832)
|
||||||
|
|
||||||
{% linkable_title Configuration %}
|
To enable Xioami gateway in your installation, add the following to your `configuration.yaml` file:
|
||||||
|
|
||||||
One Gateway
|
One Gateway
|
||||||
```yaml
|
|
||||||
# You can leave mac empty if you only have one gateway
|
|
||||||
xiaomi:
|
|
||||||
gateways:
|
|
||||||
- mac:
|
|
||||||
key: xxxxxxxxxxxxxxxx
|
|
||||||
```
|
|
||||||
|
|
||||||
Multiple Gateway
|
```yaml
|
||||||
```yaml
|
# You can leave mac empty if you only have one gateway.
|
||||||
# 12 characters mac can be obtained from the gateway.
|
xiaomi:
|
||||||
xiaomi:
|
gateways:
|
||||||
gateways:
|
- mac:
|
||||||
- mac: xxxxxxxxxxxx
|
key: xxxxxxxxxxxxxxxx
|
||||||
key: xxxxxxxxxxxxxxxx
|
```
|
||||||
- mac: xxxxxxxxxxxx
|
|
||||||
key: xxxxxxxxxxxxxxxx
|
|
||||||
```
|
Multiple Gateway
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# 12 characters mac can be obtained from the gateway.
|
||||||
|
xiaomi:
|
||||||
|
gateways:
|
||||||
|
- mac: xxxxxxxxxxxx
|
||||||
|
key: xxxxxxxxxxxxxxxx
|
||||||
|
- mac: xxxxxxxxxxxx
|
||||||
|
key: xxxxxxxxxxxxxxxx
|
||||||
|
```
|
||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
|
|
||||||
- **mac** (*Optional*): The MAC of your gateway. Required if you have more than one.
|
- **mac** (*Optional*): The MAC of your gateway. Required if you have more than one.
|
||||||
- **key** (*Optional*): The key of your gateway. Required if you also want to control lights and switches; sensors and binary sensors will still work.
|
- **key** (*Optional*): The key of your gateway. Required if you also want to control lights and switches; sensors and binary sensors will still work.
|
||||||
- **discovery_retry** (*Optional*): Amount of times Home Assitant should try to reconnect to the Xiaomi Gateway. Default is 3.
|
- **discovery_retry** (*Optional*): Amount of times Home Assitant should try to reconnect to the Xiaomi Gateway. Default is 3.
|
||||||
- **interface** (*Optional*): Which network interface to use. Default to any.
|
- **interface** (*Optional*): Which network interface to use. Default to any.
|
||||||
|
|
||||||
|
## {% linkable_title Services %}
|
||||||
|
|
||||||
|
The gateway provides two services: `xiaomi.play_ringtone` and `xiaomi.stop_ringtone`. To play ringtones by Home Assistant the version of the gateway firmware must be `1.4.1_145` at least. A `ringtone_id` and `gw_mac` must be supplied. The parameter `ringtone_vol` (percent) is optional. Allowed values of the `ringtone_id` are:
|
||||||
|
|
||||||
|
- alarm ringtones [0-8]
|
||||||
|
- doorbell ring [10-13]
|
||||||
|
- alarm clock [20-29]
|
||||||
|
- custom ringtones (uploaded by mi home app) starting from 10001
|
||||||
|
|
||||||
|
Automation example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- alias: Let a dog bark on long press
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: click
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.switch_158d000xxxxxc2
|
||||||
|
click_type: long_click_press
|
||||||
|
action:
|
||||||
|
service: xiaomi.play_ringtone
|
||||||
|
data:
|
||||||
|
gw_mac: xxxxxxxxxxxx
|
||||||
|
ringtone_id: 8
|
||||||
|
ringtone_vol: 8
|
||||||
|
|
||||||
|
- alias: Stop barking immediately on single click
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: click
|
||||||
|
event_data:
|
||||||
|
entity_id: binary_sensor.switch_158d000xxxxxc2
|
||||||
|
click_type: single
|
||||||
|
action:
|
||||||
|
service: xiaomi.stop_ringtone
|
||||||
|
data:
|
||||||
|
gw_mac: xxxxxxxxxxxx
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user