Listing Devices infos

Is it possible to have on DEvice TAB so i can switch list and device setub for difetent typs of device ?

For Example, i have Miktrotik LTE devices, and for those i see some info for LTE

Now, if I add normal Router that don’t have LTE this field for LTE will be blank. And I need other infoes to see.
Is it possible to create different INDEX PAGE for different Manufacture or Device Type ?

Its not possible out of the box to have different info displayed for each different device mfgr. What you can do though is abuse/reuse virtual params. The vparam below will cycle through a list of keys and stop at the first value returned. So what you could do with this is display different values in a column depending on the device type, but all the logic will be abstracted away by the vparam. Example, pull the imei value for LTE devices, or the pppoe username for routers.

const keys = [
    'Device.Cellular.Interface.*.IMEI',
    'InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username',
    'Device.PPP.Interface.*.Username',
];

return {writable: false, value: [getParameterValue(keys, ''), 'xsd:string']};

function getParameterValue(keys, def) {
    for (let key of keys) {
        let d = declare(key, {value: Date.now()});

        for (let item of d) {
            if (item.value && item.value[0]) {
                return item.value[0];
            }
        }
    }

    return def;
}
1 Like