Timezone Declaration creating Endless Configuration Loop

Hi all,

I’ve been trying to add some values that get set during the inform script, by starting with the timezone. I check the current time zone value of the device, and if it is not what I want, then I change it. I use the same structure in other scripts and it works just fine.

Here is my script:

log("Inform Script");

const now = Date.now();
let timeZone = declare("InternetGatewayDevice.Time.LocalTimeZone", {value: now});
timeZone = timeZone.value[0];
log(timeZone)
const easternTime = "-04:00"


if (timeZone != easternTime) {
  log("time zone not -04:00")
  declare("InternetGatewayDevice.Time.LocalTimeZone", {path: 1, value: easternTime});
}
else
{
  log("time zone == -04:00")
}

And the output in the cwmp-access log:

2022-09-13T16:40:38.429Z [INFO] : Inform; cpeRequestId=“1716269165” informEvent=“2 PERIODIC” informRetryCount=0
2022-09-13T16:40:38.442Z [INFO] : Script: Inform Script
2022-09-13T16:40:38.451Z [INFO] : ACS request; acsRequestId=“18337b95cf10000” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.459Z [INFO] : Script: -06:00
2022-09-13T16:40:38.459Z [INFO] : Script: time zone not -04:00
2022-09-13T16:40:38.474Z [INFO] : ACS request; acsRequestId=“18337b95cf10001” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.494Z [INFO] : ACS request; acsRequestId=“18337b95cf10002” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.513Z [INFO] : ACS request; acsRequestId=“18337b95cf10003” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.522Z [INFO] : Script: Inform Script
2022-09-13T16:40:38.535Z [INFO] : Script: -06:00
2022-09-13T16:40:38.535Z [INFO] : Script: time zone not -04:00
2022-09-13T16:40:38.545Z [INFO] : ACS request; acsRequestId=“18337b95cf10100” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.563Z [INFO] : ACS request; acsRequestId=“18337b95cf10101” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.580Z [INFO] : ACS request; acsRequestId=“18337b95cf10102” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.588Z [INFO] : Script: Inform Script
2022-09-13T16:40:38.598Z [INFO] : Script: -06:00
2022-09-13T16:40:38.598Z [INFO] : Script: time zone not -04:00
2022-09-13T16:40:38.606Z [INFO] : ACS request; acsRequestId=“18337b95cf10200” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.622Z [INFO] : ACS request; acsRequestId=“18337b95cf10201” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.639Z [INFO] : ACS request; acsRequestId=“18337b95cf10202” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.648Z [INFO] : Script: Inform Script
2022-09-13T16:40:38.657Z [INFO] : Script: -06:00
2022-09-13T16:40:38.657Z [INFO] : Script: time zone not -04:00
2022-09-13T16:40:38.666Z [INFO] : ACS request; acsRequestId=“18337b95cf10300” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.683Z [INFO] : ACS request; acsRequestId=“18337b95cf10301” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.700Z [INFO] : ACS request; acsRequestId=“18337b95cf10302” acsRequestName=“GetParameterValues”
2022-09-13T16:40:38.706Z [WARN] : Channel has faulted; channel=“inform” retries=0 faultCode=“preset_loop” faultMessage=“The presets are stuck in an endless configuration loop”
2022-09-13T16:40:38.706Z [WARN] : Channel has faulted; channel=“remote” retries=0 faultCode=“preset_loop” faultMessage=“The presets are stuck in an endless configuration loop”

Thanks!

https://docs.genieacs.com/en/latest/provisions.html#tags

place a tag at the end

still :

something seems wrong to me with that line. If I’m not mistaken path is used with objects. That may be the cause you get the loop.

I swapped out “path” with “value” and got the same outcome, let me try delineation via a tag.

take the shortest route and re read the docs first

https://docs.genieacs.com/en/latest/provisions.html#declare-path-timestamps-values

Your syntax is bad.

declare("InternetGatewayDevice.Time.LocalTimeZone", {path: 1}, {value: easternTime});

But, you are making things harder on yourself. Just let GenieACS manage state by taking out all the checks and just putting the declare in. GenieACS will then only update the InternetGatewayDevice.Time.LocalTimeZone param if needed.

1 Like

I fixed it with

declare("InternetGatewayDevice.Time.LocalTimeZone", null, {value: easternTime});

But I will remove the if statements and just execute the declare, thanks!

1 Like