zigbee-herdsman-converters icon indicating copy to clipboard operation
zigbee-herdsman-converters copied to clipboard

feat: add support for Legrand 067761A

Open Diaoul opened this issue 3 months ago • 9 comments

Add support for Legrand 067761A

  • Device is described here
  • Documentation PR: https://github.com/Koenkk/zigbee2mqtt.io/pull/2664

Questions

  1. Currently this devices is described as "on/off" and I imagine this is enough but maybe there is something more semantically close to the buttons? e.g. fan high speed and fan low speed
  2. The device also supports genLevelCtrl but in the context of this particular switch I think it's not supposed to work. Anyways, if I want to add support for it, what should I do? The closest I found is brightness_move_up which is very far from what this is supposed to do :sweat_smile:
  3. How do I add support for OTA? It should be the same as the Wireless remote switch from Legrand as well as it's on the NLT device list from here

Diaoul avatar Mar 31 '24 14:03 Diaoul

Could you try with the generated external converter instead? Try this with the 1 April release tomorrow.

Koenkk avatar Mar 31 '24 18:03 Koenkk

What is the difference supposed to be? Would that be better? I tried to stick to the way Legrand devices work. IIRC I had an array extend with a few things inside, let me check

Diaoul avatar Apr 01 '24 11:04 Diaoul

It does not seem that it detected anything really useful :shrug: Side note: The weird characters are not escaped correctly

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

const definition = {
    zigbeeModel: [' Remote fan controller'],
    model: ' Remote fan controller',
    vendor: ' Legrand',
    description: 'Automatically generated definition',
    extend: [batteryPercentage(), identify()],
    meta: {},
};

module.exports = definition

Diaoul avatar Apr 01 '24 11:04 Diaoul

It does not seem that it detected anything really useful :shrug:

Side note: The weird characters are not escaped correctly


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



const definition = {

    zigbeeModel: [' Remote fan controller'],

    model: ' Remote fan controller',

    vendor: ' Legrand',

    description: 'Automatically generated definition',

    extend: [batteryPercentage(), identify()],

    meta: {},

};



module.exports = definition

I've recently added necessary modern extends and they will be in release version soon. It is strongly advised to use them instead of older split style converters.

mrskycriper avatar Apr 01 '24 12:04 mrskycriper

As @mrskycriper mentioned, try again with the 1.36.1 release. This will generate more clean code.

Koenkk avatar Apr 01 '24 18:04 Koenkk

Sure :+1:

Diaoul avatar Apr 01 '24 18:04 Diaoul

Hi all, Sorry to jump in here , just wanted to get some more context about this and check on how to proceed best in future. (I know this may not be the right place for such questions, thus happy to follow it elsewhere!).

While the advantages of ModernExtends are obvious, what are the intentions on the long run ? Provide "initial" support for devices until those get fully supported (manually) or replace split definitions altogether ?

Legrand devices are somewhat different, in that they do not "always" follow standards. To address this, we've implemented those quirks in vendor specific libs so far. While not ideal, this decouples those features from the "generic" implementation. How should we address this best in future ? Wouldn't a vendor specific template, that could be extended a slightly more flexible approach ?

Thanks a lot for your insights.

FabianMangold avatar Apr 09 '24 19:04 FabianMangold

Generated code with latest:

const {identify, battery, commandsOnOff, commandsLevelCtrl} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: [' Remote fan controller'],
    model: ' Remote fan controller',
    vendor: ' Legrand',
    description: 'Automatically generated definition',
    extend: [identify(), battery(), commandsOnOff(), commandsLevelCtrl()],
    meta: {},
};

module.exports = definition;

Is that better?

Diaoul avatar May 01 '24 15:05 Diaoul

@Diaoul if it works, please update the PR with it.

Koenkk avatar May 01 '24 19:05 Koenkk