Skip to content

Instantly share code, notes, and snippets.

@willwhui
Created December 3, 2017 16:22
Show Gist options
  • Save willwhui/00d15d3e3d13744573ad3d2acedb1bc0 to your computer and use it in GitHub Desktop.
Save willwhui/00d15d3e3d13744573ad3d2acedb1bc0 to your computer and use it in GitHub Desktop.
在hass中使用小米网关人体感应器
@willwhui
Copy link
Author

willwhui commented Dec 5, 2017

在automation中使用小米人体感应器

  • 方法1
    官方文档中提到的激活方式是通过binary sensor的state (on / off),比如:
- alias: "test on sensor turn bool on"
  trigger:
    - platform: state
      entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
      from: 'off'
      to: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.test
- alias: "test on sensor turn bool on"
  trigger:
    - platform: event
      event_type: motion
      event_data:
        entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.test

但这种模式在官方文档中并不能找到?

  • 2017年12月12日注:
    请教@cxlwill 之后得知lazcad同志已经不维护这些代码了,还是要用官方的方法
    但实际情况发现官方的方法时灵时不灵,有时候hass只会触发event,有时候只会触发motion,不知道为什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment