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

Ainice三体场景传感器 ainice.sensor_occupy.3b 实时触发 #1558

Open
al-one opened this issue Mar 6, 2024 · 1 comment
Open

Ainice三体场景传感器 ainice.sensor_occupy.3b 实时触发 #1558

al-one opened this issue Mar 6, 2024 · 1 comment
Labels
device: motion FAQ Frequently Asked Questions

Comments

@al-one
Copy link
Owner

al-one commented Mar 6, 2024

本插件最近适配了Ainice三体场景传感器ainice.sensor_occupy.3b,默认的更新频率为10秒,然而实际使用中,这个频率会产生挺大的延迟,这里有一种可以通过HA自动化实时触发的方法。

添加自动化

description: 三体传感器每秒更新
mode: queued
max: 10
trigger:
  - platform: time_pattern
    seconds: /1 # 每秒执行一次
condition: []
action:
  - service: xiaomi_miot.get_properties
    data:
      entity_id: sensor.ainice_3b_xxxx_occupancy_sensor # 换成你的三体传感器实体ID
      mapping:
        - {siid: 2, piid: 1}  # current_occupied
        - {siid: 2, piid: 5}  # a_occupied
        - {siid: 2, piid: 8}  # b_occupied
        - {siid: 2, piid: 11} # c_occupied
        - {siid: 2, piid: 14} # d_occupied
        - {siid: 2, piid: 17} # e_occupied
      update_entity: true # 更新属性到实体
@SodaWithoutSparkles
Copy link
Contributor

SodaWithoutSparkles commented Mar 20, 2024

恭喜这个issue成为搜索"Ainice三体场景传感器"的第一个结果。这个issue是否应该也放进FAQ里面呢?以下为英文翻译:


This plugin supports Ainice 3-body occupancy sensor ainice.sensor_occupy.3b recently. The default update period is 10s. However, we've observed that this period is unstable and might be delayed. Here's a way to use Home Assistant automation to update in real time.

Create a new automation

description: update_3-body_sensor_by_second
mode: queued
max: 10
trigger:
  - platform: time_pattern
    seconds: /1 # execute every second
condition: []
action:
  - service: xiaomi_miot.get_properties
    data:
      entity_id: sensor.ainice_3b_xxxx_occupancy_sensor # Change this to the entity_id of your sensor
      mapping:
        - {siid: 2, piid: 1}  # current_occupied
        - {siid: 2, piid: 5}  # a_occupied
        - {siid: 2, piid: 8}  # b_occupied
        - {siid: 2, piid: 11} # c_occupied
        - {siid: 2, piid: 14} # d_occupied
        - {siid: 2, piid: 17} # e_occupied
      update_entity: true # update the entity

@al-one al-one added the FAQ Frequently Asked Questions label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device: motion FAQ Frequently Asked Questions
Projects
None yet
Development

No branches or pull requests

2 participants