Change IP on several CPE of different models

I am trying to unify the public IP change on several MiKrotik router models.

I have not been able to achieve this.

The problem is that from one model to another changes the parameter “Device.IP.Interface.1.IPv4Address.1.IPAddress”.

I have tried to create a virtual parameter similar to the one I have seen in another forum to get the hostname (identity).

My Java Script programming skills are basic

Blockquote
const now = Date.now();
let productClass = declare(“Device.DeviceInfo.ProductClass”, {value: 1}).value[0];
let client = “”;
switch(productClass) {
case “hAP AC”:
client = declare(“Device.IP.Interface.1.IPv4Address.1.IPAddress”, {value: now}).value[0];
break;
case “hAP ac³”:
client = declare(“Device.IP.Interface.1.IPv4Address.1.IPAddress”, {value: now}).value[0];
break;
case “CCR1009-7G-1C-1S+”:
client = declare(“Device.IP.Interface.2.IPv4Address.1.IPAddress”, {value: now}).value[0];
break;
case “CCR2004-16G-2S+”:
client = declare(“Device.IP.Interface.2.IPv4Address.1.IPAddress”, {value: now}).value[0];
break;
default:
client = “not supported”;
}
return {writable: true, value: [client, “xsd:string”]};