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

Add the "ZY-M100-24GV3" human body sensor. This version adds a "dista… #7909

Merged
merged 6 commits into from
Aug 27, 2024

Conversation

yuanxin32323
Copy link
Contributor

This is a variant version of "ZY-M100-24G", with the addition of a "distance detection switch", which can selectively turn on or off "distance detection" to prevent excessive distance jitter from causing congestion in the Zigbee network. Moreover, this version has cancelled the data of "dp104", so the "presence" parameter is determined based on the data of "dp1".

…nce detection switch" to prevent excessive distance jitter from causing frequent congestion in Zigbee message reporting.
@yuanxin32323
Copy link
Contributor Author

@Koenkk I'm very sorry that there are always errors in code formatting. Please help me.

@yuanxin32323
Copy link
Contributor Author

2460466b10702c05728d1b9a53bd591
This is the cover picture of the device

@Koenkk
Copy link
Owner

Koenkk commented Aug 27, 2024

Could you also submit a picture for the docs? This can be done by:

  1. Create a fork by clicking here
  2. Go to the public/images/devices directory, Add file -> Upload files
  3. Upload the files and press Commit changes
  4. Press Contribute -> Open pull request -> update title/description -> Create pull request

Make sure that:

  • The filename is ZY-M100-24GV3.png
  • The size is 512x512
  • The background is transparent (use e.g. Adobe remove background)

@Koenkk Koenkk merged commit 9acc033 into Koenkk:master Aug 27, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Aug 27, 2024

Thanks!

@kingunlim
Copy link

hello @yuanxin32323
i have the following version, does your fix also work for this version?

best regards
image

@yuanxin32323
Copy link
Contributor Author

hello @yuanxin32323 i have the following version, does your fix also work for this version?

best regards image

Are there any problems with this device?

@thargy
Copy link

thargy commented Oct 2, 2024

I've just ordered one, and it could be game-changing!!! I have managed to install up to 20 of the previous generation devices on a single dedicated Zigbee network and just about got it stable. In reality, as Zigbee can only sustain a constant 1 msg/s before becoming unstable (it can handle bursts but not continuous throughput), the constant distance spamming makes these devices useless if you try to add more than 5-10 on an existing network.

I'm hoping the switch works as advertised, in which case I'll have to order about 25 units to replace the existing ones.

@thargy
Copy link

thargy commented Oct 2, 2024

hello @yuanxin32323 i have the following version, does your fix also work for this version?
best regards

Are there any problems with this device?

If you look at the metadata for the other 24mmWave presence sensors, some don't use DP 101 - so the find_switch might have been missed. @yuanxin32323's _TZE204_ijxvkhd0 is a 24mmWave sensor that doesn't have a find_switch, but uses a very different layout of datapoints to the _TZE204_ya4ft0w4. I think it's particularly possible for _TZE204_7gclukjs which otherwise looks identical to _TZE204_ya4ft0w4. If someone has the _TZE204_7gclukjs they might want to test if the 101 DP is exposed.

Note that _TZE204_e9ajs4ft also exposes a find_switch on DP113.

