Put any value in a virtual parameter

Hello, I have been using genieacs for some time now and I have a new task to try to solve. We are trying to add routers from different brands, but this brings a problem: the name of the SSID and password variables of the device’s SSID changes according to the brand. I already have everything configured for a single brand, but now, with the addition of the others, I wanted to standardize everything and, for example, create a virtual variable that I would edit the values ​​with new values ​​and apply to the original router variable according to the brand. Is this possible?

Yes. Virtual Parameters — GenieACS Documentation 1.2.13 documentation

for example I have this virtual test parameter:

let ssid = "";
return {writable: true, value: [ssid, "xsd:string"]};

But when I try to edit its value, I get the following error:

I have other virtual parameters that work normally, like the one below:

let ssid = "";
let marcaHuawei = declare("DeviceID.ProductClass", {value: 1});

if(marcaHuawei.value[0] == "Huawei")
{
  //É roteador Huawei
  ssid = declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.SSID", {value: 1});
}
else
{
  //É roteador Datacom
  ssid = declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", {value: 1});
}

return {writable: true, value: [ssid.value[0], "xsd:string"]};

But in these cases, I am directly changing the ssid value and the virtual parameter just copies the ssid value

This script will accomplish your goal:

let value;

if ("value" in args[1]) {
    // Set declared value
    value = args[1].value;
} else if ("value" in args[3]) {
    // No declared value, keep current value
    value = args[3].value;
} else {
    // No current value, use default
    value = ['{}', 'xsd:string'];
}

return {writable: true, value: value};

It worked, thank you very much. I updated my provision, now every time I make a change in the vparam the original variable receives the value of the vparam.