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

ZM-RT201 PIR Motion Sensor #7564

Closed
frankiha opened this issue May 22, 2021 · 105 comments
Closed

ZM-RT201 PIR Motion Sensor #7564

frankiha opened this issue May 22, 2021 · 105 comments
Labels
new device support New device support request stale Stale issues

Comments

@frankiha
Copy link

Information about the device + link

https://www.aliexpress.com/item/1005002420495341.html?spm=a2g0s.9042311.0.0.248d4c4dEHPA1V

data/database.db entry of the device

{"id":5,"type":"EndDevice","ieeeAddr":"0x00124b0005ad88b1","nwkAddr":52292,"manufId":0,"epList":[1],"endpoints":{"1":{"epId":1,"inClusterList":[],"outClusterList":[],"clusters":{"genPowerCfg":{"attributes":{"batteryVoltage":30,"batteryPercentageRemaining":160}},"ssIasZone":{"attributes":{"zoneStatus":0}}},"binds":[],"configuredReportings":[],"meta":{}}},"interviewCompleted":false,"meta":{},"lastSeen":1621707189864}

@frankiha frankiha added the new device support New device support request label May 22, 2021
@bootuz-dinamon
Copy link

bootuz-dinamon commented May 23, 2021

I also received this device today. The box says ZM-RT-201, the instructions are ZM-35ZH-Q. And he also did not want to connect - he writes that the device is unsupported.

I read on this forum that some devices throw out the modelid and manufacturerName too quickly and the zigbee2mqtt does not have time to receive this data.

But after numerous attempts to connect the device, one day instead of "undefined" I saw TS0202 and _TYZB01_dl7cejts.

Now trying to make a converter.

@Atheos46
Copy link

Hello,

I received these sensors ZM-RT201 today but I can't get it to learn my zigbee. How can I do this? Am new and can not code. I have Proxmox and IoBroker running as a VM and have the CC26X2R1. All zigbee devices work without problems.

@bootuz-dinamon
Copy link

I get this message when the motion sensor is triggered:

Debug Received Zigbee message from '0x00124b0005b4bd43', type 'attributeReport', cluster 'ssIasZone', data '{"zoneStatus":1}' from endpoint 1 with groupID 0

But I don't have enough knowledge to write a converter, and even with a timer.
But the device can work with a zigbee2mqtt.

@MarcelJ28
Copy link

I also have this item. I hope it can be included so I can use it.

@bootuz-dinamon
Copy link

bootuz-dinamon commented May 24, 2021

it is not a complete converter, but it is enough for the device to work.
The delay is set to 10 seconds.
Be sure to replace the ieee_address in the code with the ieee_address of your device.


see below

@Koenkk
Copy link
Owner

Koenkk commented May 24, 2021

Can you try with:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: [{modelID: 'TS0202', manufacturerName: '_TYZB01_dl7cejts'}],
    zigbeeModel: ['TS0202'],
    model: 'TS0202',
    vendor: 'TuYa',
    description: 'Motion sensor',
    fromZigbee: [fz.ias_occupancy_alarm_1],
    toZigbee: [],
    exposes: [e.occupancy(), e.battery_low(), e.tamper()],
};

If the modelID of your device is undefined, try pairing it again close to the coordinator, also make sure you are on z2m 1.18.3

@bootuz-dinamon
Copy link

Unfortunately, the number of attempts to connect and get the correct modelID has reached 50-60.
and I honestly tried to do as you wrote, but either something is wrong or I don't have enough experience.

The ias_occupancy_alarm_1 converter has cluster: 'ssIasZone', and type: 'commandStatusChangeNotification'.
And this device cluster: 'ssIasZone', and type: 'attributeReport'.

But I'll try again.
And z2m is 1.18.3-dev

@Koenkk
Copy link
Owner

Koenkk commented May 24, 2021

@bootuz-dinamon could you provide the herdsman debug log when pairing the device?

See https://www.zigbee2mqtt.io/information/debug.html#zigbee-herdsman-debug-logging on how to enable the herdsman debug logging. Note that this is only logged to STDOUT and not to log files.

@Atheos46
Copy link

Atheos46 commented May 24, 2021

I always get these messages in the log:

zigbee.0 2021-05-24 23:22:57.331 info (9750) Zigbee: stop joining
zigbee.0 2021-05-24 23:22:28.325 warn (9750) Device '0x00124b00060ea04e' announced itself
zigbee.0 2021-05-24 23:22:27.581 info (9750) Starting interview of '0x00124b00060ea04e'
zigbee.0 2021-05-24 23:21:56.101 info (9750) Zigbee: allowing new devices to join.

image

@MarcelJ28
Copy link

The one from bootuz-dinamon works for me! The only thing that is not working is the battery level but for this moment I am happy.

@Atheos46
Copy link

The one from bootuz-dinamon works for me! The only thing that is not working is the battery level but for this moment I am happy.

Hey Marcel,
for me it would also be enough if it works. The battery display is not important for now. What exactly do I have to do? Have really no experience at all what I should do with the code? Would be happy if you help me.

@MarcelJ28
Copy link

The one from bootuz-dinamon works for me! The only thing that is not working is the battery level but for this moment I am happy.

Hey Marcel,
for me it would also be enough if it works. The battery display is not important for now. What exactly do I have to do? Have really no experience at all what I should do with the code? Would be happy if you help me.

Well I have only nailed it after very much searching and I am not sure anymore what I exactly did at the beginning. So I am sorry I cannot help you....

@bootuz-dinamon
Copy link

bootuz-dinamon commented May 25, 2021

https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html

This is an instruction for adding external converters.

@chrisrock1984
Copy link

it is not a complete converter, but it is enough for the device to work.
The delay is set to 10 seconds.
Be sure to replace the ieee_address in the code with the ieee_address of your device.


//       Converter for TS004F.        https://www.youtube.com/channel/UCJRaKbgv8u1O4OwG-0D3uRw
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;

const motionSensorDetector = {
    cluster: 'ssIasZone',
    type: ['attributeReport'],
    convert: (model, msg, publish, options, meta) => {
            if (msg.data.zoneStatus !== 1) {
                // In case of 0 no occupancy is reported.
                // https://github.com/Koenkk/zigbee2mqtt/issues/467
                return;
            }

            // The occupancy sensor only sends a message when motion detected.
            // Therefore we need to publish the no_motion detected by ourselves.
            const timeout = options && options.hasOwnProperty('occupancy_timeout') ?
                options.occupancy_timeout : 10;   // occupancy delay in seconds

            // Stop existing timers because motion is detected and set a new one.
            globalStore.getValue(msg.endpoint, 'timers', []).forEach((t) => clearTimeout(t));
            globalStore.putValue(msg.endpoint, 'timers', []);

            if (timeout !== 0) {
                const timer = setTimeout(() => {
                    publish({occupancy: false});
                }, timeout * 1000);

                globalStore.getValue(msg.endpoint, 'timers').push(timer);
            }

            // No occupancy since
            if (options && options.no_occupancy_since) {
                options.no_occupancy_since.forEach((since) => {
                    const timer = setTimeout(() => {
                        publish({no_occupancy_since: since});
                    }, since * 1000);
                    globalStore.getValue(msg.endpoint, 'timers').push(timer);
                });
            }

            if (options && options.no_occupancy_since) {
                return {occupancy: true, no_occupancy_since: 0};
            } else {
                return {occupancy: true};
            }
        
            }
};


 const definition = {
//    fingerprint: [{modelID: 'TS0202', manufacturerName: '_TYZB01_dl7cejts'}],
    fingerprint: [{ieee_address: '0x00124b0005b4bd43'}],   // WARNING! Change this ieee_address for yours ieee_address!!!!
    zigbeeModel: ['TS0202'],
    model: 'TS0202',
    vendor: 'TuYa',
    description: 'Motion sensor',
    fromZigbee: [ motionSensorDetector ],
    toZigbee: [],
    exposes: [e.occupancy()],
};


