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

TS0601 PIR Sensor (_TZE200_gjldowol) #8661

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions src/devices/TS0601_pir_sensor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as exposes from '../lib/exposes';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this into tuya.ts and remove this file.

import * as tuya from '../lib/tuya';
import {Definition} from '../lib/types';

const e = exposes.presets;
const ea = exposes.access;

const definition: Definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE200_gjldowol',
},
],
zigbeeModel: ['TS0601'],
model: 'TS0601_pir_sensor',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any other model number written on the device or product page?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your follow-up. During the Zigbee2MQTT detection process, the following information is returned:

const definition = {
    zigbeeModel: ['TS0601'],
    model: 'TS0601',
    vendor: '_TZE200_gjldowol',
    description: 'Automatically generated definition',
    extend: [],
    meta: {},
};

module.exports = definition;

However, the model information printed on the device packaging and user manual differs:

  1. On the packaging: The model is listed as IH012-RT01.
  2. In the user manual: The model is listed as ZM-35ZH-Q.

This discrepancy makes it difficult to ensure accurate integration with Zigbee2MQTT. Could this be due to vendor-specific modifications to the firmware or a generic implementation for TS0601-based devices?

IMG_5176
IMG_5177

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ZM-35ZH-Q then, _TZE200_gjldowol is the internal model of the device.

vendor: '_TZE200_gjldowol',
description: 'Luminance motion sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
exposes: [
e.occupancy(),
e.illuminance().withUnit('lx'),
e.battery(),
e
.enum('sensitivity', ea.STATE_SET, ['low', 'medium', 'high'])
.withDescription('PIR sensor sensitivity (refresh and update only while active)'),
e
.numeric('keep_time', ea.STATE_SET)
.withValueMin(5)
.withValueMax(3600)
.withValueStep(1)
.withUnit('seconds')
.withDescription('PIR keep time in seconds (refresh and update only while active)'),
e
.numeric('illuminance_interval', ea.STATE_SET)
.withValueMin(1)
.withValueMax(720)
.withValueStep(1)
.withUnit('minutes')
.withDescription('Brightness acquisition interval (refresh and update only while active)'),
],
meta: {
tuyaDatapoints: [
[1, 'occupancy', tuya.valueConverterBasic.lookup({pir: true, none: false})],
[4, 'battery', tuya.valueConverter.raw],
[9, 'sensitivity', tuya.valueConverterBasic.lookup({low: tuya.enum(0), medium: tuya.enum(1), high: tuya.enum(2)})],
[12, 'illuminance', tuya.valueConverter.raw],
[101, 'illuminance_interval', tuya.valueConverter.raw],
[102, 'keep_time', tuya.valueConverter.raw],
],
},
};

export default definition;
2 changes: 2 additions & 0 deletions src/devices/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ import titan_products from './titan_products';
import tlwglobal from './tlwglobal';
import tplink from './tplink';
import trust from './trust';
import TS0601_pir_sensor from './TS0601_pir_sensor';
import tubeszb from './tubeszb';
import tuya from './tuya';
import ubisys from './ubisys';
Expand Down Expand Up @@ -604,6 +605,7 @@ export default [
...trust,
...tubeszb,
...tuya,
TS0601_pir_sensor,
...ubisys,
...uhome,
...lumi,
Expand Down
Loading