Koenkk / zigbee2mqtt

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

[New device support]: Sunricher SR-ZG9001K8-CCT #23662

Open mkalela opened 2 months ago

mkalela commented 2 months ago

Link

https://www.sunricher.com/cct-wall-mounted-2-scenes-zigbee-wireless-remote-sr-zg9001k8-cct.html

Database entry

{"id":2,"type":"EndDevice","ieeeAddr":"0xb4e3f9fffeef87d9","nwkAddr":20265,"manufId":4644,"manufName":"Sunricher","powerSource":"Battery","modelId":"ZGRC-KEY-008","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":261,"inClusterList":[0,1,3,2821,4096],"outClusterList":[3,4,5,6,8,25,768,4096],"clusters":{"genBasic":{"attributes":{"appVersion":0,"stackVersion":0,"hwVersion":0}},"genPowerCfg":{"attributes":{"batteryPercentageRemaining":200}}},"binds":[{"cluster":1,"type":"endpoint","deviceIeeeAddress":"0x00124b0031f91600","endpointID":1},{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0031f91600","endpointID":1},{"cluster":8,"type":"endpoint","deviceIeeeAddress":"0x00124b0031f91600","endpointID":1},{"cluster":768,"type":"endpoint","deviceIeeeAddress":"0x00124b0031f91600","endpointID":1}],"configuredReportings":[{"cluster":1,"attrId":33,"minRepIntval":3600,"maxRepIntval":65000,"repChange":10,"manufacturerCode":null}],"meta":{}}},"appVersion":0,"stackVersion":0,"hwVersion":0,"dateCode":"NULL","swBuildId":"2.7.6_r27","zclVersion":3,"interviewCompleted":true,"meta":{"configured":332242049},"lastSeen":1724059651034}

Comments

I tried to follow the instructions for adding support for a new product, but got stuck in handling the last one of the "no converter" errors for the two Scene-buttons (S1 and S2). Additionally, I don't see the defined exposes in the device view in Home Assistant. I don't know it is related to the missing configuration, but when I pair the device with Z2M there are several devices identified, only one is successfully paired and seems to cover all buttons. See below the external definition which I have tried to craft based on other examples. In addition to solving the errors below, it would be great if someone could validate the external definition as this is the first time I am working with this topic. I have managed to test that I can now successfully use the on/off, brightness up/brightness down, buttons. I have not managed to test color temperature yet, and the scene controls are causing errors.

Here are the "no converter" errors still popping up in the logs:

[2024-08-19 13:20:49] debug: z2m: No converter available for 'ZGRC-KEY-008' with cluster 'genScenes' and type 'commandRecall' and data '{"groupid":0,"sceneid":1}'

[2024-08-19 13:20:50] debug: z2m: No converter available for 'ZGRC-KEY-008' with cluster 'genScenes' and type 'commandRecall' and data '{"groupid":0,"sceneid":2}'

External definition

const {} = require('zigbee-herdsman-converters/lib/modernExtend');
// Add the lines below
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 ota = require('zigbee-herdsman-converters/lib/ota');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['ZGRC-KEY-008'],
    model: 'SR-ZG9001K8-CCT', // Update this with the real model of the device (written on the device itself or product page)
    vendor: 'Sunricher', // Update this with the real vendor of the device (written on the device itself or product page)
    description: 'CCT wall mounted 2 scenes zigbee wireless remote', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    extend: [],
    fromZigbee: [
        fz.command_on,
        fz.command_off,
        fz.command_move,
        fz.command_stop,
        fz.battery,
        fz.command_recall,
        fz.command_step,
    ],
    toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
    exposes: [
        e.battery(),
        e.action([
            'on',
            'off',
            'brightness_move_up',
            'brightness_move_down',
            'brightness_move_stop',
            'brightness_step_up',
            'brightness_step_down',
            'color_temperature_move_up'.
            'color_temperature_move_down',
            'color_temperature_step_up',
            'color_temperature_step_down',
            'recall_*',
        ]),
    ],
    configure: async (device, coordinatorEndpoint) => {
            await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genScenes']);
    },
};

module.exports = definition;
mkalela commented 2 months ago

I noticed that the device paired without problems in ZHA. I couldn't find a quirk for it, however. Can anyone point me in the right direction? I thought I could compare my draft with the ZHA quirk.