module.exports = definition;

works for me. I was also not able to fully interview the PIR on 1.8.3 dev even on very close distance.

@Atheos46
Copy link

The one from bootuz-dinamon works for me! The only thing that is not working is the battery level but for this moment I am happy.

Hey Marcel,
for me it would also be enough if it works. The battery display is not important for now. What exactly do I have to do? Have really no experience at all what I should do with the code? Would be happy if you help me.

Well I have only nailed it after very much searching and I am not sure anymore what I exactly did at the beginning. So I am sorry I cannot help you....

Thanks anyway. I'll have to keep looking then.

https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html

This is an instruction for adding external converters.

I have already looked at this but unfortunately did not understand it. When I get off work, I'll have another look at it. I just do not know how to integrate the code with the CC26X2R1 what is plugged with usb on NUC Proxmox.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue May 25, 2021
@Koenkk
Copy link
Owner

Koenkk commented May 25, 2021

Added the device.
Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html)

@Schnittcher
Copy link

@Koenkk, what can i do, when the device sends model undefined?
Its the TS0202 _TYZB01_dl7cejts.

@Koenkk
Copy link
Owner

Koenkk commented May 25, 2021

@Schnittcher if you see TS0202 _TYZB01_dl7cejts the model ID isn't undefined since that is the model, or do you mean something else?

@Schnittcher
Copy link

I have repaired the device.
Yesterday i get the model and the manufacture. Today i get model and manufacture as undefined.
When i try to pair the device with tasmota, i get the model id and the manufacture.

So i think this is a problem with zigbee2mqtt. I have a debug: https://pastebin.com/xZFnh7gP

Can you help?

@Koenkk
Copy link
Owner

Koenkk commented May 25, 2021

@Schnittcher the log doesn't reveal much (device doesn't event connect). Can you make a sniff of the pairing attempt? https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

@Schnittcher
Copy link

very interesting, now the device has been found again!

I will try your new version. I used docker is this already online?

@Koenkk
Copy link
Owner

Koenkk commented May 25, 2021

Will be available in 1 hour from now (use latest-dev tag)

@Schnittcher
Copy link

Schnittcher commented May 25, 2021 via email

@bootuz-dinamon
Copy link

bootuz-dinamon commented May 25, 2021

Already with a battery (you need to remove the battery and insert it back).
This is not yet an official solution to the issue.
If you still need an extended log, tell me, I will.

see below

@Schnittcher
Copy link

@bootuz-dinamon, with your code, the pir works.
So i get the occupancy value.
But after it clears, i get a long time no new occupied value.
Do you know how long is the timeout?

But the interview of this device failed again.

@bootuz-dinamon
Copy link

options.occupancy_timeout : 10; // occupancy delay in seconds

@Steefph
Copy link

Steefph commented Jun 17, 2021

@Koenkk Hey Koen, if you have time, would it help if I send a ZM-CG206 and ZM-RT201 towards you?

@batman84uk
Copy link

Hi,

I'm trying to do the same as other posters here but have fallen over with an error message that I can't see mentioned in this post. Apologies if this is a really stupid question but I haven't had the chance (or capability) to dig into any of the zigbee-herdsman stuff that does the heavy lifting.

  • Up until now zigbee2mqtt has been working perfectly with a range of devices (Ikea Tradfri and Aqara).
  • I had the same initial problem as other people with this ZM-RT201. Device failing interview, showing up with a red exclamation mark, log file noting "unidentified, unidentified" ...
  • I tried using the dev branch but this made no difference for me. The version looks like 1.9.1-10, modified ~20 days ago.
  • Instead, I went back to the master and tried the external converter route. This is my first time trying this.
  • I created an .js file (lifting the final version of code described in this post).
  • I placed it in the \share\zigbee2mqtt folder.
  • I updated the zigbee2mqtt config to call out this file.
  • When I restart Zigbee2mqtt I now get the message
    Error: Cannot find module 'zigbee-herdsman-converters/lib/extend'
    I guess it's to do with the 4th line below, but doesn't appear to be finding errors with the preceding similar statements.
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');