{
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_ijxvkhd0']),
model: 'ZY-M100-24G',
vendor: 'Tuya',
description: '24G MmWave radar human presence motion sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
e.enum('state', ea.STATE, ['none', 'presence', 'move']).withDescription('Presence state sensor'),
e.presence().withDescription('Occupancy'),
e.numeric('distance', ea.STATE).withDescription('Target distance'),
e.illuminance_lux().withDescription('Illuminance sensor'),
e.numeric('move_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1).withDescription('Motion sensitivity'),
e.numeric('presence_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1).withDescription('Presence sensitivity'),
e
.numeric('radar_range', ea.STATE_SET)
.withValueMin(1.5)
.withValueMax(5.5)
.withValueStep(1)
.withUnit('m')
.withDescription('Maximum range'),
e
.numeric('presence_timeout', ea.STATE_SET)
.withValueMin(1)
.withValueMax(1500)
.withValueStep(1)
.withUnit('s')
.withDescription('Fade time'),
],
meta: {
multiEndpoint: true,
tuyaDatapoints: [
[112, 'presence', tuya.valueConverter.trueFalse1],
[106, 'move_sensitivity', tuya.valueConverter.divideBy10FromOnly],
[111, 'presence_sensitivity', tuya.valueConverter.divideBy10FromOnly],
[107, 'radar_range', tuya.valueConverter.divideBy100],
[109, 'distance', tuya.valueConverter.divideBy100],
[110, 'presence_timeout', tuya.valueConverter.raw],
[104, 'illuminance_lux', tuya.valueConverter.raw],
[102, 'illuminance_treshold_max', tuya.valueConverter.raw],
[103, 'illuminance_treshold_min', tuya.valueConverter.raw],
[105, 'state', tuya.valueConverterBasic.lookup({none: 0, presence: 1, move: 2})],
],
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_7gclukjs']),
model: 'ZY-M100-24GV2',
vendor: 'Tuya',
description: '24G MmWave radar human presence motion sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
e.enum('state', ea.STATE, ['none', 'presence', 'move']).withDescription('Presence state sensor'),
e.presence().withDescription('Occupancy'),
e.numeric('distance', ea.STATE).withUnit('m').withDescription('Target distance'),
e.illuminance_lux().withDescription('Illuminance sensor'),
e.numeric('move_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1).withDescription('Motion Sensitivity'),
e.numeric('presence_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1).withDescription('Presence Sensitivity'),
e
.numeric('detection_distance_min', ea.STATE_SET)
.withValueMin(0)
.withValueMax(8.25)
.withValueStep(0.75)
.withUnit('m')
.withDescription('Minimum range'),
e
.numeric('detection_distance_max', ea.STATE_SET)
.withValueMin(0.75)
.withValueMax(9.0)
.withValueStep(0.75)
.withUnit('m')
.withDescription('Maximum range'),
e
.numeric('presence_timeout', ea.STATE_SET)
.withValueMin(1)
.withValueMax(1500)
.withValueStep(1)
.withUnit('s')
.withDescription('Fade time'),
],
meta: {
tuyaDatapoints: [
[104, 'presence', tuya.valueConverter.trueFalse1],
[2, 'move_sensitivity', tuya.valueConverter.raw],
[102, 'presence_sensitivity', tuya.valueConverter.raw],
[3, 'detection_distance_min', tuya.valueConverter.divideBy100],
[4, 'detection_distance_max', tuya.valueConverter.divideBy100],
[9, 'distance', tuya.valueConverter.divideBy10],
[105, 'presence_timeout', tuya.valueConverter.raw],
[103, 'illuminance_lux', tuya.valueConverter.raw],
[1, 'state', tuya.valueConverterBasic.lookup({none: 0, presence: 1, move: 2})],
],
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_ya4ft0w4']),
model: 'ZY-M100-24GV3',
vendor: 'Tuya',
description: '24G MmWave radar human presence motion sensor(added distance switch)',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [
e.enum('state', ea.STATE, ['none', 'presence', 'move']).withDescription('Presence state sensor'),
e.presence().withDescription('Occupancy'),
e.numeric('distance', ea.STATE).withDescription('Target distance'),
e.binary('find_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('distance switch'),
e.illuminance_lux().withDescription('Illuminance sensor'),
e.numeric('move_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withDescription('Motion Sensitivity'),
e.numeric('presence_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withDescription('Presence Sensitivity'),
e
.numeric('detection_distance_min', ea.STATE_SET)
.withValueMin(0)
.withValueMax(8.25)
.withValueStep(0.75)
.withUnit('m')
.withDescription('Minimum range'),
e
.numeric('detection_distance_max', ea.STATE_SET)
.withValueMin(0.75)
.withValueMax(9.0)
.withValueStep(0.75)
.withUnit('m')
.withDescription('Maximum range'),
e
.numeric('presence_timeout', ea.STATE_SET)
.withValueMin(1)
.withValueMax(15000)
.withValueStep(1)
.withUnit('s')
.withDescription('Fade time'),
],
meta: {
tuyaDatapoints: [
[
1,
null,
{
from: function (v, meta) {
if (v == 0) {
return {
state: 'none',
presence: false,
};
} else if (v == 1) {
return {
state: 'presence',
presence: true,
};
} else if (v == 2) {
return {
state: 'move',
presence: true,
};
} else {
return {
state: 'none',
presence: false,
};
}
},
},
],
[2, 'move_sensitivity', tuya.valueConverter.raw],
[3, 'detection_distance_min', tuya.valueConverter.divideBy100],
[4, 'detection_distance_max', tuya.valueConverter.divideBy100],
[9, 'distance', tuya.valueConverter.divideBy10],
[101, 'find_switch', tuya.valueConverter.onOff],
[102, 'presence_sensitivity', tuya.valueConverter.raw],
[103, 'illuminance_lux', tuya.valueConverter.raw],
[105, 'presence_timeout', tuya.valueConverter.raw],
],
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_e9ajs4ft']),
model: 'CTL-R1-TY-Zigbee',
vendor: 'Tuya',
description: '24G radar human presence motion sensor.',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
exposes: [
e.illuminance().withUnit('lx'),
e.presence(),
e
.numeric('presence_sensitivity', ea.STATE_SET)
.withValueMin(0)
.withValueMax(100)
.withValueStep(1)
.withUnit('%')
.withDescription('Presence sensitivity'),
e
.numeric('detection_range', ea.STATE_SET)
.withValueMin(1.5)
.withValueMax(4.5)
.withValueStep(0.1)
.withUnit('m')
.withDescription('Detection range'),
e
.numeric('detection_delay', ea.STATE_SET)
.withValueMin(1)
.withValueMax(600)
.withValueStep(1)
.withUnit('s')
.withDescription('Presence detection delay'),
e
.numeric('illuminance_treshold_max', ea.STATE_SET)
.withValueMin(0)
.withValueMax(2000)
.withValueStep(1)
.withUnit('lx')
.withDescription('The max illumiance threshold to turn on the light'),
e
.numeric('illuminance_treshold_min', ea.STATE_SET)
.withValueMin(0)
.withValueMax(2000)
.withValueStep(1)
.withUnit('lx')
.withDescription('The min illumiance threshold to turn on the light'),
e
.binary('presence_illuminance_switch', ea.STATE_SET, true, false)
.withDescription(`Whether to enable 'light_switch' illumination is between min/max threshold`),
e
.binary('light_switch', ea.STATE, 'ON', 'OFF')
.withDescription('This state will determine the light on/off based on the lighting threshold and presence sensing'),
e.binary('light_linkage', ea.STATE_SET, true, false).withDescription('Light linkage'),
e
.enum('detection_method', ea.STATE_SET, ['only_move', 'exist_move'])
.withDescription(`When 'only_move' is used, presence will only be triggered when there is movement`),
e.enum('indicator_light', ea.STATE_SET, ['presence', 'off', 'on']).withDescription('Controls when the indicator light is turned on'),
e
.binary('identify', ea.STATE_SET, true, false)
.withDescription('After turning on, the indicator light quickly flashes, used to locate devices'),
],
meta: {
tuyaDatapoints: [
[1, 'presence', tuya.valueConverter.trueFalse1],
[2, 'presence_sensitivity', tuya.valueConverter.raw],
[4, 'detection_range', tuya.valueConverter.divideBy10],
[101, 'illuminance', tuya.valueConverter.raw],
[102, 'illuminance_treshold_max', tuya.valueConverter.raw],
[103, 'illuminance_treshold_min', tuya.valueConverter.raw],
[104, 'detection_delay', tuya.valueConverter.raw],
[109, 'presence_illuminance_switch', tuya.valueConverter.trueFalseEnum1],
[105, 'light_switch', tuya.valueConverter.onOff],
[106, 'light_linkage', tuya.valueConverter.trueFalseEnum1],
[107, 'indicator_light', tuya.valueConverterBasic.lookup({presence: tuya.enum(0), off: tuya.enum(1), on: tuya.enum(2)})],
[108, 'detection_method', tuya.valueConverterBasic.lookup({only_move: tuya.enum(0), exist_move: tuya.enum(1)})],
[113, 'find_switch', tuya.valueConverter.raw],
],
},
},
{
fingerprint: tuya.fingerprint('TS0601', [
'_TZE204_sbyx0lm6',
'_TZE204_clrdrnya',
'_TZE204_dtzziy1e',
'_TZE204_iaeejhvf',
'_TZE204_mtoaryre',
'_TZE200_mp902om5',
'_TZE204_pfayrzcw',
'_TZE284_4qznlkbu',
'_TZE200_sbyx0lm6',
]),
model: 'MTG075-ZB-RL',
vendor: 'Tuya',
description: '2.4G/5.8G human presence sensor with relay',
whiteLabel: [
tuya.whitelabel('Tuya', 'MTG275-ZB-RL', '2.4G/5.8G MmWave radar human presence motion sensor', ['_TZE204_dtzziy1e']),
tuya.whitelabel('Tuya', 'MTG035-ZB-RL', 'Human presence sensor with relay', ['_TZE204_pfayrzcw']),
tuya.whitelabel('Tuya', 'MTG235-ZB-RL', '24G Human presence sensor with relay', ['_TZE204_clrdrnya']),
tuya.whitelabel('QA', 'QASZ24R', 'mmWave 24 Ghz sensor with relay', ['_TZE284_4qznlkbu']),
],
configure: tuya.configureMagicPacket,
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
exposes: [
e.presence(),
e.illuminance_lux(),
e.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('m'),
e
.numeric('radar_sensitivity', ea.STATE_SET)
.withValueMin(0)
.withValueMax(9)
.withValueStep(1)
.withDescription('Detection threshold for the strength of object energy'),
e
.numeric('detection_range', ea.STATE_SET)
.withValueMin(0)
.withValueMax(8)
.withValueStep(0.1)
.withUnit('m')
.withDescription('Maximum distance detected by the sensor'),
e
.numeric('shield_range', ea.STATE_SET)
.withValueMin(0)
.withValueMax(8)
.withValueStep(0.1)
.withUnit('m')
.withDescription('Nearest distance detected by the sensor'),
e
.numeric('entry_sensitivity', ea.STATE_SET)
.withValueMin(0)
.withValueMax(9)
.withValueStep(1)
.withDescription('Sensitivity threshold triggered for the first time when the target enters the detection range'),
e
.numeric('entry_distance_indentation', ea.STATE_SET)
.withValueMin(0)
.withValueMax(8)
.withValueStep(0.1)
.withUnit('m')
.withDescription('Indent the distance inward based on the dectection distance'),
e
.numeric('entry_filter_time', ea.STATE_SET)
.withValueMin(0)
.withValueMax(10)
.withValueStep(0.1)
.withUnit('s')
.withDescription('Sensitivity threshold triggered for the first time when the target enters the detection range '),
e
.numeric('departure_delay', ea.STATE_SET)
.withValueMin(0)
.withValueMax(600)
.withValueStep(1)
.withUnit('s')
.withDescription('Confirmation time after the target disappears'),
e
.numeric('block_time', ea.STATE_SET)
.withValueMin(0)
.withValueMax(10)
.withValueStep(0.1)
.withUnit('s')
.withDescription('Time for the target to be detected again after switching from manned(occupy) to unmanned(unoccupy) mode'),
e.binary('breaker_status', ea.STATE_SET, 'ON', 'OFF').withDescription('Remotely control the breaker in standard mode'),
e
.enum('breaker_mode', ea.STATE_SET, ['standard', 'local'])
.withDescription('Breaker mode: standard is remotely controlled, local is automatic'),
e
.numeric('illuminance_threshold', ea.STATE_SET)
.withValueMin(0)
.withValueMax(420)
.withValueStep(0.1)
.withUnit('lx')
.withDescription('Illumination threshold for local (automatic) switching mode operation'),
e.enum('status_indication', ea.STATE_SET, ['OFF', 'ON']).withDescription('Indicator light will flash when human presence is detected'),
e
.enum('sensor', ea.STATE_SET, ['on', 'off', 'occupied', 'unoccupied'])
.withDescription(
`The radar sensor can be set in four states: on, off, occupied and unoccupied. For example, if set to occupied, ` +
`it will continue to maintain presence regardless of whether someone is present or not. If set to unoccupied, the unoccupied ` +
`state will be maintained permanently.`,
),
],
meta: {
tuyaDatapoints: [
[1, 'presence', tuya.valueConverter.trueFalse1],
[2, 'radar_sensitivity', tuya.valueConverter.raw],
[3, 'shield_range', tuya.valueConverter.divideBy100],
[4, 'detection_range', tuya.valueConverter.divideBy100],
[6, 'equipment_status', tuya.valueConverter.raw],
[9, 'target_distance', tuya.valueConverter.divideBy100],
[101, 'entry_filter_time', tuya.valueConverter.divideBy10],
[102, 'departure_delay', tuya.valueConverter.raw],
[103, 'cline', tuya.valueConverter.raw],
[104, 'illuminance_lux', tuya.valueConverter.divideBy10],
[105, 'entry_sensitivity', tuya.valueConverter.raw],
[106, 'entry_distance_indentation', tuya.valueConverter.divideBy100],
[107, 'breaker_mode', tuya.valueConverterBasic.lookup({standard: tuya.enum(0), local: tuya.enum(1)})],
[108, 'breaker_status', tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1)})],
[109, 'status_indication', tuya.valueConverterBasic.lookup({OFF: tuya.enum(0), ON: tuya.enum(1)})],
[110, 'illuminance_threshold', tuya.valueConverter.divideBy10],
[111, 'breaker_polarity', tuya.valueConverterBasic.lookup({NC: tuya.enum(0), NO: tuya.enum(1)})],
[112, 'block_time', tuya.valueConverter.divideBy10],
[113, 'parameter_setting_result', tuya.valueConverter.raw],
[114, 'factory_parameters', tuya.valueConverter.raw],
[
115,
'sensor',
tuya.valueConverterBasic.lookup({
on: tuya.enum(0),
off: tuya.enum(1),
occupied: tuya.enum(2),
unoccupied: tuya.enum(3),
}),
],
],
},
},

Sadly, it's almost impossible to source the correct versions with the Find Switch available as they all look the same and the Find Switch functionality isn't advertised.

@LeeWiu
Copy link
Contributor

LeeWiu commented Oct 3, 2024

I have _TZE204_dtzziy1e device with firmware 1.0.5 and used external converter https://raw.githubusercontent.com/wzwenzhi/Wenzhi-ZigBee2mqtt/main/mtg035_radar_240701.js, I turned off "Distance Reporting" and all good but since I updated Z2M to v1.40.2 the converter is not recognised anymore:

[2024-10-03 09:02:06] error: 	z2m: Failed to load external converter file 'TZE204_dtzziy1e.js' (tuya.tz.datapoints.key is not iterable)
[2024-10-03 09:02:06] error: 	z2m: Probably there is a syntax error in the file or the external converter is not compatible with the current Zigbee2MQTT version
[2024-10-03 09:02:06] error: 	z2m: Note that external converters are not meant for long term usage, it's meant for local testing after which a pull request should be created to add out-of-the-box support for the device
[2024-10-03 09:02:06] info: 	z2m: Starting Zigbee2MQTT version 1.40.2 (commit #unknown)

Without converter I don't have anymore "Distance Reporting" option to disable it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants