Xiaomi Home Assistant Bug: Incorrect Contact-State and Binary Sensor Status
in Post with 0 comment

## Introduction to Xiaomi Home Assistant
The Xiaomi Home Assistant is a smart home system that integrates various devices to provide a seamless and automated living experience. One of the key devices in this system is the Xiaomi door and window sensor, which detects the opening and closing of doors and windows.

## The Bug: Incorrect Contact-State and Binary Sensor Status
A bug has been identified in the Xiaomi Home Assistant system, specifically with the door and window sensor 2 (isa.magnet.dw2hl). The contact-state of the sensor is being directly returned as the is_on property status, leading to incorrect states in Home Assistant (HA) and HomeKit.

## Reproducing the Bug
To reproduce the bug, follow these steps:
1. Close the door or window.
2. Observe the sensor's text status description, which should indicate "接触" (contact).
3. Check the binary status, which should be incorrect.

## Expected Behavior
When the contact-state is True, the binary sensor status should be off.

## Reproduce Time and Home Assistant Logs
The bug was reproduced on 2025-02-08 at 11:32:24. However, there are no response logs available for this incident.

## System Information
* Home Assistant Core Version: 2025.2.1
* Home Assistant Operation System Version: N/A
* Xiaomi Home Integration Version: v0.1.5b2
* Log Timezone: Asia/Shanghai

## Additional Context
According to the HA documentation, the binary sensor's ON/OFF status is determined by the device class. For more information, refer to the [HA documentation](https://www.home-assistant.io/integrations/binary_sensor/#device-class).

## Conclusion
The incorrect contact-state and binary sensor status bug in the Xiaomi Home Assistant system needs to be addressed to ensure accurate and reliable automation. By understanding the cause of the bug and the expected behavior, developers can work towards resolving this issue and improving the overall performance of the Xiaomi Home Assistant.

The article has been posted for too long and comments have been automatically closed.