Koenkk / zigbee2mqtt

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

New device support for MEG5779 from Schneider Electric #22151

Open SupperCraft5000 opened 3 months ago

SupperCraft5000 commented 3 months ago

Link

https://www.se.com/de/de/product/MEG5779-0319/connected-raumtemperaturreglermodul-polarweiss-gl%C3%A4nzend-system-m-zb/

Database entry

{"id":14,"type":"Router","ieeeAddr":"0x040d84fffe1a721c","nwkAddr":4914,"manufId":4190,"manufName":"Schneider Electric","powerSource":"Mains (single phase)","modelId":"MEG5779","epList":[1,2,4,5,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":769,"inClusterList":[0,3,4,513,516,2821,65027,65302,65315],"outClusterList":[3,10,25,1026,1030],"clusters":{"genBasic":{"attributes":{"modelId":"MEG5779","manufacturerName":"Schneider Electric","powerSource":1,"zclVersion":8}},"msOccupancySensing":{"attributes":{}},"seMetering":{"attributes":{}}},"binds":[],"configuredReportings":[],"meta":{}},"2":{"profId":260,"epId":2,"devId":770,"inClusterList":[0,3,1026],"outClusterList":[3],"clusters":{"genBasic":{"attributes":{}},"msTemperatureMeasurement":{"attributes":{"measuredValue":2332}}},"binds":[{"cluster":1026,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b72318","endpointID":1}],"configuredReportings":[{"cluster":1026,"attrId":0,"minRepIntval":10,"maxRepIntval":3600,"repChange":100,"manufacturerCode":null}],"meta":{}},"4":{"profId":260,"epId":4,"devId":263,"inClusterList":[0,3,1030],"outClusterList":[3],"clusters":{"genBasic":{"attributes":{}},"msOccupancySensing":{"attributes":{"occupancy":1}}},"binds":[{"cluster":1030,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b72318","endpointID":1}],"configuredReportings":[{"cluster":1030,"attrId":0,"minRepIntval":10,"maxRepIntval":60,"repChange":0,"manufacturerCode":null}],"meta":{}},"5":{"profId":260,"epId":5,"devId":13,"inClusterList":[0,3,4,1794],"outClusterList":[],"clusters":{"genBasic":{"attributes":{}},"seMetering":{"attributes":{"divisor":1000,"multiplier":1,"instantaneousDemand":0,"currentSummDelivered":[0,0]}}},"binds":[{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b72318","endpointID":1}],"configuredReportings":[{"cluster":1794,"attrId":1024,"minRepIntval":10,"maxRepIntval":65000,"repChange":5000,"manufacturerCode":null},{"cluster":1794,"attrId":0,"minRepIntval":10,"maxRepIntval":65000,"repChange":[0,100],"manufacturerCode":null}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"zclVersion":8,"interviewCompleted":true,"meta":{"configured":1324213189},"lastSeen":1712678689979}

Comments

I'm not skilled enough to add a new Device to zigbee2mqtt so i need a bit of help.

External definition

const {deviceEndpoints, temperature, occupancy, electricityMeter, identify} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['MEG5779'],
    model: 'MEG5779',
    vendor: 'Schneider Electric',
    description: 'Automatically generated definition',
    extend: [deviceEndpoints({"endpoints":{"1":1,"2":2,"4":4,"5":5,"242":242}}), temperature({"endpointNames":["2"]}), occupancy(), electricityMeter({"cluster":"metering"}), identify()],
    meta: {"multiEndpoint":true},
};

module.exports = definition;
chrissileinus commented 1 month ago

Hey together,

I wrote a working external converter for the MEG5779. But it`s is far away from perfect.

const {} = require('zigbee-herdsman-converters/lib/modernExtend');
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 e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['MEG5779'],
    model: 'MEG5779',
    vendor: 'Schneider Electric',
    description: 'Smart thermostat',
    fromZigbee: [
        fz.stelpro_thermostat, 
        fz.metering, 
        fz.schneider_pilot_mode, 
        fz.wiser_device_info, 
        fz.hvac_user_interface, 
        fz.temperature
    ],
    toZigbee: [
        tz.thermostat_occupied_heating_setpoint, 
        tz.thermostat_system_mode, 
        tz.thermostat_running_state,
        tz.thermostat_local_temperature, 
        tz.thermostat_control_sequence_of_operation, 
        tz.schneider_pilot_mode,
        tz.schneider_thermostat_keypad_lockout, 
        tz.thermostat_temperature_display_mode
    ],
    exposes: [
        e.binary('keypad_lockout', ea.STATE_SET, 'lock', 'unlock')
            .withDescription('Enables/disables physical input on the device'),
        e.enum('schneider_pilot_mode', ea.ALL, ['contactor', 'pilot'])
            .withDescription('Controls piloting mode'),
        e.enum('temperature_display_mode', ea.ALL, ['celsius', 'fahrenheit'])
            .withDescription('The temperature format displayed on the thermostat screen'),
        e.climate()
            .withSetpoint('occupied_heating_setpoint', 4, 30, 0.5)
            .withLocalTemperature()
            .withSystemMode(['off', 'heat'])
            .withRunningState(['idle', 'heat'])
            .withPiHeatingDemand(),
        e.temperature()
    ],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint1 = device.getEndpoint(1);
        const endpoint2 = device.getEndpoint(2);
        await reporting.bind(endpoint1, coordinatorEndpoint, ['hvacThermostat']);
        await reporting.thermostatPIHeatingDemand(endpoint1);
        await reporting.thermostatOccupiedHeatingSetpoint(endpoint1);
        await reporting.bind(endpoint2, coordinatorEndpoint, ['msTemperatureMeasurement']);
        await reporting.temperature(endpoint2);
        await endpoint1.read('hvacUserInterfaceCfg', ['keypadLockout', 'tempDisplayMode']);
    },
};

module.exports = definition;