Skip to content

Commit

Permalink
fix(node): remove Scene Activation CC auto reset (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Jan 27, 2021
1 parent f0eff3e commit 1ee6d75
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions packages/zwave-js/src/lib/node/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ import {
NotificationCC,
NotificationCCReport,
} from "../commandclass/NotificationCC";
import {
getDimmingDurationValueID,
getSceneIdValueID,
SceneActivationCCSet,
} from "../commandclass/SceneActivationCC";
import {
SecurityCCNonceGet,
SecurityCCNonceReport,
Expand Down Expand Up @@ -240,7 +235,6 @@ export class ZWaveNode extends Endpoint {

// Remove all timeouts
for (const timeout of [
this.sceneActivationResetTimeout,
this.centralSceneKeyHeldDownContext?.timeout,
...this.notificationIdleTimeouts.values(),
...this.manualRefreshTimers.values(),
Expand Down Expand Up @@ -738,7 +732,6 @@ export class ZWaveNode extends Endpoint {
);
}
// And call it
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
return (api.pollValue as PollValueImplementation<T>)({
property: valueId.property,
propertyKey: valueId.propertyKey,
Expand Down Expand Up @@ -1807,8 +1800,6 @@ version: ${this.version}`;
return this.handleWakeUpNotification();
} else if (command instanceof NotificationCCReport) {
return this.handleNotificationReport(command);
} else if (command instanceof SceneActivationCCSet) {
return this.handleSceneActivationSet(command);
} else if (command instanceof ClockCCReport) {
return this.handleClockReport(command);
} else if (command instanceof SecurityCCNonceGet) {
Expand Down Expand Up @@ -2416,28 +2407,6 @@ version: ${this.version}`;
}
}

private sceneActivationResetTimeout: NodeJS.Timeout | undefined;
/** Handles the receipt of a SceneActivation Set and the automatic reset of the value */
private handleSceneActivationSet(command: SceneActivationCCSet): void {
if (this.sceneActivationResetTimeout) {
clearTimeout(this.sceneActivationResetTimeout);
}
// Schedule a reset of the CC values
this.sceneActivationResetTimeout = setTimeout(() => {
this.sceneActivationResetTimeout = undefined;
// Reset scene and duration to undefined
this.valueDB.setValue(
getSceneIdValueID(command.endpointIndex),
undefined,
);
this.valueDB.setValue(
getDimmingDurationValueID(command.endpointIndex),
undefined,
);
}, command.dimmingDuration?.toMilliseconds() ?? 0).unref();
// Unref'ing long running timeouts allows to quit the application before the timeout elapses
}

private handleClockReport(command: ClockCCReport): void {
// A Z-Wave Plus node SHOULD issue a Clock Report Command via the Lifeline Association Group if they
// suspect to have inaccurate time and/or weekdays (e.g. after battery removal).
Expand Down

0 comments on commit 1ee6d75

Please sign in to comment.