I can obviously figure out how to post some log files but it feels like I've done something pretty basic wrong.

Any pointers would be appreciated.

Thanks,

Paul

@bootuz-dinamon
Copy link

bootuz-dinamon commented Jun 26, 2021

You can delete this string.

//       Converter for ZM-RT201 ZM-35ZH-Q with battery now.        https://www.youtube.com/channel/UCJRaKbgv8u1O4OwG-0D3uRw
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
// const extend = require('zigbee-herdsman-converters/lib/extend');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const motionSensorDetector = {
    cluster: 'ssIasZone',
    type: ['attributeReport'],
    convert: (model, msg, publish, options, meta) => {
            if (msg.data.zoneStatus !== 1) {
                // In case of 0 no occupancy is reported.
                // https://github.com/Koenkk/zigbee2mqtt/issues/467
                return;
            }

            // The occupancy sensor only sends a message when motion detected.
            // Therefore we need to publish the no_motion detected by ourselves.
            const timeout = options && options.hasOwnProperty('occupancy_timeout') ?
                options.occupancy_timeout : 20;   // occupancy delay in seconds

            // Stop existing timers because motion is detected and set a new one.
            globalStore.getValue(msg.endpoint, 'timers', []).forEach((t) => clearTimeout(t));
            globalStore.putValue(msg.endpoint, 'timers', []);

            if (timeout !== 0) {
                const timer = setTimeout(() => {
                    publish({occupancy: false});
                }, timeout * 1000);

                globalStore.getValue(msg.endpoint, 'timers').push(timer);
            }

            // No occupancy since
            if (options && options.no_occupancy_since) {
                options.no_occupancy_since.forEach((since) => {
                    const timer = setTimeout(() => {
                        publish({no_occupancy_since: since});
                    }, since * 1000);
                    globalStore.getValue(msg.endpoint, 'timers').push(timer);
                });
            }

            if (options && options.no_occupancy_since) {
                return {occupancy: true, no_occupancy_since: 0};
            } else {
                return {occupancy: true};
            }
        
            }
};

 const definition = {
//   fingerprint: [{modelID: 'TS0202', manufacturerName: '_TYZB01_dl7cejts'}],
    fingerprint: [{type: 'EndDevice', ieee_address: '0x00124b0005b4bd43'}],   // WARNING! Change this ieee_address for yours ieee_address!!!!
    zigbeeModel: ['TS0202'],
    model: 'ZM-RT201',
    vendor: 'TuYa',
    description: 'Motion sensor',
    fromZigbee: [ motionSensorDetector, fz.battery ],
    //fromZigbee: [ motionSensorDetector, fz.battery, fz.ignore_basic_report ],
    toZigbee: [],
    exposes: [e.occupancy(), e.battery_low(), e.battery()],
};

module.exports = definition;

@batman84uk
Copy link

Thanks @bootuz-dinamon, that's impressive service! It's now completed startup and the device is recognised with link quality and battery.
Still failing interview but I expected that based on other posts here.
It's also not actually detecting occupancy at the moment but I'm significantly further on!

Thanks,

Paul

@bootuz-dinamon
Copy link

Must work!

It's also not actually detecting occupancy at the moment but I'm significantly further on!

@TrurlMcByte
Copy link

My version of same converter for ioBroker zigbee module (not zigbee2mqtt, but zigbee-herdsman-converters)

