Skip to content

Commit

Permalink
feat(add): CTL-R1-TY-Zigbee (#6264)
Browse files Browse the repository at this point in the history
* Repair:The status displayed in the presence is opposite to the actual situation
Repair: "detection_distance_max" The range of max should be 1.5-5.5
Repair: "detection_distance_min" The meaning of min should be target_distance

* Repair: eslint error

* Repair: eslint error

* Add: Suppert "_TZE204_e9ajs4ft" 24G radar human presence motion sensor.

* repair eslint error

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
yuanxin32323 and Koenkk authored Oct 12, 2023
1 parent 10d6da4 commit 18f68d6
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6102,6 +6102,54 @@ const definitions: Definition[] = [
],
},
},
{
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']),
model: 'MTG075-ZB-RL',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ const tuyaTz = {
'eco_mode', 'max_temperature_limit', 'min_temperature_limits', 'manual_modes',
'medium_motion_detection_sensitivity', 'small_detection_distance', 'small_detection_sensitivity', 'switch_type',
'ph_max', 'ph_min', 'ec_max', 'ec_min', 'orp_max', 'orp_min', 'free_chlorine_max', 'free_chlorine_min', 'target_distance',
'illuminance_treshold_max', 'illuminance_treshold_min', 'presence_illuminance_switch', 'light_switch', 'light_linkage',
'indicator_light', 'find_switch', 'detection_method',
],
convertSet: async (entity, key, value, meta) => {
// A set converter is only called once; therefore we need to loop
Expand Down

0 comments on commit 18f68d6

Please sign in to comment.