Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Legrand/Bticino LedInDark feature #6032

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -3930,6 +3930,13 @@ const converters = {
}
},
},
legrand_led_in_dark: {
cluster: 'manuSpecificLegrandDevices',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
return {led_in_dark: msg.data[1] === 1 ? 'ON' : 'OFF'};
},
},
xiaomi_power: {
cluster: 'genAnalogInput',
type: ['attributeReport', 'readResponse'],
Expand Down
8 changes: 4 additions & 4 deletions src/devices/bticino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const definitions: Definition[] = [
model: 'K4003C/L4003C/N4003C/NT4003C',
vendor: 'BTicino',
description: 'Light switch with neutral',
fromZigbee: [fz.identify, fz.on_off, fz.K4003C_binary_input, fz.legrand_cluster_fc01],
fromZigbee: [fz.identify, fz.on_off, fz.K4003C_binary_input, fz.legrand_cluster_fc01, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn, tz.legrand_identify],
exposes: [
e.switch(), e.action(['identify', 'on', 'off']),
Expand All @@ -33,7 +33,7 @@ const definitions: Definition[] = [
vendor: 'BTicino',
description: 'Dimmer switch with neutral',
extend: extend.light_onoff_brightness({noConfigure: true}),
fromZigbee: [fz.brightness, fz.identify, fz.on_off, fz.lighting_ballast_configuration, fz.legrand_cluster_fc01],
fromZigbee: [fz.brightness, fz.identify, fz.on_off, fz.lighting_ballast_configuration, fz.legrand_cluster_fc01, fz.legrand_led_in_dark],
toZigbee: [tz.light_onoff_brightness, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn,
tz.legrand_deviceMode, tz.legrand_identify, tz.ballast_config],
exposes: [
Expand Down Expand Up @@ -67,7 +67,7 @@ const definitions: Definition[] = [
vendor: 'BTicino',
description: 'Shutter SW with level control',
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.ignore_zclversion_read, fz.bticino_4027C_binary_input_moving,
fz.cover_position_tilt],
fz.cover_position_tilt, fz.legrand_led_in_dark],
toZigbee: [tz.bticino_4027C_cover_state, tz.bticino_4027C_cover_position, tz.legrand_identify,
tz.legrand_settingEnableLedInDark],
exposes: [
Expand Down Expand Up @@ -106,7 +106,7 @@ const definitions: Definition[] = [
model: 'L4531C',
vendor: 'BTicino',
description: 'Power socket with power consumption monitoring',
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement],
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_identify],
exposes: [e.switch(), e.action(['identify']), e.power(), e.voltage(), e.current()],
configure: async (device, coordinatorEndpoint, logger) => {
Expand Down
23 changes: 12 additions & 11 deletions src/devices/legrand.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ module.exports = [
model: '067776',
vendor: 'Legrand',
description: 'Netatmo wired shutter switch',
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt],
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt, fz.legrand_led_in_dark],
toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.legrand_identify, tz.legrand_settingEnableLedInDark],
ota: ota.zigbeeOTA,
configure: async (device, coordinatorEndpoint, logger) => {
Expand All @@ -167,7 +167,7 @@ module.exports = [
model: '067776_inverted',
vendor: 'Legrand',
description: 'Netatmo wired shutter switch',
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt],
fromZigbee: [fz.identify, fz.ignore_basic_report, fz.legrand_binary_input_moving, fz.cover_position_tilt, fz.legrand_led_in_dark],
toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.legrand_identify, tz.legrand_settingEnableLedInDark],
ota: ota.zigbeeOTA,
meta: {coverInverted: true},
Expand Down Expand Up @@ -243,7 +243,7 @@ module.exports = [
ota: ota.zigbeeOTA,
extend: extend.light_onoff_brightness({noConfigure: true}),
fromZigbee: [fz.brightness, fz.identify, fz.on_off, fz.lighting_ballast_configuration, fz.legrand_cluster_fc01,
fz.power_on_behavior],
fz.power_on_behavior, fz.legrand_led_in_dark],
toZigbee: [tz.light_onoff_brightness, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn,
tz.legrand_deviceMode, tz.legrand_identify, tz.ballast_config, tz.power_on_behavior],
exposes: [e.light_brightness(),
Expand Down Expand Up @@ -272,7 +272,7 @@ module.exports = [
description: 'Wired switch without neutral',
extend: extend.light_onoff_brightness({noConfigure: true}),
fromZigbee: [fz.brightness, fz.identify, fz.on_off, fz.lighting_ballast_configuration, fz.legrand_cluster_fc01,
fz.power_on_behavior],
fz.power_on_behavior, fz.legrand_led_in_dark],
toZigbee: [tz.light_onoff_brightness, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn,
tz.legrand_deviceMode, tz.legrand_identify, tz.ballast_config, tz.power_on_behavior],
exposes: [e.light_brightness(),
Expand Down Expand Up @@ -301,7 +301,7 @@ module.exports = [
vendor: 'Legrand',
ota: ota.zigbeeOTA,
description: 'Power socket with power consumption monitoring',
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.power_on_behavior],
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.power_on_behavior, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_identify, tz.legrand_settingEnableLedIfOn,
tz.power_on_behavior],
exposes: [e.switch(), e.action(['identify']), e.power(), e.power_apparent(),
Expand Down Expand Up @@ -370,7 +370,8 @@ module.exports = [
model: '412015',
vendor: 'Legrand',
description: 'DIN power consumption module',
fromZigbee: [fz.identify, fz.metering, fz.electrical_measurement, fz.ignore_basic_report, fz.ignore_genOta, fz.legrand_power_alarm],
fromZigbee: [fz.identify, fz.metering, fz.electrical_measurement, fz.ignore_basic_report, fz.ignore_genOta, fz.legrand_power_alarm,
fz.legrand_led_in_dark],
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')],
Expand Down Expand Up @@ -477,7 +478,7 @@ module.exports = [
vendor: 'Legrand',
description: 'Double wired switch with neutral',
ota: ota.zigbeeOTA,
fromZigbee: [fz.on_off, fz.legrand_binary_input_on_off, fz.legrand_cluster_fc01],
fromZigbee: [fz.on_off, fz.legrand_binary_input_on_off, fz.legrand_cluster_fc01, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn],
exposes: [e.switch().withEndpoint('left'),
e.switch().withEndpoint('right'),
Expand All @@ -502,7 +503,7 @@ module.exports = [
vendor: 'Legrand',
ota: ota.zigbeeOTA,
description: 'Outlet with power consumption monitoring',
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement],
fromZigbee: [fz.identify, fz.on_off, fz.electrical_measurement, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_identify],
exposes: [e.switch(), e.action(['identify']), e.power()],
configure: async (device, coordinatorEndpoint, logger) => {
Expand All @@ -518,7 +519,7 @@ module.exports = [
model: 'WNAL10/WNRL10',
vendor: 'Legrand',
description: 'Smart switch with Netatmo',
fromZigbee: [fz.on_off, fz.legrand_binary_input_on_off, fz.legrand_cluster_fc01],
fromZigbee: [fz.on_off, fz.legrand_binary_input_on_off, fz.legrand_cluster_fc01, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn],
exposes: [e.switch(),
exposes.binary('led_in_dark', ea.ALL, 'ON', 'OFF').withDescription(`Enables the LED when the light is turned off, allowing to` +
Expand All @@ -537,7 +538,7 @@ module.exports = [
description: 'Smart dimmer switch with Netatmo',
extend: extend.light_onoff_brightness({noConfigure: true}),
fromZigbee: [fz.brightness, fz.identify, fz.on_off, fz.lighting_ballast_configuration, fz.legrand_cluster_fc01,
fz.power_on_behavior],
fz.power_on_behavior, fz.legrand_led_in_dark],
toZigbee: [tz.light_onoff_brightness, tz.legrand_settingEnableLedInDark, tz.legrand_settingEnableLedIfOn,
tz.legrand_deviceMode, tz.legrand_identify, tz.ballast_config, tz.power_on_behavior],
exposes: [e.light_brightness(),
Expand Down Expand Up @@ -583,7 +584,7 @@ module.exports = [
model: '067766',
vendor: 'Legrand',
description: 'Centralized ventilation switch',
fromZigbee: [fz.identify, fz.on_off, fz.power_on_behavior],
fromZigbee: [fz.identify, fz.on_off, fz.power_on_behavior, fz.legrand_led_in_dark],
toZigbee: [tz.on_off, tz.legrand_settingEnableLedInDark, tz.legrand_identify, tz.legrand_settingEnableLedIfOn,
tz.power_on_behavior],
exposes: [e.switch(), e.action(['identify']),
Expand Down