zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

[New device support]: Linptech Presence Sensor ES1 (TS0225__TZ3218_awarhusb)

Open aatifk opened this issue 1 year ago • 126 comments

Link

https://www.amazon.com/dp/B0C7C6L66J?ref=ppx_yo2ov_dt_b_product_details&th=1

Database entry

{"id":29,"type":"Router","ieeeAddr":"0xb43a31fffe265666","nwkAddr":29864,"manufId":4098,"manufName":"_TZ3218_awarhusb","powerSource":"Mains (single phase)","modelId":"TS0225","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":1026,"inClusterList":[0,3,4,5,57346,16384,61184,1280],"outClusterList":[10,25],"clusters":{"genBasic":{"attributes":{"modelId":"TS0225","manufacturerName":"_TZ3218_awarhusb","powerSource":1,"zclVersion":3,"appVersion":65,"stackVersion":1,"hwVersion":1,"dateCode":""}},"ssIasZone":{"attributes":{"iasCieAddr":"0x00124b0026b884c4","zoneState":0}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":1,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1692243468779,"defaultSendRequestWhen":"immediate"}

Comments

I see another thread requesting support for TS0225 but the manufacturer and the product pages seem to be different for this one.

External converter

No response

Supported color modes

No response

Color temperature range

No response

aatifk avatar Aug 17 '23 04:08 aatifk

This device is rather different than the rest of the presence sensors based on the Tuya platform. It uses the standard ZCL cluster 0x0400 for illuminance reporting and the IAS cluster 0x0500 for occupancy reporting. It also uses a manufacturer-specific cluster 0xE002 for the configurable parameters and for reporting.

kkossev avatar Aug 25 '23 12:08 kkossev

ah, I see. I should probably just return this device, then.

aatifk avatar Aug 25 '23 13:08 aatifk

Amazon reviews are good, I would wait some more days or weeks, it will be surely supported in Z2M sooner or later ...

The form factor of this device is the same as the Xiaomi Mi-Home Bluetooth presence detector, and Xiaomi devices are typically of a much better quality than most of the similar things coming from AliExpress.

kkossev avatar Aug 25 '23 14:08 kkossev

It would be great to see this one work! Would this method still work to find the Tuya Data Points? https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html

makeitworktech avatar Sep 03 '23 00:09 makeitworktech

Not sure if this information will help, but I can't get very far with an external converter.

Here's the illuminance cluster when my office light is off: 2023-09-06 17:37:35Received Zigbee message from '0xb43a31fffe265417', type 'raw', cluster 'msIlluminanceMeasurement', data '{"data":[8,90,10,0,0,33,1,0,0,0],"type":"Buffer"}' from endpoint 1 with groupID 0

Here's the illuminance cluster when my office light is turned on: 2023-09-06 17:43:17Received Zigbee message from '0xb43a31fffe265417', type 'raw', cluster 'msIlluminanceMeasurement', data '{"data":[8,89,10,0,0,33,134,111,0,0],"type":"Buffer"}' from endpoint 1 with groupID 0

And here is the manuSpecificTuya_2 cluster. It's at a distance and the value (shown as 214 below) goes down as i get closer to the device. Thinking distance? 2023-09-06 17:39:12Received Zigbee message from '0xb43a31fffe265417', type 'attributeReport', cluster 'manuSpecificTuya_2', data '{"57354":214}' from endpoint 1 with groupID 0

When I get really close to it, the cluster changes like this, the 57354 changing to 57345 and the 214 number jumping way up. It's like the distance measurement jumps to smaller units? 2023-09-06 17:50:48Received Zigbee message from '0xb43a31fffe265417', type 'attributeReport', cluster 'manuSpecificTuya_2', data '{"57345":4260}' from endpoint 1

And here's the IasZone cluster: 2023-09-06 17:43:49Received Zigbee message from '0xb43a31fffe265417', type 'commandStatusChangeNotification', cluster 'ssIasZone', data '{"extendedstatus":0,"zonestatus":1}' from endpoint 1 with groupID 0

I also get this genTime cluster, not sure what that does: 2023-09-06 17:44:17Received Zigbee message from '0xb43a31fffe265417', type 'read', cluster 'genTime', data '["localTime"]' from endpoint 1 with groupID 0

There's also a genBasic cluster that only shows up sometimes. 2023-09-06 17:54:55Received Zigbee message from '0xb43a31fffe265417', type 'attributeReport', cluster 'genBasic', data '{"65508":0,"appVersion":65}' from endpoint 1 with groupID 0

I just need to understand how these work rather than the typical Tuya "data points".

makeitworktech avatar Sep 06 '23 21:09 makeitworktech

Greetings! Acquired a rebranding from MOES with the same designation.

VikeDragon avatar Sep 08 '23 05:09 VikeDragon

Let's start simple, does battery and occupancy work with this? https://gist.github.com/Koenkk/2e438754fac949869e5c2cf5219382aa

  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m

Koenkk avatar Sep 08 '23 17:09 Koenkk

I had returned this because I assumed it won't work. Let me try getting a hold of this again and try the external converter.

aatifk avatar Sep 09 '23 02:09 aatifk

  • ext_converter.js

Greetings, Koenkk! I checked this converter. For my sensor, everything works out - detects the presence. The sensor is not on batteries - it is on Type - With USB. Here are photos of the packaging and sensor, as well as the Myhome interface of the bluetooth analog Lamptech ES1, which I also have in stock. The settings of the analogue in MiHome are visible. I also attached analogs of sensor data files and logs.

main occupancy photo_2023-09-09_19-18-55 photo_2023-09-09_19-19-12 photo_2023-09-09_19-19-16 photo_2023-09-09_19-19-19 photo_2023-09-09_19-19-22 photo_2023-09-09_19-19-25 logs.log database.db.log state.json.log

VikeDragon avatar Sep 09 '23 14:09 VikeDragon

external_converters:
  - ext_converter.js

I've tried the external converter. Same as @VikeDragon, I get Occupancy, Battery, and Linkquality. Occupancy and Linkquality seem to work, but Battery is "Null" since it is USB powered.

image

makeitworktech avatar Sep 11 '23 10:09 makeitworktech

This device also exposes the illuminance via the standard ZCL cluster 0x0400

kkossev avatar Sep 11 '23 12:09 kkossev

Added illuminance, removed battery: https://gist.github.com/Koenkk/2e438754fac949869e5c2cf5219382aa

Koenkk avatar Sep 11 '23 18:09 Koenkk

Added illuminance, removed battery: https://gist.github.com/Koenkk/2e438754fac949869e5c2cf5219382aa

Getting an error with the illuminance: Error 2023-09-11 19:19:38Failed to configure '0xb43a31fffe265417', attempt 3 (Error: ConfigureReporting 0xb43a31fffe265417/1 msIlluminanceMeasurement([{"attribute":"measuredValue","minimumReportInterval":10,"maximumReportInterval":3600,"reportableChange":5}], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 52598 - 1 - 6 - 1024 - 7 after 10000ms) at Timeout._onTimeout (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7))

image

makeitworktech avatar Sep 11 '23 23:09 makeitworktech

Try just binding the illuminance cluster without configuring the reporting. Also, send the Tuya BlackMagic packet during the pairing, although I don't know if it has any effect or not.

This is a rather weird device... Not typical Tuya data points implementation. It uses cluster 0xE002 for configuring the parameters: Cluster 0xE002, attribute 0xE00B - maximum detection distance, min:75, max:600, step:75, rw Cluster 0xE002, attribute 0xE004 - 'Large motion detection sensitivity', range 0 to 5, rw Cluster 0xE002, attribute 0xE005 - 'Small motion detection sensitivity', range 0 to 5, rw Cluster 0xE002, attribute 0xE00A - the measured distance to the moving object, ro Cluster 0xE002, attribute 0xE001 - 'existence time' (tuyaVersion 1.0.1 - in seconds, tuyaVersion 1.0.5 - in minutes), ro

Tuya cluster 0xEF00, data point 101 - the 'fading time', range 10..10000, rw

kkossev avatar Sep 12 '23 04:09 kkossev

Added illuminance, removed battery: https://gist.github.com/Koenkk/2e438754fac949869e5c2cf5219382aa

I also just got the MOES Human Presence Sensor and tried this ext converter and Lux is NULL

image

FYI - This is the correct image for the MOES Plug https://moeshouse.com/cdn/shop/products/moes-zigbee-human-presence-sensor-detector-radar-wave-detection-sensor-for-home-security-596265.png?v=1692258238&width=600

iculookn avatar Sep 12 '23 09:09 iculookn

Does the MOES sensor have exactly the same fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']) as the Linptech?

kkossev avatar Sep 12 '23 09:09 kkossev

Does the MOES sensor have exactly the same fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']) as the Linptech?

Yes looks like it

image

iculookn avatar Sep 12 '23 10:09 iculookn

Try just binding the illuminance cluster without configuring the reporting. Also, send the Tuya BlackMagic packet during the pairing, although I don't know if it has any effect or not.

Still showing Illuminance as Null, but, the error has gone away. Sending configure: tuya.configureMagicPacket didn't seem to make a difference either unfortunately.

image

I've sent an email to Linptech to see if they can help out.

makeitworktech avatar Sep 12 '23 10:09 makeitworktech

Does the MOES sensor have exactly the same fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']) as the Linptech?

Yes looks like it

image

Same thing with MOES sensor.

xinsdr avatar Sep 12 '23 14:09 xinsdr

Does the MOES sensor have exactly the same fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']) as the Linptech?

Yes looks like it

image

Same thing with MOES sensor.

This is a screencap for the MOES version

iculookn avatar Sep 12 '23 15:09 iculookn

with

The MOES model number is:

ZSS-LP-HP02 CB03

image

iculookn avatar Sep 13 '23 00:09 iculookn

Any update on the the Moes wwmave human presence sensor? Mine also shows as _TZ3218_awarhusb TS0225. What is the latest and best so far converter that exist? thanks

Screenshot_2

alexvaltchev avatar Sep 14 '23 12:09 alexvaltchev

Screenshot_2023-09-14-15-42-37-690_com tuya smartlife Screenshot_2023-09-14-15-42-40-608_com tuya smartlife Screenshot_2023-09-14-15-42-30-903_com tuya smartlife Screenshot_2023-09-14-15-42-35-256_com tuya smartlife

Here are some screenshots from the Smart Home app. It is pretty basic sensor. IT shows only 4 variables.

  1. Motion sensitivity - 1 to 5
  2. MotionLESS sensitivity - 1 to 5
  3. Distance 75 cm to 600 cm (6 meters)
  4. Nobody time (10 sec to 10000 sec) - not sure what this is ? Probably like "fade time"

This is everything that can be changed, only 4 settings.

It shows the following:

  1. Presence/no presence
  2. Presence time (in minutes)
  3. Current distance (in cm)
  4. Illumination value (in lux)
  5. Presnece record.
  6. Illumination record.

alexvaltchev avatar Sep 14 '23 12:09 alexvaltchev

IMG_8185 and IMG_8186

Some inside details 😉

joohann avatar Sep 15 '23 12:09 joohann

Some inside details 😉

Wow, so many of these devices have that same sensor inside! I'm testing a bunch of these and I'm finding that! Hopefully we can get this one working with Z2M as well!

PXL_20230915_113536308.jpg

makeitworktech avatar Sep 15 '23 21:09 makeitworktech

Anything new on the subject? How can we use this mmwave sensor with Zigbee2MQTT?

alexvaltchev avatar Sep 17 '23 15:09 alexvaltchev

Still not able to figure out these messages: Debug 2023-09-18 19:56:17No converter available for 'ZG-205ZL' with cluster 'manuSpecificTuya_2' and type 'attributeReport' and data '{"57354":287}' Debug 2023-09-18 19:56:19No converter available for 'ZG-205ZL' with cluster 'manuSpecificTuya_2' and type 'attributeReport' and data '{"57354":121}'

I've tried adding fzLocal and tzLocal to the converter file to help describe the messages, which I believe is a target distance. Here's my converter:

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 legacy = require('zigbee-herdsman-converters/lib/legacy');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const {KeyValue, Definition, Tz, Fz, Expose, KeyValueAny, KeyValueNumberString, KeyValueString} = require('zigbee-herdsman-converters/lib/types');

const fzLocal = {
    target_distance: {
        cluster: 'manuSpecificTuya_2',
        type: ['attributeReport', 'readResponse'],
        convert: (model, msg, publish, options, meta) => {
            const result: KeyValue = {};
            if (msg.data.hasOwnProperty('57354')) {
                result.target_distance = msg.data['57354'];
            }
            return result;
        },
    } as Fz.Converter,
};


const tzLocal = {
    target_distance: {
        key: ['target_distance'],
        convertSet: async (entity, key, value, meta) => {
            switch (key) {
            case 'target_distance': {
                utils.assertString(value, 'target_distance');
                await entity.write('manuSpecificTuya_2', {'57354': {value});
                break;
            }
            default: // Unknown key
                meta.logger.warn(`Unhandled key ${key}`);
            }
        },
    } as Tz.Converter,
    
    
const definition = {
    fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']),
    model: 'TS0225',
    vendor: 'TuYa',
    description: 'Presence sensor',
    fromZigbee: [fz.ias_occupancy_alarm_1, fz.illuminance, fzLocal.target_distance],
    toZigbee: [tzLocal.target_distance],
    configure: tuya.configureMagicPacket,
    exposes: [e.occupancy(), e.illuminance_lux(), e.target_distance()],
    // configure: async (device, coordinatorEndpoint, logger) => {
    //     const endpoint = device.getEndpoint(1);
    //     await reporting.bind(endpoint, coordinatorEndpoint, ['msIlluminanceMeasurement']);
    //     await reporting.illuminance(endpoint);
    // },
};

module.exports = definition;

But I'm getting an error: [19:58:41] INFO: Preparing to start... [19:58:42] INFO: Socat not enabled [19:58:43] INFO: Starting Zigbee2MQTT... /app/data/extension/externally-loaded.js:20 const result: KeyValue = {}; ^^^^^^ SyntaxError: Missing initializer in const declaration at new Script (node:vm:100:7) at createScript (node:vm:265:10) at Object.runInNewContext (node:vm:306:10) at loadModuleFromText (/app/lib/util/utils.ts:152:8) at loadModuleFromFile (/app/lib/util/utils.ts:159:12) at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:169:25) at getExternalConvertersDefinitions.next (<anonymous>) at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20) at new Controller (/app/lib/controller.ts:84:58) at start (/app/index.js:106:18)

I just don't know enough about this stuff to do much more. Any help would be appreciated.

makeitworktech avatar Sep 19 '23 00:09 makeitworktech

Ok, I'm getting somewhere! I have the target distance working (sort of).

image

Here's my latest converter.

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 legacy = require('zigbee-herdsman-converters/lib/legacy');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const {KeyValue, Definition, Tz, Fz, Expose, KeyValueAny, KeyValueNumberString, KeyValueString} = require('zigbee-herdsman-converters/lib/types');

const fzLocal = {
    target_distance: {
        cluster: 'manuSpecificTuya_2',
        type: ['attributeReport'],
        // type: ['attributeReport', 'readResponse'],
        convert: (model, msg, publish, options, meta) => {
            const result = {};
            if (msg.data.hasOwnProperty('57354')) {
                result['target_distance'] = msg.data['57354'];
            }
            // if (msg.data.hasOwnProperty('57345')) {
            //     result['target_distance'] = msg.data['57345'];
            // }
            return result;
        },
    },
};


const tzLocal = {
    target_distance: {
        key: ['target_distance'],
        convertSet: async (entity, key, value, meta) => {
            switch (key) {
            case 'target_distance': {
                utils.assertString(value, 'target_distance');
                await entity.write('manuSpecificTuya_2', {'57354': {value}});
                break;
            }
            default: // Unknown key
                meta.logger.warn(`Unhandled key ${key}`);
            }
        },
    },
};    
    
const definition = {
    fingerprint: tuya.fingerprint('TS0225', ['_TZ3218_awarhusb']),
    model: 'TS0225',
    vendor: 'TuYa',
    description: 'Presence sensor',
    // fromZigbee: [fz.ias_occupancy_alarm_1, fz.illuminance, fzLocal.target_distance],
    fromZigbee: [fz.ias_occupancy_alarm_1, fz.illuminance, fzLocal.target_distance],
    toZigbee: [tzLocal.target_distance, tzLocal.target_distance],
    configure: tuya.configureMagicPacket,
    exposes: [e.occupancy(),
                e.illuminance_lux(),
                e.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('cm'),
                e.numeric('radar_sensitivity',ea.STATE_SET).withValueMin(1).withValueMax(5).withValueStep(1)
                    .withDescription('sensitivity of the radar')],
                
    // configure: async (device, coordinatorEndpoint, logger) => {
    //     const endpoint = device.getEndpoint(1);
    //     await reporting.bind(endpoint, coordinatorEndpoint, ['msIlluminanceMeasurement']);
    //     await reporting.illuminance(endpoint);
    // },
};

module.exports = definition;

My biggest issue right now is figuring out the difference between these two messages:

Debug 2023-09-06 17:32:52No converter available for 'TS0225' with cluster 'manuSpecificTuya_2' and type 'attributeReport' and data '{"57345":3180}'

Debug 2023-09-06 17:32:54No converter available for 'TS0225' with cluster 'manuSpecificTuya_2' and type 'attributeReport' and data '{"57354":221}'

makeitworktech avatar Sep 19 '23 01:09 makeitworktech

It uses the standard ZCL cluster 0x0400 for illuminance reporting and the IAS cluster 0x0500 for occupancy reporting. It also uses a manufacturer-specific cluster 0xE002 for the configurable parameters and for reporting.

So this comment has prompted me to read up on ZCL clusters. I'm literally over my head here, but it looks like the standard Illuminance Measurement cluster (0x0400) has only 5 attributes, while the one reported here seems to have 10:

Debug 2023-09-19 06:22:36No converter available for 'TS0225' with cluster 'msIlluminanceMeasurement' and type 'raw' and data '{"data":[8,59,10,0,0,33,134,23,0,0],"type":"Buffer"}'

Does this indicate that the cluster is non-standard, so we kinda have to guess at what the attributes are? If we number the attribute positions in the array like this: [1,2,3,4,5,6,7,8,9,10], then positions 1,3,4,5,6,9,10 don't seem to change when I change the light level.

Soon @blakadder may have some input :-D

makeitworktech avatar Sep 19 '23 22:09 makeitworktech

Does this indicate that the cluster is non-standard, so we kinda have to guess at what the attributes are?

Yes 😄

Koenkk avatar Sep 20 '23 16:09 Koenkk