En théorie, le fonctionnement devrait être exactement le même.
Tu peux créer un fichier nommé ‹ 600082.js › dans le dossier zigbee2mqtt en mettant ce code à l’intérieur :
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: [' NLIS - Double light switch\u0000\u0000\u0000\u0000'],
model: '600082',
vendor: 'Legrand',
description: 'Double wired switch with neutral',
fromZigbee: [fz.on_off, fz.legrand_cluster_fc01],
toZigbee: [tz.on_off, tz.legrand_settingAlwaysEnableLed, tz.legrand_settingEnableLedIfOn],
exposes: [e.switch().withEndpoint('left'),
e.switch().withEndpoint('right'),
exposes.binary('permanent_led', ea.ALL, 'ON', 'OFF').withDescription('Enable or disable the permanent blue LED'),
exposes.binary('led_when_on', ea.ALL, 'ON', 'OFF').withDescription('Enables the LED when the light is on')],
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
const endpointLeft = device.getEndpoint(1);
await reporting.bind(endpointLeft, coordinatorEndpoint, ['genOnOff']);
const endpointRight = device.getEndpoint(2);
await reporting.bind(endpointRight, coordinatorEndpoint, ['genOnOff']);
},
endpoint: (device) => {
return {left: 1, right: 2};
},
};
module.exports = definition;
Ensuite, dans le fichier ‹ configuration.yaml › de zigbee2mqtt, tu ajoutes ceci dans la partie external_converters :
"external_converters":
- 600082.js
En revanche, pour ce code, il se base sur les modifications que j’avais effectué. Pas sûr que tout soit reconnu.
Il faudra sûrement que tu adaptes le code.
Comme par exemple, la fonction fz.legrand_cluster_fc01
, c’est le nouveau nom attribué à fz.legrand_device_mode
. Pour les parties permanent_led
et led_when_on
, j’avais mis à jour le code car les fonctions ne retournées aucun état. Pour le reste, ça devrait fonctionner sans problème.