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
Changes from 2 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: 16 additions & 1 deletion 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 @@ -931,6 +932,13 @@ const definitions: DefinitionWithExtend[] = [
battery(),
ikeaOta(),
],
configure: async (device) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably extracted into a modernExtend quirk and added for these 2 devices.

e.g.

export function quirkCheckinInterval(timeout: number | keyof typeof timeLookup): ModernExtend {
const configure: Configure[] = [
async (device, coordinatorEndpoint, definition) => {
device.checkinInterval = typeof timeout == 'number' ? timeout : timeLookup[timeout];
device.save();
},
];
return {configure, isModernExtend: true};
}
is quirk that also adds an addition configure step.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to add this to the already existing iasZoneAlarm, @marazmarci is this something you could change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Koenkk, I implemented the changes you requested. I'm no TypeScript dev, but I hope it is good and it works.

I didn't yet have time to actually test it, so I'm marking the PR as a draft in the meantime.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some small updates, let me know if this work!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it, and it worked both for PARASOLL and BADRING! I saw the zoneStatus attribute with the correct endpoint on the Reporting tab.

const endpoint = device.getEndpoint(2);
// This is required to prevent the device's reported state being stuck after it quickly changed back and forth
await endpoint.configureReporting('ssIasZone', [
{attribute: 'zoneStatus', minimumReportInterval: 0, maximumReportInterval: repInterval.MAX, reportableChange: 0},
]);
},
},
{
zigbeeModel: ['BADRING Water Leakage Sensor'],
Expand All @@ -945,6 +953,13 @@ const definitions: DefinitionWithExtend[] = [
battery(),
ikeaOta(),
],
configure: async (device) => {
const endpoint = device.getEndpoint(1);
// This is required to prevent the device's reported state being stuck after it quickly changed back and forth
await endpoint.configureReporting('ssIasZone', [
{attribute: 'zoneStatus', minimumReportInterval: 0, maximumReportInterval: repInterval.MAX, reportableChange: 0},
]);
},
},
// #endregion sensors
];
Expand Down
Loading