Skip to content

Commit 94e554b

Browse files
authored
fix: Prevent IKEA PARASOLL and BADRING being stuck on a previously reported state after it rapidly changes back and forth. (#8174)
1 parent 5ff3e9f commit 94e554b

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/devices/ikea.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Zcl} from 'zigbee-herdsman';
22

3+
import {repInterval} from '../lib/constants';
34
import {
45
addCustomClusterManuSpecificIkeaAirPurifier,
56
addCustomClusterManuSpecificIkeaUnknown,
@@ -608,7 +609,7 @@ const definitions: DefinitionWithExtend[] = [
608609
// Enable reporting of powerDivisor, needs to change dynamically with the amount of power
609610
// For details, see: https://github.com/Koenkk/zigbee2mqtt/issues/23961#issuecomment-2366733453
610611
await endpoint.configureReporting('haElectricalMeasurement', [
611-
{attribute: 'acPowerDivisor', minimumReportInterval: 10, maximumReportInterval: 65000, reportableChange: 1},
612+
{attribute: 'acPowerDivisor', minimumReportInterval: 10, maximumReportInterval: repInterval.MAX, reportableChange: 1},
612613
]);
613614
},
614615
},
@@ -926,7 +927,12 @@ const definitions: DefinitionWithExtend[] = [
926927
addCustomClusterManuSpecificIkeaUnknown(),
927928
deviceEndpoints({endpoints: {'1': 1, '2': 2}}),
928929
bindCluster({cluster: 'ssIasZone', clusterType: 'input', endpointNames: ['2']}),
929-
iasZoneAlarm({zoneType: 'contact', zoneAttributes: ['alarm_1']}),
930+
iasZoneAlarm({
931+
zoneType: 'contact',
932+
zoneAttributes: ['alarm_1'],
933+
// This is required to prevent the device's reported state being stuck after it quickly changed back and forth:
934+
zoneStatusReporting: true,
935+
}),
930936
identify({isSleepy: true}),
931937
battery(),
932938
ikeaOta(),
@@ -940,7 +946,12 @@ const definitions: DefinitionWithExtend[] = [
940946
extend: [
941947
addCustomClusterManuSpecificIkeaUnknown(),
942948
bindCluster({cluster: 'ssIasZone', clusterType: 'input'}),
943-
iasZoneAlarm({zoneType: 'water_leak', zoneAttributes: ['alarm_1']}),
949+
iasZoneAlarm({
950+
zoneType: 'water_leak',
951+
zoneAttributes: ['alarm_1'],
952+
// This is required to prevent the device's reported state being stuck after it quickly changed back and forth:
953+
zoneStatusReporting: true,
954+
}),
944955
identify({isSleepy: true}),
945956
battery(),
946957
ikeaOta(),

src/lib/modernExtend.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ export interface IasArgs {
14071407
zoneType: iasZoneType;
14081408
zoneAttributes: iasZoneAttribute[];
14091409
alarmTimeout?: boolean;
1410+
zoneStatusReporting?: boolean;
14101411
description?: string;
14111412
}
14121413
export function iasZoneAlarm(args: IasArgs): ModernExtend {
@@ -1561,7 +1562,16 @@ export function iasZoneAlarm(args: IasArgs): ModernExtend {
15611562
},
15621563
];
15631564

1564-
return {fromZigbee, exposes, isModernExtend: true};
1565+
let configure: Configure[];
1566+
if (args.zoneStatusReporting) {
1567+
configure = [
1568+
async (device, coordinatorEndpoint) => {
1569+
await setupAttributes(device, coordinatorEndpoint, 'ssIasZone', [{attribute: 'zoneStatus', min: 'MIN', max: 'MAX', change: 0}]);
1570+
},
1571+
];
1572+
}
1573+
1574+
return {fromZigbee, exposes, isModernExtend: true, ...(configure && {configure})};
15651575
}
15661576

15671577
export interface IasWarningArgs {

0 commit comments

Comments
 (0)