Closed PieterHattinghZA closed 1 month ago
"""ZY-M100 Human Presence Sensor""" import math from typing import Dict, Optional, Tuple, Union
from zigpy.profiles import zha from zigpy.quirks import CustomDevice import zigpy.types as t from zigpy.zcl import foundation from zigpy.zcl.clusters.general import ( AnalogInput, AnalogOutput, Basic, GreenPowerProxy, Groups, Identify, Ota, Scenes, Time, ) from zigpy.zcl.clusters.measurement import ( IlluminanceMeasurement, OccupancySensing, RelativeHumidity, TemperatureMeasurement, ) from zigpy.zcl.clusters.security import IasZone
from zhaquirks import Bus, LocalDataCluster, MotionOnEvent from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, MOTION_EVENT, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.tuya import (
TuyaLocalCluster,
TuyaManufCluster,
TuyaNewManufCluster,
TuyaDPType,
)
from zhaquirks.tuya.mcu import ( TuyaAttributesCluster, DPToAttributeMapping, TuyaMCUCluster, )
ZONE_TYPE = 0x0001
class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster): """Tuya local OccupancySensing cluster."""
class TuyaAnalogInput(AnalogInput, TuyaLocalCluster): """Tuya local AnalogInput cluster."""
class TuyaIlluminanceMeasurement(IlluminanceMeasurement, TuyaLocalCluster): """Tuya local IlluminanceMeasurement cluster."""
class TuyaTemperatureMeasurement(TemperatureMeasurement, TuyaLocalCluster): """Tuya local TemperatureMeasurement cluster."""
class TuyaRelativeHumidity(RelativeHumidity, TuyaLocalCluster): """Tuya local RelativeHumidity cluster."""
class MmwRadarManufCluster(TuyaMCUCluster): """ZY-M100 manufacturer cluster.""" attributes = TuyaMCUCluster.attributes.copy() attributes.update( { 0xEF00: ("dp_0", t.CharacterString, True), 0xEF68: ("dp_104", t.enum8, True), 0xEF69: ("dp_105", t.enum8, True), 0xEF6A: ("dp_106", t.enum8, True), 0xEF6B: ("dp_107", t.uint16_t, True), 0xEF6C: ("dp_108", t.uint16_t, True), 0xEF6D: ("dp_109", t.uint16_t, True), 0xEF6E: ("dp_110", t.uint8_t, True), 0xEF6F: ("dp_111", t.uint8_t, True), } )
dp_to_attribute: Dict[int, DPToAttributeMapping] = {
104: DPToAttributeMapping(
TuyaIlluminanceMeasurement.ep_attribute,
"measured_value",
lambda x: 10000 * math.log10(x) + 1 if x != 0 else 0,
),
1: DPToAttributeMapping(
TuyaOccupancySensing.ep_attribute,
"occupancy",
),
106: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"present_value",
endpoint_id=6,
),
107: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"present_value",
endpoint_id=3,
),
108: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"present_value",
endpoint_id=2,
),
109: DPToAttributeMapping(
TuyaAnalogInput.ep_attribute,
"Tpresent_value",
lambda x: x / 100,
),
110: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"present_value",
endpoint_id=4,
),
111: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"present_value",
endpoint_id=5,
),
}
data_point_handlers = {
1: "_dp_2_attr_update",
104: "_dp_2_attr_update",
105: "_dp_2_attr_update",
106: "_dp_2_attr_update",
107: "_dp_2_attr_update",
108: "_dp_2_attr_update",
109: "_dp_2_attr_update",
110: "_dp_2_attr_update",
111: "_dp_2_attr_update",
}
class MotionCluster(LocalDataCluster, MotionOnEvent): """Tuya Motion Sensor."""
_CONSTANT_ATTRIBUTES = {ZONE_TYPE: IasZone.ZoneType.Motion_Sensor}
reset_s = 15
class TuyaManufacturerClusterMotion(TuyaManufCluster): """Manufacturer Specific Cluster of the Motion device."""
def handle_cluster_request(
self,
hdr: foundation.ZCLHeader,
args: Tuple[TuyaManufCluster.Command],
*,
dst_addressing: Optional[
Union[t.Addressing.Group, t.Addressing.IEEE, t.Addressing.NWK]
] = None,
) -> None:
"""Handle cluster request."""
tuya_cmd = args[0]
self.debug("handle_cluster_request--> hdr: %s, args: %s", hdr, args)
if hdr.command_id == 0x0001 and tuya_cmd.command_id == 1027:
self.endpoint.device.motion_bus.listener_event(MOTION_EVENT)
class TuyaMmwRadarMinRange(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for min range."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Min Range"
)
self._update_attribute(self.attributes_by_name["min_present_value"].id, 0)
self._update_attribute(self.attributes_by_name["max_present_value"].id, 950)
self._update_attribute(self.attributes_by_name["resolution"].id, 10)
self._update_attribute(
self.attributes_by_name["engineering_units"].id, 118
) # 31: meters
class TuyaMmwRadarMaxRange(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for max range."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Max range"
)
self._update_attribute(self.attributes_by_name["min_present_value"].id, 0)
self._update_attribute(self.attributes_by_name["max_present_value"].id, 950)
self._update_attribute(self.attributes_by_name["resolution"].id, 10)
self._update_attribute(
self.attributes_by_name["engineering_units"].id, 118
) # 31: meters
class TuyaMmwRadarDetectionDelay(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for detection delay."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Detection delay"
)
self._update_attribute(self.attributes_by_name["min_present_value"].id, 000)
self._update_attribute(self.attributes_by_name["max_present_value"].id, 20000)
self._update_attribute(self.attributes_by_name["resolution"].id, 100)
self._update_attribute(
self.attributes_by_name["engineering_units"].id, 159
) # 73: seconds
class TuyaMmwRadarFadingTime(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for fading time."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Fading time"
)
self._update_attribute(self.attributes_by_name["min_present_value"].id, 0000)
self._update_attribute(self.attributes_by_name["max_present_value"].id, 200000)
self._update_attribute(self.attributes_by_name["resolution"].id, 1000)
self._update_attribute(
self.attributes_by_name["engineering_units"].id, 159
) # 73: seconds
class TuyaMmwRadarSensitivity(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for sensitivity."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Sensitivity"
)
self._update_attribute(self.attributes_by_name["min_present_value"].id, 1)
self._update_attribute(self.attributes_by_name["max_present_value"].id, 9)
self._update_attribute(self.attributes_by_name["resolution"].id, 1)
class TuyaMmwRadarTargetDistance(TuyaAttributesCluster, AnalogInput): """AnalogInput cluster for target distance."""
def __init__(self, *args, **kwargs):
"""Init."""
super().__init__(*args, **kwargs)
self._update_attribute(
self.attributes_by_name["description"].id, "Target distance"
)
self._update_attribute(
self.attributes_by_name["engineering_units"].id, 31
) # 31: meters
class MmwRadarMotionZYM100(CustomDevice): """Millimeter wave occupancy sensor."""
signature = {
MODELS_INFO: [
("_TZE204_ztqnh5cg", "TS0601"),
],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaNewManufCluster.cluster_id,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
242: {
# <SimpleDescriptor endpoint=242 profile=41440 device_type=97
# input_clusters=[]
# output_clusters=[33]
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
MmwRadarManufCluster,
TuyaOccupancySensing,
TuyaAnalogInput,
TuyaIlluminanceMeasurement,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
#start of new replacements
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarMinRange,
],
OUTPUT_CLUSTERS: [],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarMaxRange,
],
},
4: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarDetectionDelay,
],
OUTPUT_CLUSTERS: [],
},
5: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarFadingTime,
],
OUTPUT_CLUSTERS: [],
},
6: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarSensitivity,
],
OUTPUT_CLUSTERS: [],
},
#### end of new replacements.
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
}
You can use this for now, at least it shows occupancy and some attributes, but clearly some of the stuff is not right.... Tried modify according to zigbee2mqtt file it still no luck for the settings and lux attribute
Thanks.
I tried the quirk, but still not working
Regards,
[signatureImage]
This e-mail and any attachments thereto are strictly confidential and are intended solely for the use of the addressee. Should you not be the intended addressee, please delete this e-mail message immediately. While care is taken in preparing this document, no representation, warranty or undertaking (expressly or implied) is given and no responsibility nor liability is accepted by the company as to the accuracy of the information contained herein, that the email is free of viruses, or for any damages that may occur from receiving or opening this email.
From: vshijiav @.> Sent: Saturday, February 17, 2024 6:17:04 AM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
"""ZY-M100 Human Presence Sensor""" import math from typing import Dict, Optional, Tuple, Union
from zigpy.profiles import zha from zigpy.quirks import CustomDevice import zigpy.types as t from zigpy.zcl import foundation from zigpy.zcl.clusters.general import ( AnalogInput, AnalogOutput, Basic, GreenPowerProxy, Groups, Identify, Ota, Scenes, Time, ) from zigpy.zcl.clusters.measurement import ( IlluminanceMeasurement, OccupancySensing, RelativeHumidity, TemperatureMeasurement, ) from zigpy.zcl.clusters.security import IasZone
from zhaquirks import Bus, LocalDataCluster, MotionOnEvent from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, MOTION_EVENT, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.tuya import (
TuyaLocalCluster, TuyaManufCluster, TuyaNewManufCluster, TuyaDPType,
)
from zhaquirks.tuya.mcu import ( TuyaAttributesCluster, DPToAttributeMapping, TuyaMCUCluster, )
ZONE_TYPE = 0x0001
class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster): """Tuya local OccupancySensing cluster."""
class TuyaAnalogInput(AnalogInput, TuyaLocalCluster): """Tuya local AnalogInput cluster."""
class TuyaIlluminanceMeasurement(IlluminanceMeasurement, TuyaLocalCluster): """Tuya local IlluminanceMeasurement cluster."""
class TuyaTemperatureMeasurement(TemperatureMeasurement, TuyaLocalCluster): """Tuya local TemperatureMeasurement cluster."""
class TuyaRelativeHumidity(RelativeHumidity, TuyaLocalCluster): """Tuya local RelativeHumidity cluster."""
class MmwRadarManufCluster(TuyaMCUCluster): """ZY-M100 manufacturer cluster.""" attributes = TuyaMCUCluster.attributes.copy() attributes.update( { 0xEF00: ("dp_0", t.CharacterString, True), 0xEF68: ("dp_104", t.enum8, True), 0xEF69: ("dp_105", t.enum8, True), 0xEF6A: ("dp_106", t.enum8, True), 0xEF6B: ("dp_107", t.uint16_t, True), 0xEF6C: ("dp_108", t.uint16_t, True), 0xEF6D: ("dp_109", t.uint16_t, True), 0xEF6E: ("dp_110", t.uint8_t, True), 0xEF6F: ("dp_111", t.uint8_t, True), } )
dp_to_attribute: Dict[int, DPToAttributeMapping] = { 104: DPToAttributeMapping( TuyaIlluminanceMeasurement.ep_attribute, "measured_value", lambda x: 10000 * math.log10(x) + 1 if x != 0 else 0, ), 1: DPToAttributeMapping( TuyaOccupancySensing.ep_attribute, "occupancy", ), 106: DPToAttributeMapping( TuyaMCUCluster.ep_attribute, "present_value", endpoint_id=6, ), 107: DPToAttributeMapping( TuyaMCUCluster.ep_attribute, "present_value", endpoint_id=3, ), 108: DPToAttributeMapping( TuyaMCUCluster.ep_attribute, "present_value", endpoint_id=2, ), 109: DPToAttributeMapping( TuyaAnalogInput.ep_attribute, "Tpresent_value", lambda x: x / 100, ), 110: DPToAttributeMapping( TuyaMCUCluster.ep_attribute, "present_value", endpoint_id=4, ), 111: DPToAttributeMapping( TuyaMCUCluster.ep_attribute, "present_value", endpoint_id=5, ), }
data_point_handlers = { 1: "_dp_2_attr_update", 104: "_dp_2_attr_update", 105: "_dp_2_attr_update", 106: "_dp_2_attr_update", 107: "_dp_2_attr_update", 108: "_dp_2_attr_update", 109: "_dp_2_attr_update", 110: "_dp_2_attr_update", 111: "_dp_2_attr_update", }
class MotionCluster(LocalDataCluster, MotionOnEvent): """Tuya Motion Sensor."""
_CONSTANT_ATTRIBUTES = {ZONE_TYPE: IasZone.ZoneType.Motion_Sensor} reset_s = 15
class TuyaManufacturerClusterMotion(TuyaManufCluster): """Manufacturer Specific Cluster of the Motion device."""
def handle_cluster_request( self, hdr: foundation.ZCLHeader, args: Tuple[TuyaManufCluster.Command], *, dst_addressing: Optional[ Union[t.Addressing.Group, t.Addressing.IEEE, t.Addressing.NWK] ] = None, ) -> None: """Handle cluster request.""" tuya_cmd = args[0] self.debug("handle_cluster_request--> hdr: %s, args: %s", hdr, args) if hdr.command_id == 0x0001 and tuya_cmd.command_id == 1027: self.endpoint.device.motion_bus.listener_event(MOTION_EVENT)
class TuyaMmwRadarMinRange(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for min range."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Min Range" ) self._update_attribute(self.attributes_by_name["min_present_value"].id, 0) self._update_attribute(self.attributes_by_name["max_present_value"].id, 950) self._update_attribute(self.attributes_by_name["resolution"].id, 10) self._update_attribute( self.attributes_by_name["engineering_units"].id, 118 ) # 31: meters
class TuyaMmwRadarMaxRange(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for max range."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Max range" ) self._update_attribute(self.attributes_by_name["min_present_value"].id, 0) self._update_attribute(self.attributes_by_name["max_present_value"].id, 950) self._update_attribute(self.attributes_by_name["resolution"].id, 10) self._update_attribute( self.attributes_by_name["engineering_units"].id, 118 ) # 31: meters
class TuyaMmwRadarDetectionDelay(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for detection delay."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Detection delay" ) self._update_attribute(self.attributes_by_name["min_present_value"].id, 000) self._update_attribute(self.attributes_by_name["max_present_value"].id, 20000) self._update_attribute(self.attributes_by_name["resolution"].id, 100) self._update_attribute( self.attributes_by_name["engineering_units"].id, 159 ) # 73: seconds
class TuyaMmwRadarFadingTime(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for fading time."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Fading time" ) self._update_attribute(self.attributes_by_name["min_present_value"].id, 0000) self._update_attribute(self.attributes_by_name["max_present_value"].id, 200000) self._update_attribute(self.attributes_by_name["resolution"].id, 1000) self._update_attribute( self.attributes_by_name["engineering_units"].id, 159 ) # 73: seconds
class TuyaMmwRadarSensitivity(TuyaAttributesCluster, AnalogOutput): """AnalogOutput cluster for sensitivity."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Sensitivity" ) self._update_attribute(self.attributes_by_name["min_present_value"].id, 1) self._update_attribute(self.attributes_by_name["max_present_value"].id, 9) self._update_attribute(self.attributes_by_name["resolution"].id, 1)
class TuyaMmwRadarTargetDistance(TuyaAttributesCluster, AnalogInput): """AnalogInput cluster for target distance."""
def init(self, *args, *kwargs): """Init.""" super().init(args, **kwargs) self._update_attribute( self.attributes_by_name["description"].id, "Target distance" ) self._update_attribute( self.attributes_by_name["engineering_units"].id, 31 ) # 31: meters
class MmwRadarMotionZYM100(CustomDevice): """Millimeter wave occupancy sensor."""
signature = { MODELS_INFO: [ ("_TZE204_ztqnh5cg", "TS0601"), ], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.SMART_PLUG, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaNewManufCluster.cluster_id, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], }, 242: {
# input_clusters=[]
# output_clusters=[33]
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
},
}
replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, MmwRadarManufCluster, TuyaOccupancySensing, TuyaAnalogInput, TuyaIlluminanceMeasurement, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], },
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarMinRange,
],
OUTPUT_CLUSTERS: [],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarMaxRange,
],
},
4: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarDetectionDelay,
],
OUTPUT_CLUSTERS: [],
},
5: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarFadingTime,
],
OUTPUT_CLUSTERS: [],
},
6: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.COMBINED_INTERFACE,
INPUT_CLUSTERS: [
TuyaMmwRadarSensitivity,
],
OUTPUT_CLUSTERS: [],
},
#### end of new replacements.
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
}
You can use this for now, at least it shows occupancy and some attributes, but clearly some of the stuff is not right.... Tried modify according to zigbee2mqtt file it still no luck for the settings and lux attribute
— Reply to this email directly, view it on GitHubhttps://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1949639553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4FSDDTV3J42OPGJIC3YUAVMBAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBZGYZTSNJVGM. You are receiving this because you authored the thread.Message ID: @.***>
umm---pretty strange, I actually modified another version of the quirk according to zigbee2mqtt. They have this TZE204_ztqnh5cg supported and their DP point is
[1, 'presence', tuya.valueConverter.trueFalse1],
[9, 'target_distance', tuya.valueConverter.divideBy100],
[104, 'illuminance_lux', tuya.valueConverter.raw],
[2, 'radar_sensitivity', tuya.valueConverter.raw],
[4, 'maximum_range', tuya.valueConverter.divideBy100],
[3, 'minimum_range', tuya.valueConverter.divideBy100],
[102, 'fading_time', tuya.valueConverter.divideBy10],
[101, 'detection_delay', tuya.valueConverter.divideBy10],
But I tried and still no lux reported. very strange, Im no quirk expert and hope someone could figure this out soon...
I think my problem is that the quirk is not used.
Really a noob at ZHA, and quirks are foreign to me.
Regards,
[signatureImage]
This e-mail and any attachments thereto are strictly confidential and are intended solely for the use of the addressee. Should you not be the intended addressee, please delete this e-mail message immediately. While care is taken in preparing this document, no representation, warranty or undertaking (expressly or implied) is given and no responsibility nor liability is accepted by the company as to the accuracy of the information contained herein, that the email is free of viruses, or for any damages that may occur from receiving or opening this email.
From: vshijiav @.> Sent: Monday, February 19, 2024 7:13:57 PM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
umm---pretty strange, I actually modified another version of the quirk according to zigbee2mqtt. They have this TZE204_ztqnh5cg supported and their DP point is [1, 'presence', tuya.valueConverter.trueFalse1], [9, 'target_distance', tuya.valueConverter.divideBy100], [104, 'illuminance_lux', tuya.valueConverter.raw], [2, 'radar_sensitivity', tuya.valueConverter.raw], [4, 'maximum_range', tuya.valueConverter.divideBy100], [3, 'minimum_range', tuya.valueConverter.divideBy100], [102, 'fading_time', tuya.valueConverter.divideBy10], [101, 'detection_delay', tuya.valueConverter.divideBy10], But I tried and still no lux reported. very strange, Im no quirk expert and hope someone could figure this out soon...
— Reply to this email directly, view it on GitHubhttps://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1952904836, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4C3W67YN6BF3QTZKFLYUOB5LAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSHEYDIOBTGY. You are receiving this because you authored the thread.Message ID: @.***>
you will have to add something like this in configuration.yaml first zha: custom_quirks_path: /config/zha_quirks/
and then upload quirks into zha_quirks folder, reload, done.
I've done all that.
Also cleared the cache etc
Regards,
[signatureImage]
This e-mail and any attachments thereto are strictly confidential and are intended solely for the use of the addressee. Should you not be the intended addressee, please delete this e-mail message immediately. While care is taken in preparing this document, no representation, warranty or undertaking (expressly or implied) is given and no responsibility nor liability is accepted by the company as to the accuracy of the information contained herein, that the email is free of viruses, or for any damages that may occur from receiving or opening this email.
From: vshijiav @.> Sent: Monday, February 19, 2024 7:23:08 PM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
you will have to add something like this in configuration.yaml first zha: custom_quirks_path: /config/zha_quirks/
and then upload quirks into zha_quirks folder, reload, done.
— Reply to this email directly, view it on GitHubhttps://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1952917093, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4APERM6EZ4OTQUK7ATYUOC7ZAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSHEYTOMBZGM. You are receiving this because you authored the thread.Message ID: @.***>
I've done all that. Also cleared the cache etc Regards, [signatureImage] This e-mail and any attachments thereto are strictly confidential and are intended solely for the use of the addressee. Should you not be the intended addressee, please delete this e-mail message immediately. While care is taken in preparing this document, no representation, warranty or undertaking (expressly or implied) is given and no responsibility nor liability is accepted by the company as to the accuracy of the information contained herein, that the email is free of viruses, or for any damages that may occur from receiving or opening this email. … ____ From: vshijiav @.> Sent: Monday, February 19, 2024 7:23:08 PM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974) you will have to add something like this in configuration.yaml first zha: custom_quirks_path: /config/zha_quirks/ and then upload quirks into zha_quirks folder, reload, done. — Reply to this email directly, view it on GitHub<#2974 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4APERM6EZ4OTQUK7ATYUOC7ZAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSHEYTOMBZGM. You are receiving this because you authored the thread.Message ID: @.***>
I just found that my newly edited quirk seems working with all options showed up... so that DP point from zigbee2mqtt is actually good.
That is awesome
Please share with me the new file.
I used another quirk and got occupance and Lux to show.
From: vshijiav @.> Sent: Saturday, February 24, 2024 1:27:04 AM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
I've done all that. Also cleared the cache etc Regards, [signatureImage] This e-mail and any attachments thereto are strictly confidential and are intended solely for the use of the addressee. Should you not be the intended addressee, please delete this e-mail message immediately. While care is taken in preparing this document, no representation, warranty or undertaking (expressly or implied) is given and no responsibility nor liability is accepted by the company as to the accuracy of the information contained herein, that the email is free of viruses, or for any damages that may occur from receiving or opening this email. … ____ From: vshijiav @.> Sent: Monday, February 19, 2024 7:23:08 PM To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974https://github.com/zigpy/zha-device-handlers/issues/2974) you will have to add something like this in configuration.yaml first zha: custom_quirks_path: /config/zha_quirks/ and then upload quirks into zha_quirks folder, reload, done. — Reply to this email directly, view it on GitHub<#2974 (comment)https://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1952917093>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4APERM6EZ4OTQUK7ATYUOC7ZAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJSHEYTOMBZGM. You are receiving this because you authored the thread.Message ID: @.***>
A64F57C3-565A-4955-AC58-BB74B327503F.png (view on web)https://github.com/zigpy/zha-device-handlers/assets/27871589/2abe7177-1233-433d-8dbe-60a1d52fbe45
I just found that my newly edited quirk seems working with all options showed up... so that DP point from zigbee2mqtt is actually good.
— Reply to this email directly, view it on GitHubhttps://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1962131920, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4EMYABYJY6SKHPRSRTYVEQURAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGEZTCOJSGA. You are receiving this because you authored the thread.Message ID: @.***>
I tested your file on my system and now it pics up more entities.
I will send you the one that provided me with Illumanance and motion detection.
Maybe with the two files combined, we can get further
From: vshijiav @.> Sent: Tuesday, 27 February 2024 07:14 To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
test.ziphttps://github.com/zigpy/zha-device-handlers/files/14414650/test.zip
— Reply to this email directly, view it on GitHubhttps://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1965801696, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4HNJGCXGUBVBJE2WGDYVVTU7AVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVHAYDCNRZGY. You are receiving this because you authored the thread.Message ID: @.***>
I tested your file on my system and now it pics up more entities. I will send you the one that provided me with Illumanance and motion detection. Maybe with the two files combined, we can get further … ____ From: vshijiav @.> Sent: Tuesday, 27 February 2024 07:14 To: zigpy/zha-device-handlers @.> Cc: Pieter Hattingh @.>; Author @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974) test.ziphttps://github.com/zigpy/zha-device-handlers/files/14414650/test.zip — Reply to this email directly, view it on GitHub<#2974 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUX4Y4HNJGCXGUBVBJE2WGDYVVTU7AVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVHAYDCNRZGY. You are receiving this because you authored the thread.Message ID: @.***>
My newly uploaded file is actually a newly modded version and it reports lux, but it just takes some time to start reporting.
Hi, I have this sensor as well. Your last post suggested a merged file with controls and sensors that is working. Can you share?
Hi, I have this sensor as well. Your last post suggested a merged file with controls and sensors that is working. Can you share?
This file is the one you need
Thanks, but this file does not expose the lux sensor… it is the same file as mentioned in the thread…
From: vshijiav @. Sent: March 14, 2024 15:35 To: zigpy/zha-device-handlers @.> Cc: illigtr @.>; Comment @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
Hi, I have this sensor as well. Your last post suggested a merged file with controls and sensors that is working. Can you share?
test.zip https://github.com/zigpy/zha-device-handlers/files/14414650/test.zip
This file is the one you need
— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1998287107, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4UNTTS3KGVPPI6ZWVF3VQDYYH3VVAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGI4DOMJQG4 . You are receiving this because you commented.Message ID: < @.***>
you will have to wait for 1 day or so. The lux will come out
On Thu, Mar 14, 2024, 12:43 illigtr @.***> wrote:
Thanks, but this file does not expose the lux sensor… it is the same file as mentioned in the thread…
From: vshijiav @. Sent: March 14, 2024 15:35 To: zigpy/zha-device-handlers @.> Cc: illigtr @.>; Comment @.> Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] TZE204_ztqnh5cg (Issue #2974)
Hi, I have this sensor as well. Your last post suggested a merged file with controls and sensors that is working. Can you share?
test.zip https://github.com/zigpy/zha-device-handlers/files/14414650/test.zip
This file is the one you need
— Reply to this email directly, view it on GitHub < https://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1998287107>,
or unsubscribe < https://github.com/notifications/unsubscribe-auth/A4UNTTS3KGVPPI6ZWVF3VQDYYH3VVAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGI4DOMJQG4>
. You are receiving this because you commented.Message ID: < @.***>
— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/2974#issuecomment-1998300411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGUUSZIMVX64VFPISK6RGCLYYH4WZAVCNFSM6AAAAABDDAFGXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGMYDANBRGE . You are receiving this because you commented.Message ID: @.***>
No change, the lux entity simply doesn't even exist in the GUI.
However, I was able to use this quirk zhaquirks/tuya/ts0601_motion.py
successfully by simply adding the correct device string to the list of supported devices. Now the lux entity appears immediately and works.
Found the answer here: https://github.com/zigpy/zha-device-handlers/pull/1928
No change, the lux entity simply doesn't even exist in the GUI.
However, I was able to use this quirk
zhaquirks/tuya/ts0601_motion.py
successfully by simply adding the correct device string to the list of supported devices. Now the lux entity appears immediately and works.Found the answer here: https://github.com/zigpy/zha-device-handlers/pull/1928
Pretty Strange I checked the file I provided it is the same as the one Im using, and it shows lux in my system. Not sure what is happening. And I take a look at the file you provided it is the first quirk I tried (I added model number as well), and it does not work on my end. So I went to zigbee2mqtt side and modified my own quirk and it is now working. Can I have a look at your product picture? I suspect it is not the same product but share a same SKU.
I can confirm this is a completely different device from the one in my hand. So it is same model number but different device.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Problem description
ZHA picks up the device but as a Smart Plug and only shows the Firmware status. I tried to use a quirk as exampled in various posts.
I added the TZE204_ztqnh5cg entry under the models sections, configured my quirks path and file and zero luck.
Could someone please assist me. I am not a coder by any stretch of the imagination.
Diagnostics.json
Configuration.yaml entry
zha: enable_quirks: true custom_quirks_path: /config/custom_zha_quirks/ database_path: /config/zigbee.db
Solution description
I would appreciate a custom quirk and some guidance in using/applying it
Screenshots/Video
Screenshots/Video
![image](https://github.com/zigpy/zha-device-handlers/assets/87018608/df2436ce-113a-4593-b9f5-69ab3822f6e2)As per the screenshot, the custom quirk is not used to id the device. HELP
Device signature
Device signature
```json { "node_descriptor": "NodeDescriptor(logical_type=Diagnostic information
Diagnostic information
```json [Paste the diagnostic information here] ```Logs
Logs
```python [Paste the logs here] ```Custom quirk
Custom quirk
```python [custom_zha_quirks.zip](https://github.com/zigpy/zha-device-handlers/files/14230615/custom_zha_quirks.zip) ```Additional information
No response