diff --git a/src/devices/ikea.ts b/src/devices/ikea.ts index ec1263970e905..526cafeb30db8 100644 --- a/src/devices/ikea.ts +++ b/src/devices/ikea.ts @@ -1,5 +1,6 @@ import {Zcl} from 'zigbee-herdsman'; +import {repInterval} from '../lib/constants'; import { addCustomClusterManuSpecificIkeaAirPurifier, addCustomClusterManuSpecificIkeaUnknown, @@ -608,7 +609,7 @@ const definitions: DefinitionWithExtend[] = [ // Enable reporting of powerDivisor, needs to change dynamically with the amount of power // For details, see: https://github.com/Koenkk/zigbee2mqtt/issues/23961#issuecomment-2366733453 await endpoint.configureReporting('haElectricalMeasurement', [ - {attribute: 'acPowerDivisor', minimumReportInterval: 10, maximumReportInterval: 65000, reportableChange: 1}, + {attribute: 'acPowerDivisor', minimumReportInterval: 10, maximumReportInterval: repInterval.MAX, reportableChange: 1}, ]); }, }, @@ -926,7 +927,12 @@ const definitions: DefinitionWithExtend[] = [ addCustomClusterManuSpecificIkeaUnknown(), deviceEndpoints({endpoints: {'1': 1, '2': 2}}), bindCluster({cluster: 'ssIasZone', clusterType: 'input', endpointNames: ['2']}), - iasZoneAlarm({zoneType: 'contact', zoneAttributes: ['alarm_1']}), + iasZoneAlarm({ + zoneType: 'contact', + zoneAttributes: ['alarm_1'], + // This is required to prevent the device's reported state being stuck after it quickly changed back and forth: + zoneStatusReporting: true, + }), identify({isSleepy: true}), battery(), ikeaOta(), @@ -940,7 +946,12 @@ const definitions: DefinitionWithExtend[] = [ extend: [ addCustomClusterManuSpecificIkeaUnknown(), bindCluster({cluster: 'ssIasZone', clusterType: 'input'}), - iasZoneAlarm({zoneType: 'water_leak', zoneAttributes: ['alarm_1']}), + iasZoneAlarm({ + zoneType: 'water_leak', + zoneAttributes: ['alarm_1'], + // This is required to prevent the device's reported state being stuck after it quickly changed back and forth: + zoneStatusReporting: true, + }), identify({isSleepy: true}), battery(), ikeaOta(), diff --git a/src/lib/modernExtend.ts b/src/lib/modernExtend.ts index d1d6e0c3ec02e..d642d02722302 100644 --- a/src/lib/modernExtend.ts +++ b/src/lib/modernExtend.ts @@ -1407,6 +1407,7 @@ export interface IasArgs { zoneType: iasZoneType; zoneAttributes: iasZoneAttribute[]; alarmTimeout?: boolean; + zoneStatusReporting?: boolean; description?: string; } export function iasZoneAlarm(args: IasArgs): ModernExtend { @@ -1561,7 +1562,16 @@ export function iasZoneAlarm(args: IasArgs): ModernExtend { }, ]; - return {fromZigbee, exposes, isModernExtend: true}; + let configure: Configure[]; + if (args.zoneStatusReporting) { + configure = [ + async (device, coordinatorEndpoint) => { + await setupAttributes(device, coordinatorEndpoint, 'ssIasZone', [{attribute: 'zoneStatus', min: 'MIN', max: 'MAX', change: 0}]); + }, + ]; + } + + return {fromZigbee, exposes, isModernExtend: true, ...(configure && {configure})}; } export interface IasWarningArgs {