END Point:
Sensor state code 1
Exist_sensitivity code 101
Hold time code 102
trigger sensitivity code 9
illuminance value 12
I use Z2M. If someone has a ready-made converter, I would appreciate it.
TS0601 _TZE204_iadro9bf
END Point:
Sensor state code 1
Exist_sensitivity code 101
Hold time code 102
trigger sensitivity code 9
illuminance value 12
I use Z2M. If someone has a ready-made converter, I would appreciate it.
TS0601 _TZE204_iadro9bf
I get you're new here, but you could have helped yourself by posting your issue on the Z2M github in English if you wanted faster help.
Also, it took me 30 seconds to find this. You seem to have tried it, but it's not clear what didn't work for you. Should have been picked up like the rest of the other people's experience since it's the same model.
@injutkinag-cell Had a look at the github issue I linked to earlier & it seems you missed this comment or didn't realise your model is different than the one in the quirk you were using. The quirks are for the TZE284, but you have the TZE204 version.
All you need to do is change the model number in line 31 from 284 to 204 & it should work, like this:
"""ZigBee 24G MmWave Radar Human Body Presence Motion Sensor _TZE204_iadro9bf - https://github.com/zigpy/zha-device-handlers/issues/3969"""
import asyncio
from zigpy.quirks.v2.homeassistant import UnitOfTime
from zigpy.quirks.v2.homeassistant.sensor import SensorDeviceClass
import zigpy.types as t
from zigpy.zcl.clusters.measurement import OccupancySensing
from zhaquirks.tuya import TuyaLocalCluster
from zhaquirks.tuya.builder import TuyaQuirkBuilder
class TuyaOccupancySensing(OccupancySensing, TuyaLocalCluster):
"""Tuya local OccupancySensing cluster."""
class TuyaMotionPresenceSensitivity(t.enum8):
"""Tuya motion presence sensitivity enum."""
Low = 0x00
Medium = 0x01
High = 0x02
class TuyaSensitivityMode(t.enum8):
"""Tuya sensitivity mode enum."""
Low = 0x00
Medium = 0x01
High = 0x02
(
TuyaQuirkBuilder("_TZE204_iadro9bf", "TS0601")
# "1":"sensor state" - Working
.tuya_dp(
dp_id=1,
ep_attribute=TuyaOccupancySensing.ep_attribute,
attribute_name=OccupancySensing.AttributeDefs.occupancy.name,
converter=lambda x: x == 0,
)
.adds(TuyaOccupancySensing)
# "9":"Trigger Sensitivity" - Low/Medium/High
.tuya_enum(
dp_id=9,
attribute_name="trigger_sensitivity",
enum_class=TuyaSensitivityMode,
translation_key="trigger_sensitivity",
fallback_name="Trigger sensitivity",
)
# "12":"Illuminance value" - 3lux
.tuya_illuminance(dp_id=12)
# "101":"exist_Sensitivity" - Low/Medium/High
.tuya_enum(
dp_id=101,
attribute_name="exist_Sensitivity",
enum_class=TuyaMotionPresenceSensitivity,
translation_key="presence_sensitivity",
fallback_name="Presence sensitivity",
)
## "102":"hold_time" Default 30s (10-600s)
.tuya_number(
dp_id=102,
attribute_name="hold_time",
type=t.uint16_t,
device_class=SensorDeviceClass.DURATION,
unit=UnitOfTime.SECONDS,
min_value=10,
max_value=600,
step=1,
translation_key="fading_time",
fallback_name="Fading time",
)
.skip_configuration()
.add_to_registry()
)
I have seen this code. But I don't use ZHA and my programming knowledge is very low. I need an External Converter for Z2M. I will make an effort and summon the will to write it. Although I have already ordered other presence sensors, I also want these to work and it may be useful for other users.
Maybe I'm misunderstanding then, because that model is already supported in Z2M. You shouldn't need an external converter if your Z2M install is up to date zigbee-herdsman-converters/src/devices/tuya.ts at 4d531ed7a510d26e9b52ab09b6e000eca27e2ff2 · Koenkk/zigbee-herdsman-converters · GitHub
Zigbee2MQTT version 2.12.0
Yes, that's right, if you look at the support and connect the sensor without an external converter, then it is detected with native support. But the problem is that it doesn't work. It only shows the illumination parameters and that's it. The code also specifies the distance parameters, sensitivity, and other parameters, but they are not present in this sensor.
the screenshot is already with my slightly redesigned converter. But it has a problem, Fade Time is not regulated, or rather it does not work correctly. Exactly if you set the value to 10 seconds, it will work at 19 seconds.
/**
* Zigbee2MQTT External Converter (ESM · Z2M ≥ 2.0)
* ZigBee 24G MmWave Radar Human Body Presence Motion Sensor
* Model: TS0601 | Manufacturer: _TZE204_iadro9bf
*
* Installation:
* 1. Copy to <z2m_data>/external_converters/_TZE204_iadro9bf.mjs
* 2. Ensure in configuration.yaml: enable_external_js: true
* 3. Restart Zigbee2MQTT and re-pair the device.
*
* DP map (verified from live logs):
* DP 1 — motion bool 0=detected 1=clear
* DP 9 — trigger_sensitivity enum 0=Low 1=Medium 2=High
* DP 12 — illuminance uint32 lux
* DP 101 — presence_sensitivity enum 0=Low 1=Medium 2=High
* DP 102 — fading_time uint32 seconds (raw, no scaling)
*/
import * as tuya from 'zigbee-herdsman-converters/lib/tuya';
import {access as ea, presets as e} from 'zigbee-herdsman-converters/lib/exposes';
const sensitivityConverter = tuya.valueConverterBasic.lookup({
low: tuya.enum(0),
medium: tuya.enum(1),
high: tuya.enum(2),
});
// DP 102: целые секунды, без масштабирования
const tzFadingTime = {
key: ['fading_time'],
convertSet: async (entity, key, value) => {
const raw = Math.round(Number(value));
await tuya.sendDataPointValue(entity, 102, raw);
return {state: {fading_time: raw}};
},
};
export default {
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_iadro9bf']),
model: 'TS0601_iadro9bf',
vendor: 'TuYa',
description: '24G MmWave radar human body presence motion sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tzFadingTime, tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
// DP 1 — кратковременный триггер движения
e.binary('motion', ea.STATE, true, false)
.withLabel('Motion')
.withDescription('Short motion trigger (DP 1)'),
// DP 9 — чувствительность триггера
e.enum('trigger_sensitivity', ea.STATE_SET, ['low', 'medium', 'high'])
.withLabel('Trigger sensitivity')
.withDescription('Sensitivity for motion trigger (DP 9)'),
// DP 12 — освещённость
e.illuminance(),
// DP 101 — чувствительность присутствия
e.enum('presence_sensitivity', ea.STATE_SET, ['low', 'medium', 'high'])
.withLabel('Presence sensitivity')
.withDescription('Sensitivity for static presence detection (DP 101)'),
// DP 102 — время удержания, целые секунды
e.numeric('fading_time', ea.STATE_SET)
.withLabel('Fading time')
.withDescription('Hold time before motion clears (DP 102, seconds)')
.withValueMin(10)
.withValueMax(600)
.withValueStep(1)
.withUnit('s'),
],
meta: {
tuyaDatapoints: [
[1, 'motion', tuya.valueConverter.trueFalse0],
[9, 'trigger_sensitivity', sensitivityConverter],
[12, 'illuminance', tuya.valueConverter.raw],
[101, 'presence_sensitivity', sensitivityConverter],
[102, 'fading_time', tuya.valueConverter.raw],
],
},
};