Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.85k stars 1.65k forks source link

[New device support]: Smoke detector, EKF #21280

Open al11ex11 opened 7 months ago

al11ex11 commented 7 months ago

Link

https://ekfgroup.com/ru/catalog/products/umnyj-datchik-dyma-zigbee

Database entry

{"id":2,"type":"EndDevice","ieeeAddr":"0x142d41fffe6866c0","nwkAddr":26372,"manufId":4098,"manufName":"_TZE200_apv9jsa2","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"�\u000fV-\u0011","65506":31,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE200_apv9jsa2","stackVersion":0,"dateCode":"","appVersion":70,"zclVersion":3,"powerSource":3}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-708457359},"lastSeen":1707301508589}

Comments

Hi, please help me add a smoke detector rrry

External definition

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

module.exports = definition;
DrRamm commented 6 months ago

+1

alesterre commented 6 months ago

This external converter based on existing converter for a different TuYa smoke detector kinda works:

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

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_apv9jsa2',
        },
    ],
    model: 'SmokeDetector',
    vendor: 'EKF',
    description: 'EKF smart smoke detector',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    configure: tuya.configureMagicPacket,
    exposes: [
        e.smoke(), e.battery(), tuya.exposes.batteryState(),
        e.binary('silence', ea.STATE_SET, 'ON', 'OFF'),
        e.enum('self_test', ea.STATE, ['checking', 'check_success', 'check_failure']),
    ],
    meta: {
        tuyaDatapoints: [
            [1, 'smoke', tuya.valueConverter.trueFalse0],
            [9, 'self_test', tuya.valueConverterBasic.lookup({'checking': 0, 'check_success': 1, 'check_failure': 2})],
            [14, 'battery_state', tuya.valueConverter.batteryState],
            [15, 'battery', tuya.valueConverter.raw],
            [16, 'silence', tuya.valueConverter.onOff],
        ],
    },
};

module.exports = definition;

Smoke detection definitely works, but I am not sure about everything else, for example self_test always reports 'checking' after the first short button press, battery not reported at all yet and silence I will try to check later, not sure how it is supposed to work.

The config is taken from here (from device '_TZE204_vawy74yh' / 'ZSS-HM-SSD01'): https://github.com/Koenkk/zigbee-herdsman-converters/blob/b405404c2d8db02d94feb3a114c9baf2bd2fcf4e/src/devices/moes.ts#L400

github-actions[bot] commented 2 days ago

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