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

[Device Support Request] _TZ3000_o4mkahkc - PIR motion sensor #3717

Open
sbetty02 opened this issue Jan 16, 2025 · 0 comments
Open

[Device Support Request] _TZ3000_o4mkahkc - PIR motion sensor #3717

sbetty02 opened this issue Jan 16, 2025 · 0 comments

Comments

@sbetty02
Copy link

sbetty02 commented Jan 16, 2025

Problem description

I recently got some "Tuya PIR Sensors" from Ali express. They connect fine and work fine for a few hours then it's almost as if they got into a sleep and then become unavailable in HA. If you walk past them they flash red to indicate they have detected motion but as they appear to be in a sleep HA side they don't report that motion back to HA.

Solution description

I'd like to be able to control a few things -

  1. Always on - Stop it going into a sleep and becoming unavailable in HA (seems to be currently 4/5 hours)
  2. Adjust time out time - Currently think its 90 seconds would like to lower this to 30
  3. Sensitivity - Would like to adjust the sensitivity, if I run past these on a brisk walk they dont pick up my motion

Screenshots/Video

Screenshots/Video

[Paste/upload your media here]

Device signature

Device Signature { "node_descriptor": { "logical_type": 2, "complex_descriptor_available": 0, "user_descriptor_available": 0, "reserved": 0, "aps_flags": 0, "frequency_band": 8, "mac_capability_flags": 128, "manufacturer_code": 4417, "maximum_buffer_size": 66, "maximum_incoming_transfer_size": 66, "server_mask": 10752, "maximum_outgoing_transfer_size": 66, "descriptor_capability_field": 0 }, "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0402", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0500" ], "output_clusters": [ "0x0006", "0x000a", "0x0019", "0x1000" ] } }, "manufacturer": "_TZ3000_o4mkahkc", "model": "TS0202", "class": "ts0202.PirMotion" }

Diagnostic information

Device Information [zha-01J4VE8VBTT0XZX55XN045BEXA-_TZ3000_o4mkahkc TS0202-4c3264f54c0a06583c77d31ede08040b.json](https://github.com/user-attachments/files/18436196/zha-01J4VE8VBTT0XZX55XN045BEXA-_TZ3000_o4mkahkc.TS0202-4c3264f54c0a06583c77d31ede08040b.json)
### Logs
Logs
[Paste the logs here]

Custom quirk

Custom Quirks """Tuya PIR motion sensor."""

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import (
Basic,
Identify,
OnOff,
Ota,
PowerConfiguration,
Time,
)
from zigpy.zcl.clusters.lightlink import LightLink
from zigpy.zcl.clusters.security import IasZone

from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)

class SensitivityLevel(t.enum8):
"""Sensitivity level enum."""

LOW = 0x00
MEDIUM = 0x01
HIGH = 0x02

class OnTimeValues(t.enum8):
"""Sensitivity level enum."""

SEC_30 = 0x00
SEC_60 = 0x01
SEC_120 = 0x02

class PirSensor(IasZone):
"""IasZone with extra attributes."""

attributes = IasZone.attributes.copy()
# Wrap `current_zone_sensitivity_level` posible values
attributes.update({0x0013: ("current_zone_sensitivity_level", SensitivityLevel)})
attributes.update({0xF001: ("on_time", OnTimeValues)})

class PirMotion(CustomDevice):
"""Tuya PIR motion sensor."""

signature = {
    MODELS_INFO: [("_TZ3000_o4mkahkc", "TS0202")],
    # endpoints=1 profile=260 device_type=0x0402
    # in_clusters=[0x0000, 0x0001, 0x0003, 0x0500],
    # out_clusters=[0x0006, 0x000a, 0x0019, 0x1000]
    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,
                PirSensor,
            ],
            OUTPUT_CLUSTERS: [
                OnOff.cluster_id,
                Time.cluster_id,
                Ota.cluster_id,
                LightLink.cluster_id,
            ],
        }
    }
}

Additional information

I have currently got a quirk setup for these which doesn't seem to make any difference so not sure if that shows in the logs or not but have pasted it above

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

1 participant