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

fix: Prevent IKEA PARASOLL and BADRING being stuck on a previously reported state after it rapidly changes back and forth. #8174

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
17 changes: 14 additions & 3 deletions src/devices/ikea.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Zcl} from 'zigbee-herdsman';

import {repInterval} from '../lib/constants';
import {
addCustomClusterManuSpecificIkeaAirPurifier,
addCustomClusterManuSpecificIkeaUnknown,
Expand Down Expand Up @@ -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},
]);
},
},
Expand Down Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
12 changes: 11 additions & 1 deletion src/lib/modernExtend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@ export interface IasArgs {
zoneType: iasZoneType;
zoneAttributes: iasZoneAttribute[];
alarmTimeout?: boolean;
zoneStatusReporting?: boolean;
description?: string;
}
export function iasZoneAlarm(args: IasArgs): ModernExtend {
Expand Down Expand Up @@ -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 {
Expand Down
Loading