Koenkk / zigbee2mqtt

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

Schneider Electric MEG5126-0300 with MEG5172-0000 2GANG/DIMMER/2 #21439

Open Highflyer100 opened 8 months ago

Highflyer100 commented 8 months ago

Link

https://merten.de/produkt/meg5126-0300-connected-taster-modul-2fach-system-m.html

Database entry

*

Comments

Hi, followed the procedure for adding unsupported devices, but still I get the following error messages in the log:

External definition

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

const definition = {
    zigbeeModel: ['2GANG/DIMMER/2'],
    model: '2GANG/DIMMER/2',
    vendor: 'Schneider Electric',
    description: 'Automatically generated definition',
    extend: [deviceEndpoints({"endpoints":{"3":3,"4":4,"21":21,"22":22,"242":242}}), onOff({"powerOnBehavior":false,"endpoints":{"3":3,"4":4}}), identify()],
    meta: {"multiEndpoint":true},
};

module.exports = definition;
Highflyer100 commented 8 months ago

const {deviceEndpoints, onOff, identify} = 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 extend = require('zigbee-herdsman-converters/lib/extend'); const ota = require('zigbee-herdsman-converters/lib/ota'); const tuya = require('zigbee-herdsman-converters/lib/tuya'); const {} = require('zigbee-herdsman-converters/lib/tuya'); 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: ['2GANG/DIMMER/2'], model: '2GANG/DIMMER/2', vendor: 'Schneider Electric', description: 'Automatically generated definition', extend: [deviceEndpoints({"endpoints":{"3":3,"4":4,"21":21,"22":22,"242":242}}), onOff({"powerOnBehavior":false,"endpoints":{"3":3,"4":4}}), identify()], meta: {"multiEndpoint":true}, };

module.exports = definition;

Errors in log: Zigbee2MQTT:error 2024-02-18 10:30:13: Failed to load external converter file 'dimmer.js' ('2GANG/DIMMER/2' has multiple 'endpoint', this is not allowed) Zigbee2MQTT:error 2024-02-18 10:30:13: Probably there is a syntax error in the file or the external converter is not compatible with the current Zigbee2MQTT version

Zigbee2MQTT:debug 2024-02-18 10:38:33: Received MQTT message on 'zigbee2mqtt/0x1c34f1fffe22c9e5/set' with data '{"state_3":"ON"}' Zigbee2MQTT:error 2024-02-18 10:38:33: No converter available for 'state_3' ("ON") Zigbee2MQTT:debug 2024-02-18 10:38:34: Received MQTT message on 'zigbee2mqtt/0x1c34f1fffe22c9e5/set' with data '{"state_4":"ON"}' Zigbee2MQTT:error 2024-02-18 10:38:34: No converter available for 'state_4' ("ON")

Highflyer100 commented 8 months ago

I made some progress:

With this converter from Nailik, i managed to be able to switch and dimm one of the two lights. Also found out that endpoint 4 and 21 are for light 1. 3 and 22 for light 2.

