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

[Bug]: 对于二元传感器应使用binary sensor类 #206

Open
Joee-D opened this issue Dec 19, 2024 · 5 comments
Open

[Bug]: 对于二元传感器应使用binary sensor类 #206

Joee-D opened this issue Dec 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Joee-D
Copy link

Joee-D commented Dec 19, 2024

Describe the bug / 描述问题

对于二元传感器建议使用binary sensor类

To Reproduce / 复现步骤

1.添加集成
2.查看移动传感器/门窗传感器类型

Expected behavior / 预期结果

2.为binary sensor

Home Assistant Logs / 系统日志

Home Assistant Core version / Home Assistant Core 版本

2024.12.2

Home Assistant Operation System version / Home Assistant Operation System 版本

13.0

Xiaomi Home integration version / 米家集成版本

v0.1.2

Additional context / 其他说明

背景

当前插件中的传感器,全部转为了sensor类

SPEC_PROP_TRANS_MAP: dict[str, dict | str] = {

其中对于bool类型定义通过以下文件转换显示

改进

HA官方支持binary sensor类型
https://developers.home-assistant.io/docs/core/entity/binary-sensor
建议对于二元传感器使用binary sensor类,也省却了翻译的问题,可以直接使用官方翻译
如移动传感器:
BinarySensorDeviceClass.MOVING
门窗传感器:
BinarySensorDeviceClass.OPENING
当前无法直接导入到homekit中,需要通过template进行转换;指定binary sensor类则可以直接导入使用。

@Joee-D Joee-D added the bug Something isn't working label Dec 19, 2024
@micturkey
Copy link

说的很对,gateway3集成就是用的binary sensor类,很轻松就可以接入homekit

@WalterDSU
Copy link

人体,人在,门窗等这些,请检查一下改用binary sensor,否则无法用的。

@hi94740
Copy link

hi94740 commented Dec 19, 2024

还有这种一个属性对应多个状态的,但也符合二元传感器的类型,应该转换成多个二元传感器
image

micturkey added a commit to micturkey/ha_xiaomi_home that referenced this issue Dec 19, 2024
…ak sensor

fix: use Binary sensor class for door&windows and water leak sensor

The original version uses a sensor class for various sensors, such as door and windows sensors, water leak sensors, occupancy sensors, motion sensors, etc., which prevents the HomeKit Bridge from generating corresponding entities.
This fix is to use binary sensor class for door andwindows sensor and water leak sensor.

Correspoding issue: XiaoMi#206
@SlippinDylan
Copy link

值得重视额,人体存在传感器、门窗传感器、水浸传感器都没有 binary sensor 类,希望可以改进一下

@topsworld topsworld self-assigned this Dec 20, 2024
@topsworld topsworld added enhancement New feature or request and removed bug Something isn't working labels Dec 20, 2024
@yifan-lee
Copy link

小米人在传感器通过homebridge到HomeKit还显示为不支持,不知道从sensor变成binary sensor是不是就会支持了?

caibinqing pushed a commit to caibinqing/ha_xiaomi_home that referenced this issue Jan 7, 2025
…ak sensor

fix: use Binary sensor class for door&windows and water leak sensor

The original version uses a sensor class for various sensors, such as door and windows sensors, water leak sensors, occupancy sensors, motion sensors, etc., which prevents the HomeKit Bridge from generating corresponding entities.
This fix is to use binary sensor class for door andwindows sensor and water leak sensor.

Correspoding issue: XiaoMi#206
@topsworld topsworld removed their assignment Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants