How I got it working - WZ-M100 Tuya Presence Sensor (TS0601 _TZE204_7gclukjs)

sure
do you know why when I change the parameter : Number fading_time its always back to ZERO.

by the way this looks good:

Worked with HA Versions:
Core
2024.7.3
Supervisor
2024.06.2
Operating System
12.4
Frontend
20240710.0
TS0601
by _TZE204_7gclukjs

I have given up on these devices. Was a fun try. I think you would need to have the code to modify and flash them directly to get them working. IDK… no expert. Moving on :slight_smile:

I have two of the Everything Presence One Kit’s and I just leave the PIR sensor off of it. Made it fit in a small case I 3D printed. These work great but to get one to Canada is very expensive. Better off financially buying the Aqara FP sensors I think.
I am running them both in beta mode (code). For some reason it was more reliable than the production code. I haven’t updated the firmware in months since I got them so not sure even what version I have or if there is even newer version firmware.

Just change dp_to_attribute 104 to 103 for luminance sensor, and it works

If you are referring to ‘104’ here:

),
        104: DPToAttributeMapping(
            TuyaIlluminanceMeasurement.ep_attribute,
            "measured_value",
            #converter=lambda x: int(math.log10(x) * 10000 + 1) if x > 0 else int(0),
        ),

and here:

    data_point_handlers = {
        1: "_dp_2_attr_update",
        2: "_dp_2_attr_update",
        3: "_dp_2_attr_update",
        4: "_dp_2_attr_update",
        9: "_dp_2_attr_update",
        101: "_dp_2_attr_update",
        102: "_dp_2_attr_update",
        104: "_dp_2_attr_update",

I changed those values to ‘103’ and restarted HA with no joys. I’ve also tried getting a raw value output from the sensor using ChatGPT as @aWanderer suggested, but nothing other than a 0 or 1.

I have noticed that all the ‘Controls’ values reset to default after navigating away from the page. Oh well!

Hi Everyone Do you have any idea how to use it with zigbee2mqtt? I have inserted it, but when I set a higher sensitivity value for both presence and movement, after a few seconds they return to 0. Thanks.

1 Like

same problem

Hi everyone, hope you’ve been keeping well! A bit of an update here.
I’ve played around with the code this afternoon and have gotten the custom input values to remain and work. Specifically input values for Fading Time, Delay Time, Min Range, Max Range and Sensitivity.

The indentation was incorrect within the “Mmw radar cluster” which resulted in the code not being interpreted correctly. The cluster begins at line 154, with the errors existing between lines 171 and 213. The revised code here:

  • if you copy the code from here, make sure the indentation remains correct.
    dp_to_attribute: Dict[int, DPToAttributeMapping] = {
        1: DPToAttributeMapping(
        TuyaOccupancySensing.ep_attribute,
        "occupancy",
        ),
        2: DPToAttributeMapping(
        TuyaMmwRadarSensitivity.ep_attribute,
        "present_value",
        ),
        3: DPToAttributeMapping(
        TuyaMmwRadarMinRange.ep_attribute,
        "present_value",
        endpoint_id=2,
        ),
        4: DPToAttributeMapping(
        TuyaMmwRadarMaxRange.ep_attribute,
        "present_value",
        endpoint_id=3,
        ),
        9: DPToAttributeMapping(
        TuyaMmwRadarTargetDistance.ep_attribute,
        "present_value",
        ),
        101: DPToAttributeMapping(
        TuyaMmwRadarDetectionDelay.ep_attribute,
        "present_value",
        converter=lambda x: x * 100,
        dp_converter=lambda x: x // 100,
        endpoint_id=4,
        ),
        102: DPToAttributeMapping(
        TuyaMmwRadarFadingTime.ep_attribute,
        "present_value",
        converter=lambda x: x * 100,
        dp_converter=lambda x: x // 100,
        endpoint_id=5,
        ),
        104: DPToAttributeMapping(
        TuyaIlluminanceMeasurement.ep_attribute,
        "measured_value",
        converter=lambda x: int(math.log10(x) * 10000 + 1) if x > 0 else int(0),
        ),
    }

I will update my original post with the amended code for those who come across the thread in future.

Now to get the illuminance sensor to work?

I’ve noticed the behaviour is not 100% as expected. Some values reset on their own, but not all. This could be down to the values not ‘writing’ properly still. I’ve noticed, particularly for the min/max range setting, that the value you try to input may reset quite a few times before it sticks. I’ll try to find some time to look into why that keeps happening but for now I’m happy with the small bit of progress.

Illumination now working. Wrong attribute was mapped.
Actual fix implemented for user input fields. Incorrect steps and lower & upper value limits.

See original post for updated code in its entirety, just replacing the below code will not resolve the user input issue.

Illuminance code change:

        103: DPToAttributeMapping(
        TuyaIlluminanceMeasurement.ep_attribute,
        "measured_value",
        converter=lambda x: 10000 * math.log10(x) + 1 if x != 0 else 0,
        ),
    }

    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",
    }

The change here is to replace ‘104’ with ‘103’ which was previously suggested but didn’t work for me at the time. I revisited it whilst troubleshooting the sliders and have received outputs between 0-2000lux.

1 Like

Absolutely brilliant! Instantly turned two pieces of plastic (albeit cheap!) junk into great presence sensors. How can I buy you a cup of coffee (or two!)? :smiley: :clap:

[New device support]: TS0601 _TZE204_7gclukjs · Issue #21738 · Koenkk/zigbee2mqtt · GitHub here you’ll find the answer to your question! code 104 is presence while 1 is movement!

Works like a charm, in combination with Fixt’s guide for default settings, thanks!

Damn… I threw mine away a couple months ago :frowning: hehe
Nice work all!

1 Like

Can someone convert this to zigbbe2mqtt?

There are a couple good resources available, this one is probably a good place to start - [New device support]: TS0601 _TZE204_7gclukjs · Issue #21738 · Koenkk/zigbee2mqtt · GitHub

There are some other resources I’ve linked to in my original post which you can use for context and guidance.

Did you guys figure out how the fading time works?

We have a similar sensor model in this thread and we couldn’t exactly identify how the fading time works. It’s set to a minimum of 30 seconds by default and this can’t be changed. But I was able to configure a slider which should affect the timing yet I couldn’t see any difference changing the settings.

Hi all … have someone done replacement for esp8266 and esphome?