Filter in more than one parameter

Hello, does anyone know how to filter different patch parameters? Example, I want to search for MACs of connected devices but there are more than one, parameter: InternetGatewayDevice.LANDevice.1.Hosts.Host. (Here is the device number) .MACAddress.

Hi, in order to get the IP Address of a host with MAC aa:bb:cc:01:02:03, you can use something like this:
declare(‘InternetGatewayDevice.LANDevice.1.Hosts.Host.[MACAddress:“aa:bb:cc:01:02:03”].IPAddress’, {value: Date.now() }).value

1 Like

this is in filter

I tried to make sense of what you asked and I came up with the above answer … If you want to filter devices in the UI based on the MAC address of the hosts connected, this can be done with virtual parameters.

Just add a virtual parameter with the name “hostsmacs” with this code:

let macs=[];
let d=declare("InternetGatewayDevice.LANDevice.1.Hosts.Host.*", {path: Date.now()});
for (let i of d) {
    macs.push(declare(i.path+'.MACAddress', {value: Date.now()}).value[0]);
}
return {writable: false, value: [macs.join(), "xsd:string"]};

And add the following filter:

- label: "'Hosts MAC'"
  parameter: VirtualParameters.hostsmacs
  type: "'string'"

After reload you will be able to search devices by “Hosts MAC: %aa:bb:cc:01:02%” … BUT, for this to work as expected you must refresh this virtual parameter first (and also periodically).

1 Like

first thanks for the help, it worked but the value is repeating the first mac.

please replace d.path with i.path … I fixed my answer now

1 Like