They are recognized and work with their motion entity.
However, an additional entity labeled “open” also appears. I believe this could be a potential contact on the circuit board or simply an non-existent entity that was overlooked in the software. I’m not entirely sure why it is there.
Additionally, I have ordered two devices that look the same, but also include temperature and humidity sensors.
At the moment, I am practicing with quirks as I did 2-3 years ago. I already have a better understanding of what they are and why they are necessary.
ZHA (Zigbee Home Automation) is quite standard Zigbee and should work out of the box with every Zigbee hardware. Unfortunately, manufacturers do not always adhere to these standards and implement their own variations. This makes it necessary to have a backup system (“Plan B”) when the standard implementation fails.
The ZHA device handler takes care of this. All you need to do is copy a Python file containing the quirk for your device and upload it to a directory on your Home Assistant. Don’t forget to specify the folder location in your configuration.yaml:
zha:
custom_quirks_path: /config/zha_quirks/
enable_quirks: true
I’m not entirely sure if you need “enable_quirks: true,” but I believe it’s not harmful to include it. Update: You can remove it because it’s enabled by default. However, if you want to disable it temporarily, set it to false or simply remove the code from your configuration.yaml.
Update:
I managed to write a quirk that removes the unnecessary contact by simply removing the OnOff Cluster in the replacement.
To-do:
- Implement a dropdown (enum) where sensitivity can be set.
- Implement a dropdown (enum) where the time in which the sensor remains active can be set (e.g., 10 sec, 20 sec, 60 sec, 120 sec).
Problem: I’m unsure how to accomplish this.
"""Device handler for TS0202 NeoMotion sensor by itsolon."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Identify, OnOff, Ota, Time, PowerConfiguration
from zigpy.zcl.clusters.security import IasZone
from zigpy.zcl.clusters.lightlink import LightLink
from zhaquirks import MotionWithReset
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
#class MotionCluster(MotionWithReset): ???????
# """Motion cluster."""
# reset_s: int = 60
class TS0202_NeoMotion(CustomDevice):
"""Quirk for TS0202 NeoMotion sensor."""
signature = {
# "endpoint": 1
# "profile_id": "0x0104",
# "device_type": "0x0402",
# "in_clusters": ["0x0000","0x0001","0x0003", "0x0500"],
# "out_clusters": ["0x0006","0x000a","0x0019","0x1000"]
MODELS_INFO: [("_TZ3000_kmh5qpmb", "TS0202")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
IasZone.cluster_id,
],
OUTPUT_CLUSTERS: [
OnOff.cluster_id,
Time.cluster_id,
Ota.cluster_id,
LightLink.cluster_id,
],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
IasZone.cluster_id,
],
OUTPUT_CLUSTERS: [
#OnOff.cluster_id,
Time.cluster_id,
Ota.cluster_id,
LightLink.cluster_id,
],
},
},
}
``