Provision for Fritz!Box WAN Interface

Hello, I cannot get it to work to add a 2nd WANIPConnection which has a custom vlan (depending on the customer) and get’s its IP Address via DHCP, I already tried a lot of stuff in the provision script, here is my current script maybe there is only a small quick fixable mistake…

const wanMac = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress", {value: 1}).value[0];
const serialNumber = declare("DeviceID.SerialNumber", { value: 1 }).value[0];
const config = ext("config-fetcher", "getDeviceConfig", wanMac);

if (!config || typeof config.vlanId === 'undefined') {
    log(`Invalid config received from extension for ${serialNumber}. Aborting.`);
    return;
}
log(`Successfully fetched config for ${serialNumber}. VLAN ID: ${config.vlanId}`);

const now = Date.now();

declare('InternetGatewayDevice.Layer2Bridging.Bridge.1.BridgeEnable', null, {value: true})
declare('InternetGatewayDevice.Layer2Bridging.Bridge.1.VLAN.1.VLANEnable', null, {value: true})
declare('InternetGatewayDevice.Layer2Bridging.Bridge.1.VLAN.1.VLANName', null, {value: 'INTERNET_DHCP'})
declare('InternetGatewayDevice.Layer2Bridging.Bridge.1.VLAN.1.VLANID', null, {value: config.vlanId})

declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", null, {path: 2});
declare('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.2.Enable', null, {value: true})
declare('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.2.Name', null, {value: 'INTERNET_DHCP'})
declare('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.2.AddressingType', null, {value: 'DHCP'})
declare('InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.2.ConnectionType', null, {value: 'IP_ROUTED'})

declare("InternetGatewayDevice.Layer2Bridging.Bridge.1.VLAN.1.VLANID", { path: 1 });
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", { path: 1 });
declare("InternetGatewayDevice.WANDevice.*", { path: 1});

Your code for creating the WAN IP instance is not correct. See this post for the proper syntax.

Here is some p-code to help you understand the syntax/flow:

let basePath = 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection';
// Clear everything out
declare(basePath + '.[]', null, {path: 0});

// Create the first interface, or it *WILL* be removed. Fill in with the appropriate values
declare(basePath + '.[Enable:true,Name:MANAGEMENT,AddressingType:DHCP, ConnectionType:IP_ROUTED]', {path: 1}, {path: 1});

// Create the second interface
declare(basePath + '.[Enable:true,Name:INTERNET_DHCP,AddressingType:DHCP, ConnectionType:IP_ROUTED]', {path: 1}, {path: 1});
faultCode: "9003"
faultString: Invalid arguments
setParameterValuesFault: 
  - parameterName: InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.4.Name
    faultCode: "9001"
    faultString: Request denied
  - parameterName: InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.4.ConnectionType
    faultCode: "9001"
    faultString: Request denied

I think now genieacs is trying to create 2 additional WANIPConnections

log("BOOT PROVISION EXECUTED");

declare('InternetGatewayDevice.Layer2Bridging.Bridge.1.VLAN.1.VLANID', null, {value: '4000'})
let basePath = 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection';
declare(basePath + '.[]', null, {path: 0});
declare(basePath + '.[Enable:true,Name:internet,AddressingType:DHCP, ConnectionType:IP_ROUTED]', {path: 1}, {path: 1});
declare(basePath + '.[Enable:true,Name:tr069,AddressingType:DHCP, ConnectionType:IP_ROUTED]', {path: 1}, {path: 1});

log("BOOT PROVISIONG SUCCESSFULLY EXECUTED");

I tried a lot of things, I dont completely understand how I can configure 2 VLANs with 2 WANIPConnections

If I understand you correctly, you are saying that GenieACS has created to additional WAN IP instances for a total of 4?