diff --git a/src/converters/fromZigbee.ts b/src/converters/fromZigbee.ts index a6599ebdc6153..7f946803a54f9 100644 --- a/src/converters/fromZigbee.ts +++ b/src/converters/fromZigbee.ts @@ -3674,22 +3674,22 @@ const converters1 = { } }, } satisfies Fz.Converter, - legrand_cable_outlet_mode: { + legrand_pilot_wire_mode: { cluster: 'manuSpecificLegrandDevices2', type: ['readResponse'], convert: (model, msg, publish, options, meta) => { const payload: KeyValueAny = {}; const mode = msg.data['0']; - if (mode === 0x00) payload.cable_outlet_mode = 'comfort'; - else if (mode === 0x01) payload.cable_outlet_mode = 'comfort-1'; - else if (mode === 0x02) payload.cable_outlet_mode = 'comfort-2'; - else if (mode === 0x03) payload.cable_outlet_mode = 'eco'; - else if (mode === 0x04) payload.cable_outlet_mode = 'frost_protection'; - else if (mode === 0x05) payload.cable_outlet_mode = 'off'; + if (mode === 0x00) payload.pilot_wire_mode = 'comfort'; + else if (mode === 0x01) payload.pilot_wire_mode = 'comfort_-1'; + else if (mode === 0x02) payload.pilot_wire_mode = 'comfort_-2'; + else if (mode === 0x03) payload.pilot_wire_mode = 'eco'; + else if (mode === 0x04) payload.pilot_wire_mode = 'frost_protection'; + else if (mode === 0x05) payload.pilot_wire_mode = 'off'; else { meta.logger.warn(`Bad mode : ${mode}`); - payload.cable_outlet_mode = 'unknown'; + payload.pilot_wire_mode = 'unknown'; } return payload; }, @@ -6294,22 +6294,22 @@ const converters2 = { } }, } satisfies Fz.Converter, - nodon_fil_pilote_mode: { - cluster: 'manuSpecificNodOnFilPilote', + nodon_pilot_wire_mode: { + cluster: 'manuSpecificNodOnPilotWire', type: ['attributeReport', 'readResponse'], convert: (model, msg, publish, options, meta) => { const payload: KeyValueAny = {}; const mode = msg.data['mode']; - if (mode === 0x00) payload.mode = 'stop'; - else if (mode === 0x01) payload.mode = 'comfort'; - else if (mode === 0x02) payload.mode = 'eco'; - else if (mode === 0x03) payload.mode = 'anti-freeze'; - else if (mode === 0x04) payload.mode = 'comfort_-1'; - else if (mode === 0x05) payload.mode = 'comfort_-2'; + if (mode === 0x00) payload.pilot_wire_mode = 'off'; + else if (mode === 0x01) payload.pilot_wire_mode = 'comfort'; + else if (mode === 0x02) payload.pilot_wire_mode = 'eco'; + else if (mode === 0x03) payload.pilot_wire_mode = 'frost_protection'; + else if (mode === 0x04) payload.pilot_wire_mode = 'comfort_-1'; + else if (mode === 0x05) payload.pilot_wire_mode = 'comfort_-2'; else { meta.logger.warn(`wrong mode : ${mode}`); - payload.mode = 'unknown'; + payload.pilot_wire_mode = 'unknown'; } return payload; }, diff --git a/src/converters/toZigbee.ts b/src/converters/toZigbee.ts index 777f10fff9e5a..57a140207224a 100644 --- a/src/converters/toZigbee.ts +++ b/src/converters/toZigbee.ts @@ -3799,20 +3799,20 @@ const converters2 = { await entity.read('manuSpecificLegrandDevices', [0x0000, 0x0001, 0x0002], manufacturerOptions.legrand); }, } satisfies Tz.Converter, - legrand_cable_outlet_mode: { - key: ['cable_outlet_mode'], + legrand_pilot_wire_mode: { + key: ['pilot_wire_mode'], convertSet: async (entity, key, value, meta) => { const mode = { 'comfort': 0x00, - 'comfort-1': 0x01, - 'comfort-2': 0x02, + 'comfort_-1': 0x01, + 'comfort_-2': 0x02, 'eco': 0x03, 'frost_protection': 0x04, 'off': 0x05, }; const payload = {data: Buffer.from([utils.getFromLookup(value, mode)])}; await entity.command('manuSpecificLegrandDevices2', 'command0', payload); - return {state: {'cable_outlet_mode': value}}; + return {state: {'pilot_wire_mode': value}}; }, convertGet: async (entity, key, meta) => { await entity.read('manuSpecificLegrandDevices2', [0x0000], manufacturerOptions.legrand); @@ -5029,23 +5029,23 @@ const converters2 = { await entity.read('ssIasZone', [0x4000], {manufacturerCode: 4919}); }, } satisfies Tz.Converter, - nodon_fil_pilote_mode: { - key: ['mode'], + nodon_pilot_wire_mode: { + key: ['pilot_wire_mode'], convertSet: async (entity, key, value, meta) => { const mode = utils.getFromLookup(value, { + 'off': 0x00, 'comfort': 0x01, 'eco': 0x02, - 'anti-freeze': 0x03, - 'stop': 0x00, + 'frost_protection': 0x03, 'comfort_-1': 0x04, 'comfort_-2': 0x05, }); const payload = {'mode': mode}; - await entity.command('manuSpecificNodOnFilPilote', 'setMode', payload); - return {state: {'mode': value}}; + await entity.command('manuSpecificNodOnPilotWire', 'setMode', payload); + return {state: {'pilot_wire_mode': value}}; }, convertGet: async (entity, key, meta) => { - await entity.read('manuSpecificNodOnFilPilote', [0x0000], manufacturerOptions.nodon); + await entity.read('manuSpecificNodOnPilotWire', [0x0000], manufacturerOptions.nodon); }, } satisfies Tz.Converter, // #endregion diff --git a/src/devices/adeo.ts b/src/devices/adeo.ts index b195989155734..4b2f6edb499e5 100644 --- a/src/devices/adeo.ts +++ b/src/devices/adeo.ts @@ -364,23 +364,23 @@ const definitions: Definition[] = [ model: 'SIN-4-FP-21_EQU', vendor: 'ADEO', description: 'Equation pilot wire heating module', - fromZigbee: [fz.on_off, fz.metering, fz.nodon_fil_pilote_mode], - toZigbee: [tz.on_off, tz.nodon_fil_pilote_mode], + fromZigbee: [fz.on_off, fz.metering, fz.nodon_pilot_wire_mode], + toZigbee: [tz.on_off, tz.nodon_pilot_wire_mode], exposes: [ e.switch(), e.power(), e.energy(), - e.enum('mode', ea.ALL, ['comfort', 'eco', 'anti-freeze', 'stop', 'comfort_-1', 'comfort_-2']), + e.pilot_wire_mode(), ], configure: async (device, coordinatorEndpoint, logger) => { const ep = device.getEndpoint(1); - await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnFilPilote']); + await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnPilotWire']); await reporting.onOff(ep, {min: 1, max: 3600, change: 0}); await reporting.readMeteringMultiplierDivisor(ep); await reporting.instantaneousDemand(ep); await reporting.currentSummDelivered(ep); const p = reporting.payload('mode', 0, 120, 0, {min: 1, max: 3600, change: 0}); - await ep.configureReporting('manuSpecificNodOnFilPilote', p); + await ep.configureReporting('manuSpecificNodOnPilotWire', p); }, }, ]; diff --git a/src/devices/legrand.ts b/src/devices/legrand.ts index 2e5e1fbb11947..6ccb7698366d6 100644 --- a/src/devices/legrand.ts +++ b/src/devices/legrand.ts @@ -528,11 +528,11 @@ const definitions: Definition[] = [ vendor: 'Legrand', description: 'Cable outlet with pilot wire and consumption measurement', ota: ota.zigbeeOTA, - fromZigbee: [fzLegrand.cluster_fc01, fz.legrand_cable_outlet_mode, fz.on_off, fz.electrical_measurement, fz.power_on_behavior], - toZigbee: [tz.legrand_device_mode, tz.legrand_cable_outlet_mode, tz.on_off, tz.electrical_measurement_power, tz.power_on_behavior], + fromZigbee: [fzLegrand.cluster_fc01, fz.legrand_pilot_wire_mode, fz.on_off, fz.electrical_measurement, fz.power_on_behavior], + toZigbee: [tz.legrand_device_mode, tz.legrand_pilot_wire_mode, tz.on_off, tz.electrical_measurement_power, tz.power_on_behavior], exposes: [ e.binary('device_mode', ea.ALL, 'pilot_on', 'pilot_off'), - e.enum('cable_outlet_mode', ea.ALL, ['comfort', 'comfort-1', 'comfort-2', 'eco', 'frost_protection', 'off']), + e.pilot_wire_mode(), e.switch().withState('state', true, 'Works only when the pilot wire is deactivated'), e.power().withAccess(ea.STATE_GET), e.power_apparent(), diff --git a/src/devices/nodon.ts b/src/devices/nodon.ts index add999f761067..c942df2e32525 100644 --- a/src/devices/nodon.ts +++ b/src/devices/nodon.ts @@ -4,7 +4,6 @@ import * as reporting from '../lib/reporting'; import extend from '../lib/extend'; import * as ota from '../lib/ota'; const e = exposes.presets; -const ea = exposes.access; import tz from '../converters/toZigbee'; import fz from '../converters/fromZigbee'; @@ -123,22 +122,22 @@ const definitions: Definition[] = [ vendor: 'NodOn', description: 'Pilot wire heating module', ota: ota.zigbeeOTA, - fromZigbee: [fz.on_off, fz.metering, fz.nodon_fil_pilote_mode], - toZigbee: [tz.on_off, tz.nodon_fil_pilote_mode], + fromZigbee: [fz.on_off, fz.metering, fz.nodon_pilot_wire_mode], + toZigbee: [tz.on_off, tz.nodon_pilot_wire_mode], exposes: [ e.switch(), e.power(), e.energy(), - e.enum('mode', ea.ALL, ['comfort', 'eco', 'anti-freeze', 'stop', 'comfort_-1', 'comfort_-2']), + e.pilot_wire_mode(), ], configure: async (device, coordinatorEndpoint, logger) => { const ep = device.getEndpoint(1); - await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnFilPilote']); + await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnPilotWire']); await reporting.onOff(ep, {min: 1, max: 3600, change: 0}); await reporting.readMeteringMultiplierDivisor(ep); await reporting.instantaneousDemand(ep); await reporting.currentSummDelivered(ep); - await ep.read('manuSpecificNodOnFilPilote', ['mode']); + await ep.read('manuSpecificNodOnPilotWire', ['mode']); }, }, { @@ -147,22 +146,22 @@ const definitions: Definition[] = [ vendor: 'NodOn', description: 'Pilot wire heating module', ota: ota.zigbeeOTA, - fromZigbee: [fz.on_off, fz.metering, fz.nodon_fil_pilote_mode], - toZigbee: [tz.on_off, tz.nodon_fil_pilote_mode], + fromZigbee: [fz.on_off, fz.metering, fz.nodon_pilot_wire_mode], + toZigbee: [tz.on_off, tz.nodon_pilot_wire_mode], exposes: [ e.switch(), e.power(), e.energy(), - e.enum('mode', ea.ALL, ['comfort', 'eco', 'anti-freeze', 'stop', 'comfort_-1', 'comfort_-2']), + e.pilot_wire_mode(), ], configure: async (device, coordinatorEndpoint, logger) => { const ep = device.getEndpoint(1); - await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnFilPilote']); + await reporting.bind(ep, coordinatorEndpoint, ['genBasic', 'genIdentify', 'genOnOff', 'seMetering', 'manuSpecificNodOnPilotWire']); await reporting.onOff(ep, {min: 1, max: 3600, change: 0}); await reporting.readMeteringMultiplierDivisor(ep); await reporting.instantaneousDemand(ep); await reporting.currentSummDelivered(ep); - await ep.read('manuSpecificNodOnFilPilote', ['mode']); + await ep.read('manuSpecificNodOnPilotWire', ['mode']); }, }, { diff --git a/src/lib/exposes.ts b/src/lib/exposes.ts index dd874e3a56143..c3f75f78fd416 100644 --- a/src/lib/exposes.ts +++ b/src/lib/exposes.ts @@ -745,6 +745,7 @@ export const presets = { voltage_phase_b: () => new Numeric('voltage_phase_b', access.STATE).withLabel('Voltage phase B').withUnit('V').withDescription('Measured electrical potential value on phase B'), voltage_phase_c: () => new Numeric('voltage_phase_c', access.STATE).withLabel('Voltage phase C').withUnit('V').withDescription('Measured electrical potential value on phase C'), water_leak: () => new Binary('water_leak', access.STATE, true, false).withDescription('Indicates whether the device detected a water leak'), + pilot_wire_mode: (values=['comfort', 'eco', 'frost_protection', 'off', 'comfort_-1', 'comfort_-2']) => new Enum('pilot_wire_mode', access.ALL, ['comfort', 'eco', 'frost_protection', 'off', 'comfort_-1', 'comfort_-2']).withDescription('Controls the target temperature of the heater, with respect to the temperature set on that heater. Possible values: comfort (target temperature = heater set temperature) eco (target temperature = heater set temperature - 3.5°C), frost_protection (target temperature = 7 to 8°C), off (heater stops heating), and the less commonly used comfort_-1 (target temperature = heater set temperature - 1°C), comfort_-2 (target temperature = heater set temperature - 2°C),.'), rain: () => new Binary('rain', access.STATE, true, false).withDescription('Indicates whether the device detected rainfall'), warning: () => new Composite('warning', 'warning', access.SET) .withFeature(new Enum('mode', access.SET, ['stop', 'burglar', 'fire', 'emergency', 'police_panic', 'fire_panic', 'emergency_panic']).withDescription('Mode of the warning (sound effect)'))