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

[New device support]: TS0601 - _TZE200_ppuj1vem #24124

Closed
benedicttobias opened this issue Sep 27, 2024 · 5 comments
Closed

[New device support]: TS0601 - _TZE200_ppuj1vem #24124

benedicttobias opened this issue Sep 27, 2024 · 5 comments
Labels
new device support New device support request stale Stale issues

Comments

@benedicttobias
Copy link

benedicttobias commented Sep 27, 2024

Link

https://a.co/d/dpKaOr4

Database entry

{"definition":{"description":"Human presence sensor","model":"TS0601","supports":"presence, battery_level, linkquality","vendor":"Tuya"},"friendlyName":"0xa4c1383bebfbaf96","ieeeAddr":"0xa4c1383bebfbaf96","lastSeen":1727464098607,"manufacturerName":"_TZE200_ppuj1vem","modelID":"TS0601","networkAddress":55019,"type":"EndDevice"}]}}

Zigbee2MQTT version

1.40.1

Comments

See details below... when I trigger sensor, it will log twice about "presence: false" ... and as expected after 30s, another two logs for "presence: true".

External definition

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

module.exports = definition;

What does/doesn't work with the external definition?

I tried this so far:

const tuya = require('zigbee-herdsman-converters/lib/tuya');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: tuya.fingerprint('TS0601', ['_TZE200_ppuj1vem']),
    model: 'TS0601',
    vendor: 'Tuya',
    description: 'Human presence sensor',
    toZigbee: [],
    exposes: [
        e.presence(),
        exposes.numeric('battery_level', ea.STATE).withDescription('Battery level').withUnit('%'),
    ],
    meta: {
        tuyaDatapoints: [
            [1, 'presence', tuya.valueConverter.trueFalse1], // this return the opposite value. presence is 'false' when motion is detected
            [101, 'battery_level', tuya.valueConverter.raw], // battery seems stuck at low value
        ],
    },
};

module.exports = definition;

when I trigger sensor, it will log twice about "presence: false" ... and as expected after 30s, another two logs for "presence: true".

info 2024-09-27 15:06:59z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c1383bebfbaf96', payload '{"battery_level":22,"linkquality":164,"presence":false}'
info 2024-09-27 15:06:59z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c1383bebfbaf96', payload '{"battery_level":22,"linkquality":172,"presence":false}'
info 2024-09-27 15:07:31z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c1383bebfbaf96', payload '{"battery_level":22,"linkquality":156,"presence":true}'
info 2024-09-27 15:07:31z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c1383bebfbaf96', payload '{"battery_level":22,"linkquality":160,"presence":true}'

The battery value also seems low for a battery that just replaced a month ago.

I played around with converter to flip the presence value. but no luck, it just make trigger not triggering at all :(

More info

Zigbee2MQTT version
[1.40.1](https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.40.1) commit: [unknown](https://github.com/Koenkk/zigbee2mqtt/commit/unknown)
Coordinator type
EZSP v12
Coordinator revision
7.3.1.0 build 176
Coordinator IEEE Address
0x8c65a3fffe52226a
Frontend version
0.7.4
zigbee-herdsman-converters version
20.12.1
zigbee-herdsman version
0.57.3
@benedicttobias benedicttobias added the new device support New device support request label Sep 27, 2024
@benedicttobias
Copy link
Author

wow, I just need to change tuya.valueConverter.trueFalse1 to tuya.valueConverter.trueFalse0 to fix it.
But I think presence is not correct. If I change the expose to motion, the external converter is not recognized and stays 'unsupported'

@benedicttobias
Copy link
Author

benedicttobias commented Sep 27, 2024

It is working [as far as the motion sensor and its behavior], but I have trouble to get the battery...

image

const tuya = require('zigbee-herdsman-converters/lib/tuya');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: tuya.fingerprint('TS0601', ['_TZE200_ppuj1vem']),
    model: 'TS0601',
    vendor: 'Tuya',
    description: 'Human presence sensor',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    exposes: [
        e.presence(),
        exposes.numeric('battery_level', ea.STATE).withDescription('Battery level').withUnit('%'),
    ],
    meta: {
        tuyaDatapoints: [
            [1, 'presence', tuya.valueConverter.trueFalse0],
            [101, 'battery_level', tuya.valueConverter.raw],
        ],
    },
};

module.exports = definition;

@benedicttobias
Copy link
Author

I think this should cover all: motion (shows as presence in Home Assistant), illuminance, and battery.
Anyone can comment here or I should open a PR?

const tuya = require('zigbee-herdsman-converters/lib/tuya');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: tuya.fingerprint('TS0601', ['_TZE200_ppuj1vem']),
    model: 'TS0601_motion_sensor',
    vendor: 'Tuya',
    description: 'Human presence sensor',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    exposes: [
        e.presence().withDescription('Occupancy'),
        e.illuminance_lux(),
        e.battery()
    ],
    meta: {
        tuyaDatapoints: [
            [1, 'presence', tuya.valueConverter.trueFalse0],
            [101, 'illuminance_lux', tuya.valueConverter.raw],
            [4, 'battery', tuya.valueConverter.raw]
        ],
    },
};

module.exports = definition;

@benedicttobias
Copy link
Author

I do have two devices of identical model. One of them sending the battery value as 'null'. I will take a look later to see if the datapoints key is different between those two.

image

Copy link
Contributor

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

@github-actions github-actions bot added the stale Stale issues label Dec 11, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request stale Stale issues
Projects
None yet
Development

No branches or pull requests

1 participant