# VirtualParameter Refresh ERROR

**URL:** <https://forum.genieacs.com/t/virtualparameter-refresh-error/653>\
**Category:** Uncategorized\
**Created:** [March 18, 2020, 5:48pm UTC](https://forum.genieacs.com/t/virtualparameter-refresh-error/653 "2020-03-18T17:48:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Malto4](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/malto4/32/144_2.png) [@Malto4](https://forum.genieacs.com/u/Malto4)\
**Post date:** [March 18, 2020, 5:48pm UTC](https://forum.genieacs.com/t/virtualparameter-refresh-error/653/1 "2020-03-18T17:48:53Z")

</div>

Good Afternoon everyone,

We have a VirtualParameter configured as so (based on the MAC Address Example on the Wiki):

```
let ip = "0.0.0.0";
declare("Device.WANDevice.*", {value: Date.now()});
declare("InternetGatewayDevice.WANDevice.*", {value: Date.now()});
//commit();
let d = declare("Device.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {value: Date.now()});
let igd = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {value: Date.now()});

if (d.size) {
  for (let p of d) {
    if (p.value[0]) {
      ip = p.value[0];
      break;
    }
  }
}
else if (igd.size) {
  for (let p of igd) {
    if (p.value[0]) {
      ip = p.value[0];
      break;
    }
  }
}
return {writable: false, value: [ip, "xsd:string"]};

```

With this VirtualParameter we check to see the Value of the External IP address of a WANDevice, independently of what Instance it is.

The problem we are having is that our device changes from Instance WANConnectionDevice.1… to WANConnectionDevice.2… whenever it wants to (hence the VirtualParameter).  
When our Provisioning Script calls the VirtualParameter it checks all of the ExternalIPAddress which is fine, the problem is that GenieACS thinks that WANConnectionDevice.1… still exists when it is now WANConnectionDevice.2… so the Provisioning Script gives us a fault.

We tried to fix this by adding the first 2 declares to “refresh” the current WAN Values, but it doesn’t seem to do the trick. If we access the Device Page and refresh “InternetGatewayDevice.WANDevice” manually it works just fine, but we want to automate this process.

Before:  
 ![imagen](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/672c0ad95f41836120bb6b8fb8d8153d28eab297.png)

After:  
 ![imagen](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/33b37871ccdd190831ed0b0c5e42aec0bcfcc93d.png)

We have also tried adding the “refresh” in our Provisioning script (not the VirtualParameter) and the same thing happens.

Does anybody have an idea?  
(Running GenieACS 1.1.3 instead of 1.2.0\_beta)

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [March 18, 2020, 6:26pm UTC](https://forum.genieacs.com/t/virtualparameter-refresh-error/653/2 "2020-03-18T18:26:23Z")

</div>

Change your the top of your script to this:

```javascript
let ip = "0.0.0.0";
const now = Date.now();

let d = declare("Device.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: now, value: now});
let igd = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: now, value: now});

```

The path: now part of the second argument tells Genie to verify that the paths still exist on the CPE.

-dan

---

<div class="post-metadata">

**Author:** ![Malto4](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/malto4/32/144_2.png) [@Malto4](https://forum.genieacs.com/u/Malto4)\
**Post date:** [March 18, 2020, 6:48pm UTC](https://forum.genieacs.com/t/virtualparameter-refresh-error/653/3 "2020-03-18T18:48:24Z")

</div>

Hi Dan,

Thank you for the incredibly quick response.  
With the path argument it works like a charm.

Thanks!  
James
