zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

[New device support]: TZE204_ex3rcdha presence and lux sensor

Open djdevil opened this issue 1 year ago • 16 comments

Link

https://it.aliexpress.com/item/1005007335061248.html?gatewayAdapt=glo2ita

Database entry

{"id":54,"type":"Router","ieeeAddr":"0xa4c13887abb15e5d","nwkAddr":37763,"manufId":4417,"manufName":"_TZE204_ex3rcdha","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"stackVersion":0,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1724348619720}

Comments

I purchased this new sensor, but even by modifying the converter it doesn't seem to work, is there anyone who can help me, thanks

External definition

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 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 tzDatapoints = {
    ...tuya.tz.datapoints,
    key: [...tuya.tz.datapoints.key, 'minimum_range', 'maximum_range', 'detection_delay', 'fading_time']
}

const definition = {
    fingerprint: tuya.fingerprint('TS0601', ['_TZE204_ex3rcdha']),
    model: 'TS0601_smart_human_presence_sensor',
    vendor: 'TuYa',
    description: 'Smart Human presence sensor',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tzDatapoints],
    exposes: [
        e.illuminance_lux(), e.presence(),
        exposes.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('m'),
        exposes.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(9).withValueStep(1)
            .withDescription('sensitivity of the radar'),
        exposes.numeric('minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
            .withDescription('Minimum range').withUnit('m'),
        exposes.numeric('maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
            .withDescription('Maximum range').withUnit('m'),
        exposes.numeric('detection_delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(0.1)
            .withDescription('Detection delay').withUnit('s'),
        exposes.numeric('fading_time', ea.STATE_SET).withValueMin(0.5).withValueMax(1500).withValueStep(1)
            .withDescription('Fading time').withUnit('s'),
    ],
    meta: {
        tuyaDatapoints: [
            [104, 'illuminance_lux', tuya.valueConverter.raw],
            [105, 'presence', tuya.valueConverter.trueFalse1],
            [106, 'radar_sensitivity', tuya.valueConverter.raw],
            [107, 'maximum_range', tuya.valueConverter.divideBy100],
            [108, 'minimum_range', tuya.valueConverter.divideBy100],
            [109, 'target_distance', tuya.valueConverter.divideBy100],
            [110, 'fading_time', tuya.valueConverter.divideBy10],
            [111, 'detection_delay', tuya.valueConverter.divideBy10],
        ],
    }
};

module.exports = definition;

djdevil avatar Aug 22 '24 17:08 djdevil

And me too

draserver avatar Aug 27 '24 16:08 draserver

Also following this one

therealchunkyd avatar Aug 29 '24 03:08 therealchunkyd

Following

BeastyBoy339 avatar Aug 29 '24 14:08 BeastyBoy339

Following

DougD1991 avatar Aug 30 '24 20:08 DougD1991

i have the same presence detector too, following

Yub0 avatar Sep 04 '24 20:09 Yub0

In order to add support for this Tuya device, we need to figure out what datapoints it uses. See this guide on how to do that

Koenkk avatar Sep 05 '24 11:09 Koenkk

Not able to figure out the datapoints, but following!

fabianteunissen avatar Sep 09 '24 14:09 fabianteunissen

I found here the datapoints for the ZY-HPS01-5.8G https://github.com/make-all/tuya-local/blob/main/custom_components/tuya_local/devices/zyhps01_human_presence_sensor.yaml

tomas123 avatar Sep 11 '24 14:09 tomas123

Got this device working with illuminance and presence states, other parameters can be set but not read at first

Edit Added fix from https://github.com/Koenkk/zigbee2mqtt/issues/23705#issuecomment-2345003744 and https://github.com/Koenkk/zigbee2mqtt/issues/23705#issuecomment-2345832981

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 modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE204_ex3rcdha',
        },
    ],
    model: 'TS0601_?',
    vendor: 'Tuya',
    description: 'mmWave radar ZY_HPS01 V1.2',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    configure: tuya.configureMagicPacket,
    extend: [    ],
    exposes: [
        e.illuminance_lux(),
        e.occupancy(),
        exposes.numeric('presence_timeout', ea.STATE_SET).withValueMin(0).withValueMax(180).withValueStep(1)
            .withDescription('Presence timeout').withUnit('s'),
        exposes.numeric('move_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1)
           .withDescription('sensitivity of the radar').withUnit('X'),
        exposes.numeric('move_minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10)
            .withDescription('Movement minimum range').withUnit('cm'),
        exposes.numeric('move_maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10)
            .withDescription('Movement maximum range').withUnit('cm'),
        exposes.numeric('breath_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1)
            .withDescription('Breath sensitivity of the radar').withUnit('X'),
        exposes.numeric('breath_minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10)
            .withDescription('Breath minimum range').withUnit('cm'),
        exposes.numeric('breath_maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10)
            .withDescription('Breath maximum range').withUnit('cm'),

    ],
    meta: {
        tuyaDatapoints: [
            [12, 'illuminance_lux', tuya.valueConverter.raw],
            [101, 'occupancy', tuya.valueConverter.trueFalse0],
            [104, 'presence_timeout', tuya.valueConverter.raw],
            [105, 'move_sensitivity', tuya.valueConverter.raw],
            [107, 'breath_sensitivity', tuya.valueConverter.raw],
            [109, 'move_maximum_range', tuya.valueConverter.raw],
            [110, 'move_minimum_range', tuya.valueConverter.raw],
            [111, 'breath_maximum_range', tuya.valueConverter.raw],
            [112, 'breath_minimum_range', tuya.valueConverter.raw],

        ],
    }
};

module.exports = definition;

motezuki avatar Sep 11 '24 16:09 motezuki

Sorry I missed one edition on tuyaDatapoints

where is: [105, 'movesensitivity', tuya.valueConverter.raw],

should be: [105, 'move_sensitivity', tuya.valueConverter.raw],

I will fix on the post

Em qua., 11 de set. de 2024 às 14:35, djdevil @.***> escreveu:

Got this device working with illuminance and presence states, other parameters can be set but not read at first

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 modernExtend = require('zigbee-herdsman-converters/lib/modernExtend'); const e = exposes.presets; const ea = exposes.access; const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = { fingerprint: [ { modelID: 'TS0601', manufacturerName: 'TZE204_ex3rcdha', }, ], model: 'TS0601?', vendor: 'Tuya', description: 'mmWave radar ZY_HPS01 V1.2', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], configure: tuya.configureMagicPacket, extend: [ ], exposes: [ e.illuminance_lux(), e.presence(), exposes.numeric('presence_timeout', ea.STATE_SET).withValueMin(0).withValueMax(180).withValueStep(1) .withDescription('Presence timeout').withUnit('s'), exposes.numeric('move_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1) .withDescription('sensitivity of the radar').withUnit('X'), exposes.numeric('move_minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10) .withDescription('Movement minimum range').withUnit('cm'), exposes.numeric('move_maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10) .withDescription('Movement maximum range').withUnit('cm'), exposes.numeric('breath_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1) .withDescription('Breath sensitivity of the radar').withUnit('X'), exposes.numeric('breath_minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10) .withDescription('Breath minimum range').withUnit('cm'), exposes.numeric('breath_maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(600).withValueStep(10) .withDescription('Breath maximum range').withUnit('cm'),

],
meta: {
    tuyaDatapoints: [
        [12, 'illuminance_lux', tuya.valueConverter.raw],
        [101, 'presence', tuya.valueConverter.trueFalse0],
        [104, 'presence_timeout', tuya.valueConverter.raw],
        [105, 'movesensitivity', tuya.valueConverter.raw],
        [107, 'breath_sensitivity', tuya.valueConverter.raw],
        [109, 'move_maximum_range', tuya.valueConverter.raw],
        [110, 'move_minimum_range', tuya.valueConverter.raw],
        [111, 'breath_maximum_range', tuya.valueConverter.raw],
        [112, 'breath_minimum_range', tuya.valueConverter.raw],

    ],
}

};

the code gives me a syntax error and doesn't seem to function, as if we are missing

data const tzDatapoints = { ...tuya.tz.datapoints, key: Array.isArray(tuya.tz.datapoints.key) ? [...tuya.tz.datapoints.key, 'minimum_range', 'maximum_range', 'detection_delay', 'fading_time'] : ['minimum_range', 'maximum_range', 'detection_delay', 'fading_time'] };

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/23705#issuecomment-2344290398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW2H7KXONOU62DX36XUA6JTZWB5MNAVCNFSM6AAAAABM6UCOBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBUGI4TAMZZHA . You are receiving this because you commented.Message ID: @.***>

motezuki avatar Sep 12 '24 00:09 motezuki

I add this line for an external *.js script module.exports = definition;

and now the code works fine!

tomas123 avatar Sep 12 '24 10:09 tomas123

@motezuki could you submit a PR by clicking here?

Koenkk avatar Sep 13 '24 11:09 Koenkk

@motezuki Thank you very much for the work. It works fine for me. Is there any way to change the icon? edit: the illuminance don't work

Javisen avatar Sep 17 '24 00:09 Javisen

@Javisen maybe you have a slightly different device, with a different data point for illuminance. Could you verify the datapoints using these instructions?

The icons can be changed directly on the configuration of the entity card

motezuki avatar Sep 18 '24 14:09 motezuki

@Javisen maybe you have a slightly different device, with a different data point for illuminance. Could you verify the datapoints using these instructions?

The icons can be changed directly on the configuration of the entity card

I think it might be the device. When you bring a flashlight close to the sensor you get lux values but very low (25 lux). Also, I don't know how I can find the device on yours if I'm using it locally.

Javisen avatar Sep 18 '24 18:09 Javisen

Thanks for al the work. It works but cant use the distance settings, getting an error like this "z2m: No converter available for 'move_minimum_range' (340)"

BeastyBoy339 avatar Sep 21 '24 08:09 BeastyBoy339

following. I was looking at my TS0601 quirk, and I do not see how I can add this code in.

paulsijben avatar Nov 18 '24 15:11 paulsijben

Hi I'm new to home assistant how do I add this fix to my system ??

Madmorgan007 avatar Dec 08 '24 15:12 Madmorgan007

do you know what breath_maximum_range', 'breath_minimum_range mean ?

pipiche38 avatar Dec 14 '24 14:12 pipiche38

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

github-actions[bot] avatar Feb 13 '25 00:02 github-actions[bot]