// Converter for ZM-RT201 ZM-35ZH-Q with battery now.
// https://www.youtube.com/channel/UCJRaKbgv8u1O4OwG-0D3uRw
//
const fz = require("zigbee-herdsman-converters/converters/fromZigbee");
const tz = require("zigbee-herdsman-converters/converters/toZigbee");
const exposes = require("zigbee-herdsman-converters/lib/exposes");
const extend = require("zigbee-herdsman-converters/lib/extend");
const globalStore = require("zigbee-herdsman-converters/lib/store");
const e = exposes.presets;
const ea = exposes.access;
const { setTimeout, clearTimeout } = require("timers");

const motionSensorDetector = {
  cluster: "ssIasZone",
  type: "attributeReport",
  convert: (model, msg, publish, options, meta) => {
    const payload = {
      tamper: (msg.data.zoneStatus & (1 << 2)) > 0,
      battery_low: (msg.data.zoneStatus & (1 << 3)) > 0,
    };
    if (msg.data.zoneStatus !== 1) {
      // In case of 0 no occupancy is reported.
      // https://github.com/Koenkk/zigbee2mqtt/issues/467
      return payload;
    }
    // The occupancy sensor only sends a message when motion detected.
    // Therefore we need to publish the no_motion detected by ourselves.
    const timeout =
      options && options.hasOwnProperty("occupancy_timeout")
        ? options.occupancy_timeout
        : 300; // occupancy delay in seconds

    // Stop existing timers because motion is detected and set a new one.
    globalStore
      .getValue(msg.endpoint, "timers", [])
      .forEach((t) => clearTimeout(t));
    globalStore.putValue(msg.endpoint, "timers", []);
    //
    if (timeout !== 0) {
      const timer = setTimeout(() => {
        payload.occupancy = false;
        publish(payload);
        // publish({ occupancy: false });
      }, timeout * 1000);
      globalStore.getValue(msg.endpoint, "timers").push(timer);
    }
    // No occupancy since
    if (options && options.no_occupancy_since) {
      options.no_occupancy_since.forEach((since) => {
        const timer = setTimeout(() => {
          payload.no_occupancy_since = since;
          publish(payload);
          // publish({ no_occupancy_since: since });
        }, since * 1000);
        globalStore.getValue(msg.endpoint, "timers").push(timer);
      });
    }

    if (options && options.no_occupancy_since) {
      payload.occupancy = true;
      payload.no_occupancy_since = 0;
    } else {
      payload.occupancy = true;
      // delete payload.no_occupancy_since;
    }
    return payload;
  },
};

const definition = {
  fingerprint: [{ modelID: 'TS0202', manufacturerName: '_TYZB01_dl7cejts' },
    { ieee_address: "0x00124b000" }], // WARNING! Change this ieee_address for yours ieee_address!!!!
  zigbeeModel: ["TS0202"],
  model: "ZM-RT201",
  vendor: "TuYa",
  description: "Motion sensor",
  fromZigbee: [
    motionSensorDetector,
    fz.battery,
    // fz.ignore_basic_report,
  ],
  toZigbee: [],
  exposes: [e.occupancy(), e.battery_low(), e.battery()],
};

module.exports = definition;

@batman84uk
Copy link

I solved the remaining problem without having to get into the guts of herdsman (for today at least :-)).
I needed to define clearTimeout as per @TrurlMcByte 's post above.
const { setTimeout, clearTimeout } = require("timers");

Thanks @TrurlMcByte and @bootuz-dinamon.
I'll keep watching this post to see if this can be made to work without the external converter, but for now I'm sorted.

zigbee2mqtt log was showing that zone status (occupancy) was getting through. It looks like it was just falling over on the receive event, not knowing what to do with setTimeout.

Debug Received Zigbee message from 'Tuya Motion Sensor', type 'attributeReport', cluster 'ssIasZone', data '{"zoneStatus":1}' from endpoint 1 with groupID 0
Error Failed to call 'Receive' 'onZigbeeEvent' (ReferenceError: setTimeout is not defined at Object.convert (/app/lib/util/externally-loaded.js:31:31) at /app/lib/extension/receive.js:159:41 at Array.forEach (<anonymous>) at Receive.onZigbeeEvent (/app/lib/extension/receive.js:158:20) at Controller.callExtensionMethod (/app/lib/controller.js:380:44))

