-
Notifications
You must be signed in to change notification settings - Fork 679
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] _TZE200_v6ossqfy mmwave sensor #2059
Comments
It seems to be another Probably it is not fully functional, but once applied we can obtain more information from the logs that still allow us to adjust the operation. |
Unfortunately this does not work, ZHA is ignoring my custom quirks it seems |
Logs are filling up with
Pastebin of debug logs https://pastebin.com/CpiZRzy8 |
Ok, managed to get it added, it is only exposing Motion now, was expecting it to expose other settings and sensors..
switch: Toggle the onboard LED On/Off |
new Pastebin of debug logs |
If you are using it, the
I don't remember the AnalogInput value meaning. Your device logs is reporting (in addition to the occupancy and analog entities) the next DP:
No one have mapped the DPs to their function.
Not sure if that are the meanings of the attributes. I believe that these attributes are the one of the Maybe these are the DP 101 and 102 (in seconds?) Would match with your observations? First of all, read and write the current value. Then try to update with another value and check the behavior to understand the function. |
through testing I can see that edit, dp_103 is definitely the LED, confirmed by setting it through ZZigbee2mqtt then re-adding to ZHA and observing the value |
Just to be sure, are the attributes mapped as?:
(Not sure here if they are That would be my proposal for your device: 24Ghz mmWave radar"""Mmw radar occupancy sensor."""
import math
from typing import Dict
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import (
AnalogInput,
Basic,
GreenPowerProxy,
Groups,
Ota,
Scenes,
Time,
)
from zigpy.zcl.clusters.measurement import IlluminanceMeasurement, OccupancySensing
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.tuya import (
DPToAttributeMapping,
TuyaDPType,
TuyaLocalCluster,
TuyaNewManufCluster,
)
from zhaquirks.tuya.mcu import TuyaMCUCluster, TuyaOnOff
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 MmwRadarManufCluster(TuyaMCUCluster):
"""Mmw radar manufacturer cluster."""
# # Possible DPs and values
# presence_state: presence
# target distance: 1.61m
# illuminance: 250lux
# sensitivity: 9
# minimum_detection_distance: 0.00m
# maximum_detection_distance: 4.05m
# dp_detection_delay: 0.1
# dp_fading_time: 5.0
# ¿illuminance?: 255lux
# presence_brightness: no control
# no_one_brightness: no control
# current_brightness: off
attributes = TuyaMCUCluster.attributes.copy()
attributes.update(
{
# ramdom attribute IDs
0xEF02: ("dp_2", t.uint32_t, True),
0xEF03: ("dp_3", t.uint32_t, True),
0xEF04: ("dp_4", t.uint32_t, True),
0xEF06: ("dp_6", t.enum8, True),
0xEF69: ("dp_105", t.enum8, True),
0xEF6A: ("dp_106", t.enum8, True),
0xEF6B: ("dp_107", t.enum8, True),
0xEF6C: ("dp_108", t.uint32_t, True),
}
)
dp_to_attribute: Dict[int, DPToAttributeMapping] = {
1: DPToAttributeMapping(
TuyaOccupancySensing.ep_attribute,
"occupancy",
),
2: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_2",
),
3: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_3",
),
4: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_4",
),
6: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_6",
),
9: DPToAttributeMapping(
TuyaAnalogInput.ep_attribute,
"present_value",
lambda x: x / 100,
),
101: DPToAttributeMapping(
TuyaAnalogInput.ep_attribute,
"present_value",
),
102: DPToAttributeMapping(
TuyaAnalogInput.ep_attribute,
"present_value",
endpoint_id=2,
),
103: DPToAttributeMapping(
TuyaOnOff.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
),
104: DPToAttributeMapping(
TuyaIlluminanceMeasurement.ep_attribute,
"measured_value",
lambda x: 10000 * math.log10(x) + 1,
),
105: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_105",
),
106: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_106",
),
107: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_107",
),
108: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"dp_108",
),
}
data_point_handlers = {
1: "_dp_2_attr_update",
2: "_dp_2_attr_update",
3: "_dp_2_attr_update",
4: "_dp_2_attr_update",
6: "_dp_2_attr_update",
9: "_dp_2_attr_update",
101: "_dp_2_attr_update",
102: "_dp_2_attr_update",
103: "_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",
}
class MmwRadarMotion_var03(CustomDevice):
"""Millimeter wave occupancy sensor."""
signature = {
# endpoint=1, profile=260, device_type=81, device_version=1,
# input_clusters=[4, 5, 61184, 0], output_clusters=[25, 10])
MODELS_INFO: [
("_TZE200_0u3bj3rc", "TS0601"),
("_TZE200_mx6u6l4y", "TS0601"),
("_TZE200_v6ossqfy", "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,
TuyaOnOff,
TuyaAnalogInput,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
INPUT_CLUSTERS: [
TuyaAnalogInput,
],
OUTPUT_CLUSTERS: [],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
} Not sure about the Edit: fix |
logs are here |
Should this section have definitions for dp_101 - 103?
Also device signature has changed?
|
If I edit your quirk to add in DP_101 and DP_102, I can query those and see the correct integer values, not sure how I add to the quirk to expose those values back to HA though
|
No if we want to expose as new entities. 103: DPToAttributeMapping(
TuyaOnOff.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
), I have edit the code to fix the switch problem. Looking for a way to expose the dp_102 and dp_103. |
No direct way to get the values in HA. Probably the way would by to create custom sensors just like these: But that will require to create the quirk and then modify HA. |
After looking at Z2M my final proposal would be: 24Ghz mmWave radar"""Human Presence Sensor 24GHz."""
from typing import Dict
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zigpy.zcl.clusters.measurement import OccupancySensing
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.tuya import TuyaLocalCluster
from zhaquirks.tuya.mcu import (
DPToAttributeMapping,
TuyaDPType,
TuyaMCUCluster,
TuyaOnOffNM,
)
class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster):
"""Tuya local OccupancySensing cluster."""
class MmwRadarManufCluster(TuyaMCUCluster):
"""Human Presence Sensor 24GHz."""
attributes = TuyaMCUCluster.attributes.copy()
attributes.update(
{
# ramdom attribute IDs
0xEF65: ("duration_of_attendance", t.uint32_t, True),
0xEF66: ("duration_of_absence", t.uint32_t, True),
}
)
dp_to_attribute: Dict[int, DPToAttributeMapping] = {
1: DPToAttributeMapping(
TuyaOccupancySensing.ep_attribute,
"occupancy",
dp_type=TuyaDPType.VALUE,
),
101: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"duration_of_attendance",
dp_type=TuyaDPType.VALUE,
),
102: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"duration_of_absence",
dp_type=TuyaDPType.VALUE,
),
103: DPToAttributeMapping(
TuyaOnOffNM.ep_attribute,
"on_off",
dp_type=TuyaDPType.BOOL,
),
}
data_point_handlers = {
1: "_dp_2_attr_update",
101: "_dp_2_attr_update",
102: "_dp_2_attr_update",
103: "_dp_2_attr_update",
}
class MmwRadarMotion_var03(CustomDevice):
"""Millimeter wave occupancy sensor."""
signature = {
# endpoint=1, profile=260, device_type=81, device_version=1,
# input_clusters=[4, 5, 61184, 0], output_clusters=[25, 10])
MODELS_INFO: [
("_TZE200_0u3bj3rc", "TS0601"),
("_TZE200_mx6u6l4y", "TS0601"),
("_TZE200_v6ossqfy", "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,
TuyaMCUCluster.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,
TuyaOnOffNM,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
} If the quirk is working for you, then we can try to create the entities in HA. |
That throws an error, just looking now
|
I have updated the import statement for the |
Appreciate all your help, however it still errors
|
I have updated the rest of |
No need to apologise :) |
Could you attach the log error? |
|
Arrrrrgh! |
Well, the good news is there is no error anymore that I can see, however the button still doesn't do anything :(
|
to be 100% clear, I toggle the button, and after a few seconds it slides back again with no results. |
Another try: |
Genius, thats the switch working :) now to just add those values to HA! |
Are you able to edit the HA classes? As custom components or editing directly the container? I'll come back later to see how can be done. |
Yes they are minutes - not sure how to edit the classes? |
I got the wall mounted one, 5v
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Alex Valtchev ***@***.***>
Sent: Monday, January 23, 2023 7:16:08 PM
To: zigpy/zha-device-handlers ***@***.***>
Cc: Jimmy White ***@***.***>; Author ***@***.***>
Subject: Re: [zigpy/zha-device-handlers] [Device Support Request] _TZE200_v6ossqfy mmwave sensor (Issue #2059)
The USA Wall mounted one (square) or the ceiling version (round)?
—
Reply to this email directly, view it on GitHub<#2059 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHVAB6N2XCZWJKUO3W7JSTWT3KHRANCNFSM6AAAAAATPRIM6Y>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Thanks. Does it work out of the box with ZHA? No need for additional quirks and device handles are extra steps? |
The attributes can be 'exposed' in HA creating a new ZHA sensor like this: @MULTI_MATCH(
channel_names="tuya_manufacturer",
manufacturers={
"_TZE200_0u3bj3rc",
"_TZE200_mx6u6l4y",
"_TZE200_v6ossqfy",
},
)
class AttendanceTime(Sensor, id_suffix="duration_of_attendance"):
"""Sensor that displays the attendance time."""
SENSOR_ATTR = "duration_of_attendance"
_attr_device_class: SensorDeviceClass = SensorDeviceClass.DURATION
_attr_icon = "mdi:timer"
_attr_name: str = "Attendance time"
_attr_native_unit_of_measurement = UnitOfTime.MINUTES It's just the same approach that is already implemented here: Edit to add the code in the PS: probably sensor names can get proper names. |
@javicalle this what is this new code above? Should I replace those lines in my original ts0601_sensor_custom.py ? I am getting confused. Can you please explain in simple English what does this do, and how to implement it. I do not see ZHA directory with a sensor.py file. Sorry for being lame, I am just very new and need step by step guide. Thank you. |
Jimmy was asking me how to expose the cluster attributes in HA, and that code shows how can be done.
No, that code is for update the ZHA integration.
Most of the code is untested and prone to bugs, so it needs to be tested by someone who knows what they're doing so we can focus on the code. |
Yes, I have very basic knowledge, and agree would be better to wait until is implemented into HA. How long does it take for something like that to get official support, as I see you guys have been working already for a while. Thank you. |
Guys I got a problem. The sensor was working it was taking about 1-2 second to change from "clear" to "detected" and about 65 seconds to from "detected" to "clear" and in Home Assistant. I then paired it with Smart Home app to check how is there and to see the other options available, and it got stuck on "detected" and now it never changes" I removed it from Smart Life and re-added, but does not work. I removed it and added into Home Assistant and still does not work. All it shoes is "detected" and even after 1 hour in the closet alone, still shows that. I tried to press fast the reset button 10 times, or to keep it on for 10s or other methods and nothing helps. How can I reboot the sensor to start working again ? Please help |
Sorry for the late response. |
Does that still work for you with zha in Home Assistant 2023.3.0? Seems to have a problem with the TuyaDPType stuff what I read in a different post. |
I've got the same thing and isnt working for me. Even after I have deleted the lines for it. |
Check this: |
I did exactly the same like you are commenting, but didnt work. I will try this again and let you know. Thanks. |
I updated the file like this and it works again. I have my Sensor back working and aha still works like expected. |
Thanks Sky. Can you repost it in plain text, so I can copy it easily? Will gonna try it tonight. I appreciate it. |
|
Thanks! |
Thank you guys! Just got mine and added it with the custom quirk. The Led fortunatelly goes off with the switch and the occupancy sensor seems to work. Is there anything I can do to minimum the delay from on to off? It stays on some time with no occupancy |
You need to update the cluster attribute |
I have already done that, both are 0 but aren't the values populated from the sensor (how many minutes did detect presence...)? |
Yes that's true 😓 Then there is no configuration for that property. |
I put this into my my configuration.yaml filezha:
|
so my model is the TZE204_qasjif9e does this work ? |
Looks like this has been updated to the MODELS_INFO: [
("_TZE200_0u3bj3rc", "TS0601"),
("_TZE200_mx6u6l4y", "TS0601"),
("_TZE200_v6ossqfy", "TS0601"),
("_TZE204_qasjif9e", "TS0601"),
], But I couldn't get it showing up correctly. I bought it from https://www.aliexpress.com/item/1005005709438307.html |
My bad, I got it working for """Human Presence Sensor 24GHz."""
from typing import Dict
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zigpy.zcl.clusters.measurement import OccupancySensing
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.tuya import TuyaLocalCluster
from zhaquirks.tuya.mcu import (
DPToAttributeMapping,
TuyaMCUCluster,
TuyaOnOffNM,
)
class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster):
"""Tuya local OccupancySensing cluster."""
class MmwRadarManufCluster(TuyaMCUCluster):
"""Human Presence Sensor 24GHz."""
attributes = TuyaMCUCluster.attributes.copy()
attributes.update(
{
# ramdom attribute IDs
0xEF65: ("duration_of_attendance", t.uint32_t, True),
0xEF66: ("duration_of_absence", t.uint32_t, True),
}
)
dp_to_attribute: Dict[int, DPToAttributeMapping] = {
1: DPToAttributeMapping(
TuyaOccupancySensing.ep_attribute,
"occupancy"
),
101: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"duration_of_attendance"
),
102: DPToAttributeMapping(
TuyaMCUCluster.ep_attribute,
"duration_of_absence"
),
103: DPToAttributeMapping(
TuyaOnOffNM.ep_attribute,
"on_off"
),
}
data_point_handlers = {
1: "_dp_2_attr_update",
101: "_dp_2_attr_update",
102: "_dp_2_attr_update",
103: "_dp_2_attr_update",
}
class MmwRadarMotion_var03(CustomDevice):
"""Millimeter wave occupancy sensor."""
signature = {
# endpoint=1, profile=260, device_type=81, device_version=1,
# input_clusters=[4, 5, 61184, 0], output_clusters=[25, 10])
MODELS_INFO: [
("_TZE200_0u3bj3rc", "TS0601"),
("_TZE200_mx6u6l4y", "TS0601"),
("_TZE200_v6ossqfy", "TS0601"),
("_TZE204_qasjif9e", "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,
TuyaMCUCluster.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,
TuyaOnOffNM,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
}
} |
im going to close this off, as I've since abandoned ZHA in favour of Zigbee2mqtt |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
_TZE200_v6ossqfy mmwave sensor is detected as a plug this is a MMwave sensor https://zigbee.blakadder.com/Tuya_PS-HPS.html
Device signature
Diagnostic information
Additional logs
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: