Koenkk / zigbee2mqtt

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

[New device support]: Extend Supported Attributes For Schneider 3025CSGZ #24704

Open Stog opened 2 weeks ago

Stog commented 2 weeks ago

Link

https://www.zigbee2mqtt.io/devices/3025CSGZ.html

Database entry

{"id":6,"type":"Router","ieeeAddr":"0x705464fffe290a7f","nwkAddr":49654,"manufId":4190,"manufName":"Schneider Electric","powerSource":"Mains (single phase)","modelId":"CH/Socket/2","epList":[1,2,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,3,4,5,6,15,2821],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"dateCode":""}},"genOnOff":{"attributes":{"onOff":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c129dd","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1}],"meta":{}},"2":{"profId":260,"epId":2,"devId":256,"inClusterList":[0,3,4,5,6,15,2821],"outClusterList":[],"clusters":{"genBasic":{"attributes":{"dateCode":""}},"genOnOff":{"attributes":{"onOff":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c129dd","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":1,"stackVersion":6,"hwVersion":1,"dateCode":"","swBuildId":"01.01.10 0\u0000","zclVersion":3,"interviewCompleted":true,"meta":{"configured":332242049},"lastSeen":1731220740521}

Zigbee2MQTT version

1.41.0

Comments

Tried to create an external definition for this existing device, however I was unable to get the definition to work correctly or send the data to MQTT so it will appear in Home Assistant.

I was trying to add support for:

Purpose for wanting this support is so an automation can be crated to "toggle" the power as the "Power-On behavior" is not a supported attribute for the devices I have installed.

External definition

const {deviceEndpoints, onOff, binary, number} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['CH/Socket/2'],
    model: '3025CSGZ',
    vendor: 'Schneider Electric',
    description: 'Custom configuration for 3025CSGZ smart socket to expose switch sensor state and on/off delay times.',
    extend: [
        deviceEndpoints({
            endpoints: {
                "1": 1,
                "2": 2
            }
        }),
        onOff({
            "powerOnBehavior":false,
            "endpointNames":[
                "1",
                "2"
            ]
        }),
        binary({
            "name":"Left Switch",
            "cluster":"genBinaryInput",
            "attribute":"presentValue",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "valueOn":["ON",1],
            "valueOff":["OFF",0],
            "description":"Smart state",
            "access":"STATE_GET",
            "endpointName":"1"
        }),
        binary({
            "name":"Right Switch",
            "cluster":"genBinaryInput",
            "attribute":"presentValue",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "valueOn":["ON",1],
            "valueOff":["OFF",0],
            "description":"Smart state",
            "access":"STATE_GET",
            "endpointName":"2"
        }),
        nummber({
            "name":"Left switch on delay",
            "cluster":"OnOff",
            "attribute":"onTime",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "description":"Delay time in seconds",
            "access":"STATE_GET",
            "endpointName":"1"
        }),
        nummber({
            "name":"Right switch on delay",
            "cluster":"OnOff",
            "attribute":"onTime",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "description":"Delay time in seconds",
            "access":"STATE_GET",
            "endpointName":"2"
        }),
        nummber({
            "name":"Left switch off delay",
            "cluster":"OnOff",
            "attribute":"offTime",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "description":"Delay time in seconds",
            "access":"STATE_GET",
            "endpointName":"1"
        }),
        nummber({
            "name":"Right switch off delay",
            "cluster":"OnOff",
            "attribute":"offTime",
            "reporting":{
                "attribute":"presentValue",
                "min":"MIN",
                "max":"MAX",
                "change":1
            },
            "description":"Delay time in seconds",
            "access":"STATE_GET",
            "endpointName":"2"
        })
    ],
    meta: {"multiEndpoint":true},
};

module.exports = definition;

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

There seems to be a syntax error in my code and I cant find / understand what is preventing it from loading. I have spent a few hours attempting to get it working with no luck.

Hoping someone can help by enhancing the support for this device within Zigbee2MQTT.