I am attempting to schedule a speed test to run every hour.
In my test environment, I use a single preset without any kind of filters.
With the following provision, everything works as expected:
const hourly = Date.now(3600000);
const model = declare('DeviceID.ProductClass', { value: 1 }).value[0];
declare("InternetGatewayDevice.DownloadDiagnostics.DownloadURL", { value: hourly }, { value: "http://server/speedtest" });
declare("InternetGatewayDevice.DownloadDiagnostics.TimeBasedTestDuration", { value: hourly }, { value: "20" });
commit();
declare("InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState", { value: hourly }, { value: "Requested" });
However, when I modify the previous provision to refresh the value of DiagnosticsState, the hourly constraint of the speed test request is no longer respected, and the speed test runs again whenever the CPE sends an event of any type.
For example:
const hourly = Date.now(3600000);
const model = declare('DeviceID.ProductClass', { value: 1 }).value[0];
const now = Date.now();
declare("InternetGatewayDevice.DownloadDiagnostics.DownloadURL", { value: hourly }, { value: "http://server/speedtest" });
declare("InternetGatewayDevice.DownloadDiagnostics.TimeBasedTestDuration", { value: hourly }, { value: "20" });
commit();
declare("InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState", { value: hourly }, { value: "Requested" });
commit();
declare("InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState", { path: now, value: now });
By observing the debug logs, I noticed that during the “8 DIAGNOSTICS COMPLETE” event, the ACS queries the value of DiagnosticsState. The CPE responds with “Completed,” and immediately after, the ACS sets DiagnosticsState back to “Requested.”
This causes the speed test to execute again, ignoring the one-hour constraint, leading to an infinite loop of speed tests being initiated without adhering to the intended time interval.
Why does this happen? I understand that a workaround could involve adding event filters to the preset, but I would like to understand the root cause, as this does not seem to be the expected behavior. The behavior I expect is: The speed test runs every hour, and DiagnosticsState is refreshed whenever the CPE sends an event of any type.