Must work!

It's also not actually detecting occupancy at the moment but I'm significantly further on!

@freitas666
Copy link

freitas666 commented Jun 27, 2021 via email

@dessone
Copy link

dessone commented Jun 28, 2021

Hello friend sorry for my delay... Actually i am using a converter and works well... without “exclamation”... For me everything is ok.... Enviado do meu iPhone Em 31 de mai. de 2021, à(s) 14:10, Koen Kanters @.***> escreveu:  @freitas666https://github.com/freitas666 what do you get without the external converter? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#7564 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQ7DLVVH6ZOFOTCQ6BZHUDTQO7ITANCNFSM45K42AWQ.

Which converter? Thanks!

@Atheos46
Copy link

Hello,

can someone please help me? I do not know anything about programming. In the meantime I have at least managed to get it to work and the occupancy changes to true and false. Battery indicator does not work and the icon is not displayed. With the code from chrisrock1984 I see the icon but Occupancy is not true.
image
image
Only the link_quality is work.

With the code from TrurlMcByte it works but here the icon does not work.
image

image

How can I do that both works? Can anyone help me?

@jchurchward
Copy link

jchurchward commented Jul 27, 2021

Thanks guys the motion sensor is finally working. I made some minor changes to the driver here.
ZM-RT201_motionsensor.txt

@freitas666
Copy link

Hello guys i have one doubt...

Actually i am using a external converter for my sensor and its works fine...
And i use this converter to control the time of occupancy timeout...
How can I control this timeout without converter?
Once that my z2m recognize my sensors without "external converter" but i did not know how to control this timeout....

Someone can help me?

@Koenkk

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Aug 28, 2021
@ncodee
Copy link

ncodee commented Sep 2, 2021

Having a similar, but using ZHA integration with Home Assistant:

