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

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

Open
EricCorleone opened this issue Jul 19, 2024 · 7 comments

Comments

@EricCorleone
Copy link
Contributor

EricCorleone commented Jul 19, 2024

我看了一下代码,在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
这个是否有办法修复呢?

@EricCorleone EricCorleone changed the title 动作传感器的侦测时间间隔(超时时间)被固定在了90秒 动作传感器的侦测时间间隔(超时时间)被固定在了90秒 The occupancy timeout for motion sensors is fixed at 90 Jul 19, 2024
@Necroneco
Copy link
Contributor

Necroneco commented Jul 20, 2024

这应该是两个不同的东西

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

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

@EricCorleone
Copy link
Contributor Author

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

@Necroneco
Copy link
Contributor

Necroneco commented Jul 22, 2024

这个 occupancy_timeout 可以自己改的

configuration.yaml

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

类似这样

@EricCorleone
Copy link
Contributor Author

原来如此,感谢~

@EricCorleone
Copy link
Contributor Author

这个 occupancy_timeout 可以自己改的

configuration.yaml

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

类似这样

在这里改完并重载配置之后,会在实体的属性里面体现出来吗?我去看了一下occupancy_timeout还是显示90:
image

@Necroneco
Copy link
Contributor

Necroneco commented Oct 10, 2024

在这里改完并重载配置之后,会在实体的属性里面体现出来吗?我去看了一下occupancy_timeout还是显示90:

会的,我这里是能看到修改后的值的。也许你需要重启一下,或者再检查一下语法

@EricCorleone
Copy link
Contributor Author

EricCorleone commented Oct 11, 2024

在这里改完并重载配置之后,会在实体的属性里面体现出来吗?我去看了一下occupancy_timeout还是显示90:

会的,我这里是能看到修改后的值的。也许你需要重启一下,或者再检查一下语法

后面多等一会儿就有了,一开始没有马上变

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants