Skip to content

Commit

Permalink
feat: Add OTA for multiple Legrand devices (#5936)
Browse files Browse the repository at this point in the history
* add OTA on Multiple Legrand Devices

due to Koenkk/zigbee-OTA#322

* remove duplicate
  • Loading branch information
SilentT-FR authored Jul 2, 2023
1 parent 70a9083 commit b4e5a28
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/devices/legrand.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module.exports = [
extend: extend.switch(),
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_cluster_fc01, fz.ignore_basic_report, fz.ignore_genOta],
toZigbee: [tz.legrand_deviceMode, tz.on_off, tz.legrand_identify, tz.electrical_measurement_power, tzLocal.auto_mode],
ota: ota.zigbeeOTA,
exposes: [exposes.switch().withState('state', true, 'On/off (works only if device is in "switch" mode)'),
e.power().withAccess(ea.STATE_GET),
exposes.enum('device_mode', ea.ALL, ['switch', 'auto'])
Expand All @@ -99,6 +100,7 @@ module.exports = [
extend: extend.switch(),
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_cluster_fc01, fz.ignore_basic_report, fz.ignore_genOta],
toZigbee: [tz.legrand_deviceMode, tz.on_off, tz.legrand_identify, tz.electrical_measurement_power],
ota: ota.zigbeeOTA,
exposes: [exposes.switch().withState('state', true, 'On/off (works only if device is in "switch" mode)'),
e.power().withAccess(ea.STATE_GET), exposes.enum('device_mode', ea.ALL, ['switch', 'auto'])
.withDescription('switch: allow on/off, auto will use wired action via C1/C2 on teleruptor with buttons')],
Expand Down Expand Up @@ -141,6 +143,7 @@ module.exports = [
description: 'Netatmo wired shutter switch',
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt],
toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.legrand_identify, tz.legrand_settingEnableLedInDark],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genBinaryInput', 'closuresWindowCovering', 'genIdentify']);
Expand All @@ -166,6 +169,7 @@ module.exports = [
description: 'Netatmo wired shutter switch',
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt],
toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.legrand_identify, tz.legrand_settingEnableLedInDark],
ota: ota.zigbeeOTA,
meta: {coverInverted: true},
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
Expand Down Expand Up @@ -222,6 +226,7 @@ module.exports = [
fromZigbee: [fz.identify, fz.command_on, fz.command_off, fz.command_toggle, fz.battery],
exposes: [e.battery(), e.action(['identify', 'on', 'off', 'toggle'])],
toZigbee: [],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'genOnOff']);
Expand Down Expand Up @@ -278,6 +283,7 @@ module.exports = [
` see the switch in the dark`),
exposes.binary('led_if_on', ea.ALL, 'ON', 'OFF').withDescription('Enables the LED when the light is turned on'),
e.power_on_behavior()],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
await extend.light_onoff_brightness().configure(device, coordinatorEndpoint, logger);
const endpoint = device.getEndpoint(1);
Expand Down Expand Up @@ -341,6 +347,7 @@ module.exports = [
toZigbee: [],
meta: {battery: {voltageToPercentage: '3V_2500'}},
whiteLabel: [{vendor: 'BTicino', model: 'LN4570CWI'}],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
Expand All @@ -365,6 +372,7 @@ module.exports = [
toZigbee: [tz.legrand_settingEnableLedInDark, tz.legrand_identify, tz.electrical_measurement_power, tz.legrand_powerAlarm],
exposes: [e.power().withAccess(ea.STATE_GET), e.power_apparent(), exposes.binary('power_alarm_active', ea.STATE, true, false),
exposes.binary('power_alarm', ea.ALL, true, false).withDescription('Enable/disable the power alarm')],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['haElectricalMeasurement', 'genIdentify']);
Expand Down Expand Up @@ -408,6 +416,7 @@ module.exports = [
toZigbee: [],
exposes: [e.battery(), e.action(['enter', 'leave', 'sleep', 'wakeup', 'center'])],
meta: {battery: {voltageToPercentage: '3V_2500'}},
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genIdentify', 'genPowerCfg']);
Expand Down

0 comments on commit b4e5a28

Please sign in to comment.