[0x71c1] Extending timeout for 0x37 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x9803 ieee=00:12:4b:00:0a:8c:2b:a5 is_initialized=False> from ep 1 to ep 255, cluster 3: b'\x11\x08\x01'
[0x9803] Received ZCL while uninitialized on endpoint id 1, cluster 0x0003 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=True> manufacturer=None tsn=8 command_id=1>, payload: b''
[0x3DCC](SA-003-Zigbee): Attempting to checkin with device - missed checkins: 2
Received frame on uninitialized device <Device model=None manuf=None nwk=0x9803 ieee=00:12:4b:00:0a:8c:2b:a5 is_initialized=False> from ep 1 to ep 1, cluster 1280: b'\x18d\n\x02\x00!\x01\x00'
[0x9803] Received ZCL while uninitialized on endpoint id 1, cluster 0x0500 id, hdr: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=100 command_id=Command.Report_Attributes>, payload: b'\x02\x00!\x01\x00'
[0x9803] Uninitialized device command 'Command.Report_Attributes' args: [[Attribute(attrid=2, value=<TypeValue type=uint16_t, value=1>)]]
Received frame on uninitialized device <Device model=None manuf=None nwk=0x9803 ieee=00:12:4b:00:0a:8c:2b:a5 is_initialized=False> from ep 0 to ep 0, cluster 32772: b'5\x00\x03\x98\x18\x01\x04\x01\x02\x04\x01\x04\x00\x00\x03\x00\x01\x00\x00\x05\x04\x00\x00\x03\x00\x01\x00\x00\x05'
[0x9803:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=1026, device_version=1, input_clusters=[0, 3, 1, 1280], output_clusters=[0, 3, 1, 1280])```

@guilhermeaiolfi
Copy link

I am still waiting for an out of the box solution for this hardware. This issue should be reopen.

@abu9
Copy link

abu9 commented Sep 11, 2021

I am still waiting for an out of the box solution for this hardware. This issue should be reopen.

Try update to Z2M 1.21.1 and re-pair the sensor. Mine is work without external converter.

@danijelstuden
Copy link

danijelstuden commented Sep 16, 2021

I am still waiting for an out of the box solution for this hardware. This issue should be reopen.

Try update to Z2M 1.21.1 and re-pair the sensor. Mine is work without external converter.

running 1.21.1 stable (not tried Edge yet) the ZM-RT201 is detected, fails the interview, but stays on the list of devices, If i make movements above the sensor i can see the debug logs generating "Received message from unsupported device with Zigbee model 'undefined' and manufacturer name 'undefined'". I havent played with the external converters yet (Very new to this) so agree with guilhermeaiolfi, should be reopened

@danijelstuden
Copy link

danijelstuden commented Sep 16, 2021

I take it back, it just showed up properly... :)

edit: was recognized as a tuya model TS0202 and was not working

@guilhermeaiolfi
Copy link

I've installed the 1.21.1-1 stable and it was recognized as TS0202 and it's not working. I've tried installing, uninstalling, removing the devices and tries again. Nothing works. Can somebody, please, confirm it should work in 1.21.1 without any converter?

@maimrn
Copy link

maimrn commented Sep 20, 2021

I've installed the 1.21.1-1 stable and it was recognized as TS0202 and it's not working. I've tried installing, uninstalling, removing the devices and tries again. Nothing works. Can somebody, please, confirm it should work in 1.21.1 without any converter?

It's not working for me. Neither with or without converter. Neither 1.21.1 or Edge version.

@schindlershadow
Copy link

I have 4 of these. somehow one of them is working but the others are failing interview and giving the same unsupported device errors

@smartesthomeever
Copy link

I have 4 of these. somehow one of them is working but the others are failing interview and giving the same unsupported device errors

I have 2 of these, 1 works just fine, the other one failing interviewing.
I am running the latest dev on a CC2652P.

I am looking forward for resolution on that?

@mahlernim
Copy link

Thanks guys the motion sensor is finally working. I made some minor changes to the driver here.
ZM-RT201_motionsensor.txt

Thank you @jchurchward this external driver works for me. (battery, battery_low, occupancy, linkquality)
In my case the manufacturerName is _TYZB01_hqbdru35
The exclamation mark(I assume this is the red blur in the icon of the device?) is present though.

@Koenkk Any chance this will get supported?
The following is the database.db entry for my device
{"id":19,"type":"EndDevice","ieeeAddr":"0x00124b00179a2924","nwkAddr":47515,"manufId":0,"manufName":"_TYZB01_hqbdru35","powerSource":"Battery","modelId":"TS0202","epList":[1],"endpoints":{"1":{"epId":1,"inClusterList":[],"outClusterList":[],"clusters":{"genPowerCfg":{"attributes":{"batteryVoltage":30,"batteryPercentageRemaining":200}},"ssIasZone":{"attributes":{"zoneStatus":1}},"genBasic":{"attributes":{"modelId":"TS0202","manufacturerName":"_TYZB01_hqbdru35"}}},"binds":[],"configuredReportings":[],"meta":{}}},"interviewCompleted":true,"meta":{},"lastSeen":1632756110789} {"id":20,"type":"EndDevice","ieeeAddr":"0x00124b001babbcb4","nwkAddr":20568,"manufId":0,"manufName":"_TYZB01_hqbdru35","powerSource":"Battery","modelId":"TS0202","epList":[1],"endpoints":{"1":{"epId":1,"inClusterList":[],"outClusterList":[],"clusters":{"genPowerCfg":{"attributes":{"batteryVoltage":30,"batteryPercentageRemaining":160}},"genBasic":{"attributes":{"modelId":"TS0202","manufacturerName":"_TYZB01_hqbdru35"}},"ssIasZone":{"attributes":{"zoneStatus":1}}},"binds":[],"configuredReportings":[],"meta":{}}},"interviewCompleted":true,"meta":{},"lastSeen":1632756966279}

@Ddmilbradt
Copy link

Ddmilbradt commented Oct 6, 2021

Thanks, it worked for 4 sensors ZM-35ZH-Q with cc2531 with the code:

`// Converter for ZM-RT201 ZM-35ZH-Q with battery now.
// https://www.youtube.com/channel/UCJRaKbgv8u1O4OwG-0D3uRw
//
const fz = require("zigbee-herdsman-converters/converters/fromZigbee");
const tz = require("zigbee-herdsman-converters/converters/toZigbee");
const exposes = require("zigbee-herdsman-converters/lib/exposes");
const extend = require("zigbee-herdsman-converters/lib/extend");
const globalStore = require("zigbee-herdsman-converters/lib/store");
const e = exposes.presets;
const ea = exposes.access;
const { setTimeout, clearTimeout } = require("timers");

