Koenkk / zigbee2mqtt

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

[New device support]: TERNCY Wall Switch 4 gang without neutral wire #18086

Closed gcmilo704 closed 1 year ago

gcmilo704 commented 1 year ago

Link

https://www.xiaoyan.io/en-us/wallswitch-noneutral/

Database entry

{"id":23,"type":"EndDevice","ieeeAddr":"0x8cf681fffe0db1d3","nwkAddr":26370,"manufId":4648,"manufName":"Xiaoyan","powerSource":"Mains (single phase)","modelId":"TERNCY-WS01-S4","epList":[1,2,3,4],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,3,6,32,64716],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TERNCY-WS01-S4"}},"genOta":{"attributes":{"currentFileVersion":161}},"genOnOff":{"attributes":{"onOff":1}},"manuSpecificClusterAduroSmart":{"attributes":{"23":1,"25":1,"31":0,"32":0,"33":0,"35":0,"37":1,"38":1}},"genPollCtrl":{"attributes":{"checkinInterval":480}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001cd43fdd","endpointID":1},{"cluster":32,"type":"endpoint","deviceIeeeAddress":"0x00124b001cd43fdd","endpointID":1}],"configuredReportings":[],"meta":{}},"2":{"profId":260,"epId":2,"devId":256,"inClusterList":[3,6,64716],"outClusterList":[],"clusters":{"genOnOff":{"attributes":{"onOff":0}},"manuSpecificClusterAduroSmart":{"attributes":{"23":1,"25":1,"31":0,"32":0,"33":0,"35":0,"37":2,"38":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001cd43fdd","endpointID":1}],"configuredReportings":[],"meta":{}},"3":{"profId":260,"epId":3,"devId":256,"inClusterList":[3,6,64716],"outClusterList":[],"clusters":{"genOnOff":{"attributes":{"onOff":0}},"manuSpecificClusterAduroSmart":{"attributes":{"23":1,"25":1,"31":0,"32":0,"33":0,"35":0,"37":3,"38":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001cd43fdd","endpointID":1}],"configuredReportings":[],"meta":{}},"4":{"profId":260,"epId":4,"devId":256,"inClusterList":[3,6,64716],"outClusterList":[],"clusters":{"genOnOff":{"attributes":{"onOff":0}},"manuSpecificClusterAduroSmart":{"attributes":{"23":1,"25":1,"31":0,"32":0,"33":0,"35":0,"37":4,"38":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001cd43fdd","endpointID":1}],"configuredReportings":[],"meta":{}}},"hwVersion":3,"zclVersion":3,"interviewCompleted":true,"meta":{"configured":891847970},"lastSeen":1687427091121,"defaultSendRequestWhen":"fastpoll","checkinInterval":120}

Comments

it is working for just simple on/off switch. product image below for new device support. thanks https://ae01.alicdn.com/kf/H23dac3b8a2214442b0e5f20d7db5ea61z/Terncy-Zigbee-smart-wall-light-switch-1-4-gang-ON-OFF-light-switch-86x86-mm-support.png

External converter

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 ota = require('zigbee-herdsman-converters/lib/ota');
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 definition = {
        zigbeeModel: ['TERNCY-WS01-S4'],
        model: 'TERNCY-WS01',
        vendor: 'TERNCY',
        description: 'Smart light switch - 4 gang without neutral wire',
        extend: extend.switch(),
        exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.switch().withEndpoint('l3'),
            e.switch().withEndpoint('l4')],
        endpoint: (device) => {
            return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4};
        },
        meta: {multiEndpoint: true},
        configure: async (device, coordinatorEndpoint, logger) => {
            try {
                for (const ID of [1, 2, 3, 4]) {
                    const endpoint = device.getEndpoint(ID);
                    await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
                }
            } catch (e) {
                // Fails for some: https://github.com/Koenkk/zigbee2mqtt/issues/4872
            }
            device.powerSource = 'Mains (single phase)';
            device.save();
        },
    };

module.exports = definition;

Supported color modes

No response

Color temperature range

No response

Koenkk commented 1 year ago

Added!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)