So one problem I see is you are refreshing parameters paths that you don’t need to. The second parameter to a declare is how old the path can be before a GPN is performed by the ACS. Example:
declare("Device.ManagementServer.ConnectionRequestUsername", {value: daily}, {value: username});
Should be:
declare("Device.ManagementServer.ConnectionRequestUsername", {value: 1}, {value: username});
As the path Device.ManagementServer.ConnectionRequestUsername
is never going to change .
Where the timestamp param is more useful is where you have instances that can be changed by the CPE. Example:
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.HostName", {path: hourly, value: hourly});
But I would question why you want to refresh the lan hosts that frequently.
So to fix your scripts:
default:
const hourly = Date.now(3600000);
/* No need to refresh this value, part of the spec is for the CPE to inform is hardware/software version */
//declare("InternetGatewayDevice.DeviceInfo.HardwareVersion", {value: 1});
//declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", {value: 1});
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.MACAddress", {value: 1}); // The MAC address doesn't change hourly :D
/* Again, part of the spec is for the CPE to reports its ExternalIPAddress on change */
//declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: hourly, value: hourly});
/* Does the user have access to change the SSID on the gateway? If so, do this: */
declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.SSID", {notification: hourly}, {value: 1});
/* Otherwise, if the SSID can only be changed via the ACS, there is no need to refresh the SSID */
/* There is no need to refresh the KeyPassphrase. The CPE is required by the spec to always return an empty string */
//declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.KeyPassphrase", {path: hourly, value: 1});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.HostName", {path: hourly, value: hourly});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.IPAddress", {path: hourly, value: hourly});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.MACAddress", {path: hourly, value: hourly});
Inform:
// Device ID as user name
const username = declare("DeviceID.ID", {value: 1}).value[0];
// Password will be fixed a given device because Math.random() is seeded with devcie ID by default.
const password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);
const informInterval = 7200;
// Refresh values daily
const daily = Date.now(86400000);
// Unique inform offset per device for better load distribution
const informTime = daily % 86400000;
/*
* This doesn't work the way (I think) you think it does. This value always comes out to 62368454. Its
* not random. Unless you have a massive power outage, you will find overtime your CPEs via
* entropy will automatically load balance themselves. In the case of a massive power outage,
* things might be a little rough on start, but because of the built-in (to the CPE/spec) back off interval
* the hit won't be quite as bad as you would think. Some CPEs are going to invariably timeout on initial
* connection attempt, but they will keep trying until they get through
* Plus, there really isn't a need to have both an inform interval and inform time; unless you need the CPE to inform at
* a specific time (+/- the inform interval)
*/
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestUsername", null, {value: username});
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestPassword", null, {value: password});
declare("InternetGatewayDevice.ManagementServer.PeriodicInformEnable", null, {value: true});
declare("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", null, {value: informInterval});
//declare("InternetGatewayDevice.ManagementServer.PeriodicInformTime", null, {value: informTime});
declare("Device.ManagementServer.ConnectionRequestUsername", null, {value: username});
declare("Device.ManagementServer.ConnectionRequestPassword", null, {value: password});
declare("Device.ManagementServer.PeriodicInformEnable", null, {value: true});
declare("Device.ManagementServer.PeriodicInformInterval", null, {value: informInterval});
//declare("Device.ManagementServer.PeriodicInformTime", null, {value: informTime});