const motionSensorDetector = {
cluster: "ssIasZone",
type: "attributeReport",
convert: (model, msg, publish, options, meta) => {
const payload = {
tamper: (msg.data.zoneStatus & (1 << 2)) > 0,
battery_low: (msg.data.zoneStatus & (1 << 3)) > 0,
};
if (msg.data.zoneStatus !== 1) {
// In case of 0 no occupancy is reported.
// #467
return payload;
}
// The occupancy sensor only sends a message when motion detected.
// Therefore we need to publish the no_motion detected by ourselves.
const timeout =
options && options.hasOwnProperty("occupancy_timeout")
? options.occupancy_timeout
: 300; // occupancy delay in seconds

// Stop existing timers because motion is detected and set a new one.
globalStore
  .getValue(msg.endpoint, "timers", [])
  .forEach((t) => clearTimeout(t));
globalStore.putValue(msg.endpoint, "timers", []);
//
if (timeout !== 0) {
  const timer = setTimeout(() => {
    payload.occupancy = false;
    publish(payload);
    // publish({ occupancy: false });
  }, timeout * 1000);
  globalStore.getValue(msg.endpoint, "timers").push(timer);
}
// No occupancy since
if (options && options.no_occupancy_since) {
  options.no_occupancy_since.forEach((since) => {
    const timer = setTimeout(() => {
      payload.no_occupancy_since = since;
      publish(payload);
      // publish({ no_occupancy_since: since });
    }, since * 1000);
    globalStore.getValue(msg.endpoint, "timers").push(timer);
  });
}

if (options && options.no_occupancy_since) {
  payload.occupancy = true;
  payload.no_occupancy_since = 0;
} else {
  payload.occupancy = true;
  // delete payload.no_occupancy_since;
}
return payload;

},
};

const definition = {
fingerprint: [{ modelID: 'TS0202', manufacturerName: '_TYZB01_dl7cejts' },
{ ieee_address: "0x00124b000fdf56,0x00124b0016a026,0x00124b000b1c4b,0x00124b0007d2c8" }], // WARNING! Change this ieee_address for yours ieee_address!!!!
zigbeeModel: ["TS0202"],
model: "ZM-RT201",
vendor: "TuYa",
description: "Motion sensor",
fromZigbee: [
motionSensorDetector,
fz.battery,
// fz.ignore_basic_report,
],
toZigbee: [],
exposes: [e.occupancy(), e.battery_low(), e.battery()],
};

module.exports = definition;
`

THANK YOU AGAIN

@thieskenl
Copy link

thieskenl commented Dec 15, 2021

Hello. I have these Motion sensors. https://nl.aliexpress.com/item/1005003518834102.html?spm=a2g0s.9042311.0.0.51bf4c4d1NQdQc. I would like to get these work with zigbee2mqtt. I saw it to late that the seller say that they not work with external zigbee bridge :(. I created a js file but no occupancy. It says N/A. The model on the box is ZM-RT20

@thieskenl
Copy link

It works with Zigbee2mqtt Edge on test rbpi. Now i'm going to try to upgrade to Edge.

@freitas666
Copy link

freitas666 commented Dec 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request stale Stale issues
Projects
None yet
Development

No branches or pull requests