niceboygithub / AqaraGateway

Aqara Gateway/Hub integration for Home Assistant
493 stars 64 forks source link

动作传感器的侦测时间间隔(超时时间)被固定在了90秒 The occupancy timeout for motion sensors is fixed at 90 #281

Open EricCorleone opened 1 month ago

EricCorleone commented 1 month ago

我看了一下代码,在binary_sensor.py中的第193行里:

    async def async_added_to_hass(self):
        """ add to hass """
        # old version
        self._default_delay = self.device.get(CONF_OCCUPANCY_TIMEOUT, 90)

        custom: dict = self.hass.data[DATA_CUSTOMIZE].get(self.entity_id)
        custom.setdefault(CONF_OCCUPANCY_TIMEOUT, self._default_delay)

        await super().async_added_to_hass()

当从设备获取不到CONF_OCCUPANCY_TIMEOUToccupancy_timeout 时,将该值设为90。事实上,无论我在Aqara Home App里怎么设置侦测时间间隔,在HA里都是显示90,说明并没有正确获取到这个值: IMG_7676 Pasted Screenshot 2024-07-19 09-22-23 这个是否有办法修复呢?

Necroneco commented 1 month ago

这应该是两个不同的东西

occupancy_timeout 指的是在HA里面, 超过这个时间没有收到新的触发事件, 会把状态置成 off.

Aqara的侦测时间间隔是指设备上报了一次触发之后, 在接下来的这段时间之内不会再上报触发事件.

EricCorleone commented 1 month ago

确实,我把自己搞乱了😂那这个值改为让用户手动设置是不是会更合理一点,感觉90秒有点太长了。在Homekit里貌似这个timeout是0秒,所以可以在自动化里自己设置延时

Necroneco commented 1 month ago

这个 occupancy_timeout 可以自己改的

configuration.yaml

homeassistant:
  customize:
    binary_sensor.0x1234567890abcdef_motion:
      occupancy_timeout: 10

类似这样

EricCorleone commented 1 month ago

原来如此,感谢~