This is my converter actually:

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 definition = { zigbeeModel: ['2GANG/DIMMER/2'], model: 'MEG5126-0300/MEG5172-0000', vendor: 'Schneider Electric', description: 'Merten (MEG5172-0000 PlusLink) Dimmer (1fold) insert with Merten (MEG5126-0300) Wiser System M Push Button (2fold)', fromZigbee: [ fz.on_off, fz.brightness, fz.level_config, fz.wiser_lighting_ballast_configuration ], toZigbee: [ tz.light_onoff_brightness, tz.level_config, tz.ballast_config, tz.wiser_dimmer_mode ], exposes: [ e.light_brightness().withLevelConfig().withEndpoint('l1'), e.numeric('ballast_minimum_level', ea.ALL).withValueMin(1).withValueMax(254) .withDescription('Specifies the minimum light output of the ballast'), e.numeric('ballast_maximum_level', ea.ALL).withValueMin(1).withValueMax(254) .withDescription('Specifies the maximum light output of the ballast'), e.enum('dimmer_mode', ea.ALL, ['auto', 'rc', 'rl', 'rl_led']) .withDescription('Sets dimming mode to autodetect or fixed RC/RL/RL_LED mode (max load is reduced in RL_LED)') ], configure: async (device, coordinatorEndpoint, logger) => { const endpoint1 = device.getEndpoint(3); await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl', 'lightingBallastCfg']); await reporting.onOff(endpoint1); await reporting.brightness(endpoint1); const endpoint2 = device.getEndpoint(22); }, endpoint: (device) => { return {l1: 3, l2: 22}; } };

module.exports = definition;

How can I insert into this converter the same content for endpoints 4 and 21. I want to duplicate whats already in there as my switch is a 2 fold switch with 2 dimmers attached to it.

Rgds,

Highflyer100 commented 8 months ago

Got it working. 2Gang/Dimmer2 MEG5126-0300 with MEG5172-0000

PRO: Both lights can be switched and dimmed. CONT: No feedback to HA, when switched on via wall mounted physical switches. And when switched ON, it always goes to full brightness.

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 definition = { zigbeeModel: ['2GANG/DIMMER/2'], model: 'MEG5126-0300/MEG5172-0000', vendor: 'Schneider Electric', description: 'Merten (MEG5172-0000 PlusLink) Dimmer (2fold) insert with Merten (MEG5126-0300) Wiser System M Push Button (2fold)', fromZigbee: [ fz.on_off, fz.brightness, fz.level_config, fz.wiser_lighting_ballast_configuration ], toZigbee: [ tz.light_onoff_brightness, tz.level_config, tz.ballast_config, tz.wiser_dimmer_mode ], exposes: [ e.light_brightness().withLevelConfig().withEndpoint('l1'), e.light_brightness().withLevelConfig().withEndpoint('l2'), e.numeric('ballast_minimum_level', ea.ALL).withValueMin(1).withValueMax(254) .withDescription('Specifies the minimum light output of the ballast'), e.numeric('ballast_maximum_level', ea.ALL).withValueMin(1).withValueMax(254) .withDescription('Specifies the maximum light output of the ballast'), e.enum('dimmer_mode', ea.ALL, ['auto', 'rc', 'rl', 'rl_led']) .withDescription('Sets dimming mode to autodetect or fixed RC/RL/RL_LED mode (max load is reduced in RL_LED)') ], configure: async (device, coordinatorEndpoint, logger) => { const endpoint1 = device.getEndpoint(4); await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl', 'lightingBallastCfg']); await reporting.onOff(endpoint1); await reporting.brightness(endpoint1);
const endpoint2 = device.getEndpoint(3); await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl', 'lightingBallastCfg']); await reporting.onOff(endpoint1); await reporting.brightness(endpoint1);
}, endpoint: (device) => { return {l1: 4, l2: 3}; } };

module.exports = definition;

Koenkk commented 8 months ago

No feedback to HA, when switched on via wall mounted physical switches.

Does the configure succeed? You can force it via the z2m frontend -> device -> yellow refresh icon.

Highflyer100 commented 8 months ago

Forcing it does not work either. But the same problems exits with the HUE bulbs with the HA integration. Even with a wrong state in HA, the automation still works, that's the most important thing.

Apart this, the converter for the 2Gang/Dimmer/2 MEG 5126-0300 with MEG5172-0000 insert works very well. ON/OFF and Dimming, Start Level Brightness ---- all good.

I tried to pull a request, but it didn't work out. I need to look for a tutorial. But my converter could be a good base for all 2 switch Schneider Electric devices.

Nailik commented 6 months ago

@Highflyer100 by now the 2Gang/Dimmer/2 MEG 5126-0300 with MEG5172-0000 is supported by z2mqtt maybe you could remove your custom converted and try it out.

however this "problem": And when switched ON, it always goes to full brightness. is still the same (when using harware button). my idea is to change Ballast maximum level at a specific time in order for it to not go full brightness - but Ballast maximum level seems to have no effect.

Highflyer100 commented 6 months ago

@Nailik I deleted my custom converter and tried yours.

Seems to work fine for me.

When switched ON, it goes to full brightness. It doesn't matter if I am using HA or Hardware. I would love to have the original feature, like it was in Wiser Room App in bluetooth mode, where you were able to determine that the startup level should correspond to the level when switched OFF.

What I did however, and it works fine for me as I use the corresponding lights mostly during evening time, I wrote under

Same for endpoint 4

This worked for HA and Hardware to have the lights started with only 25% brightness. (Attribute Number between 0-255). So I just need very minor adjustements to set the right brightness.

The slider in zigbee2mqtt for brightness control now shows only 60. Before I could turn it down to 60, but when toggling the lights, it went right back to 254.

Nailik commented 6 months ago

@Highflyer100 with https://github.com/Koenkk/zigbee-herdsman-converters/pull/7395#issuecomment-2053560669 the levelCtrl is in current dev build of z2mqtt. However it currently can't be changed by UI because the save button is missing (at least for me) see https://github.com/Koenkk/zigbee2mqtt/issues/22195#issuecomment-2052416708

I (will) use NodeRed to update it, you just need to send {"write":{"cluster":"genLevelCtrl","options":{},"payload":{"onLevel":254}}} onto zigbee2mqtt/light_id/endpoint_id/set where light_id is the name of your light and endpoint_id either 3 or 4 (left and right)

Highflyer100 commented 6 months ago

I can actually change it in the DEV Console, endpoint 3 cluster: levelctrl atrribute: Onlevel . Put a number in between 1-255 and click on write.

Highflyer100 commented 6 months ago

Zigbee2MQTT – Home Assistant

github-actions[bot] commented 1 week 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