-
Notifications
You must be signed in to change notification settings - Fork 860
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
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence #574
Comments
trigger: state
entity_id:
- event.xiaomi_cn_blt_3_*************_pir1_motion_detected_e_2_1008
not_from: unavailable
not_to: unavailable |
``
platform: state
entity_id:
- event.xiaomi_cn_xxxxxxxxxxxx
from: 检测到移动
to: 检测到移动 应该是这样吧 |
这个事件的值不是检测到移动,而且一个触发时间,可以自己模板里创建一个二元传感器,虽然我觉着现在这么做不太优雅 {% set temp = as_timestamp(states('event.xiaomi_cn_blt_3_*************_pir1_motion_detected_e_2_1008')) -%}
{%- if as_timestamp(now()) - temp > 60 -%}
OFF
{%- else -%}
ON
{% endif %} |
不是这样的,状态是触发的时间戳,所以才能监听到变化(这个motion事件只有一种类型,就不需要判断了),完整的自动化可以参考这个: mode: restart
triggers:
- trigger: state
entity_id:
- event.xiaomi_cn_blt_3_*************_pir1_motion_detected_e_2_1008
not_from: unavailable
not_to: unavailable
conditions: []
actions:
- alias: 如果灯关着就打开
if:
- condition: state
entity_id: light.*************
state: "on"
then:
- action: light.turn_on
target:
entity_id: light.*************
data: {}
- alias: 等一会儿
delay:
hours: 0
minutes: 2
seconds: 0
- alias: 关灯
action: light.turn_off
target:
entity_id: light.*************
data: {} |
description: ""
mode: restart
triggers:
- trigger: state
entity_id:
- event.xiaomi_cn_blt_3_xxxxxxxxxxxx_pir1_motion_detected_e_2_1008
not_from: unavailable
not_to: unavailable
conditions: []
actions:
- alias: 如果灯关着就打开
if:
- condition: state
entity_id: light.yeelink_cn_xxxxxxxxxceiling22_s_2
state: "on"
then:
- action: light.turn_on
target:
entity_id: light.yeelink_cnxxxxxxxxx_ceiling22_s_2
data: {}
- alias: 等一会儿
delay:
hours: 0
minutes: 2
seconds: 0
- alias: 关灯
action: light.turn_off
target:
entity_id: light.yeelink_xxxxxxxxxxxxxxxxxxx22_s_2
data: {}
alias: 新建自动化 错误Message malformed: extra keys not allowed @ data['triggers'] |
还是感觉presence优雅,2s人体传感器event五颜六色在ha看起来都怪怪的。 |
旧版本大概是这样写的: mode: restart
trigger:
- platform: state
entity_id:
- event.xiaomi_cn_blt_3_*************_pir1_motion_detected_e_2_1008
not_from: unavailable
not_to: unavailable
condition: []
action:
- alias: 如果灯关着就打开
if:
- condition: state
entity_id: light.*************
state: "on"
then:
- service: light.turn_on
target:
entity_id: light.*************
data: {}
- alias: 等一会儿
delay:
hours: 0
minutes: 2
seconds: 0
- alias: 关灯
service: light.turn_off
target:
entity_id: light.*************
data: {} |
Describe the Bug / 描述问题
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
How to Reproduce / 复现步骤
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
需改成presence如下,不然无法进行自动化
Expected Behavior / 预期结果
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Reproduce Time / 问题复现的时间点
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Home Assistant Logs / 系统日志
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Log Timezone / 日志时区
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Home Assistant Core Version / Home Assistant Core 版本
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Home Assistant Operation System Version / Home Assistant Operation System 版本
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Xiaomi Home Integration Version / 米家集成版本
Xiaomi Motion Sensor 2S Motion Sensor 建议修改为ha的presence
Additional Context / 其他说明
No response
The text was updated successfully, but these errors were encountered: