Request for guidance: Display list of connected devices from the router

Hello,

I’m looking for some guidance on the best way to display a list of connected devices from my router on a dashboard.

The router is a Peplink, and has a robust API. (example data below)

I have reset sensors for various router items, but I don’t have a good approach for this list.

My preference would be to auto-create entities for every item in the list. But I understand this isn’t possible with the rest-sensor. Also, the data is longer than 256 bytes so I can’t even get it into a single entity.

I don’ t have a particularly complex set of requirements, I just want a list of connected devices, and their IP addresses, on a dashboard. Preferably in some kind of table.

Thanks…

{
    "stat": "ok",
    "response": {
        "list": [
            {
                "ip": "192.168.50.2",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 78046,
                    "type": "dhcp"
                },
                "name": "TpLink Router",
                "mac": "E0:D3:62:92XXX",
                "active": true
            },
            {
                "ip": "192.168.50.10",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 51853,
                    "type": "dhcp"
                },
                "name": "vanassistant",
                "mac": "02:BE:FE:XXX,
                "active": true
            },
            {
                "ip": "192.168.50.11",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 57538,
                    "type": "dhcp"
                },
                "name": "cerbo",
                "mac": "C0:61:9A:BXXX",
                "active": true
            },
            {
                "ip": "192.168.50.12",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 0,
                    "type": "normal"
                },
                "name": "pve",
                "mac": "A8:B8:E0:0ADDD",
                "active": true
            },
            {
                "ip": "192.168.50.13",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 78090,
                    "type": "dhcp"
                },
                "name": "wled",
                "mac": "14:2B:2F:EXXX",
                "active": true
            },
            {
                "ip": "192.168.50.14",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 45991,
                    "type": "dhcp"
                },
                "name": "undermountac",
                "mac": "DC:DA:0C:48XXX",
                "active": true
            },
            {
                "ip": "192.168.50.16",
                "lease": {
                    "expiresIn": 16295,
                    "type": "dhcp"
                },
                "name": "wican",
                "mac": "DC:54:75:92XXX",
                "active": false
            },
            {
                "ip": "192.168.50.22",
                "lease": {
                    "expiresIn": 36610,
                    "type": "dhcp"
                },
                "mac": "60:3A:AF:86:XXX",
                "active": false
            },
            {
                "ip": "192.168.50.46",
                "lease": {
                    "expiresIn": 27626,
                    "type": "dhcp"
                },
                "name": "Pixel-10-Pro-XL",
                "mac": "92:13:8XXX",
                "active": false
            },
            {
                "ip": "192.168.50.51",
                "lease": {
                    "expiresIn": 79792,
                    "type": "dhcp"
                },
                "name": "espressif",
                "mac": "98:88:E0XXX",
                "active": false
            },
            {
                "ip": "192.168.50.96",
                "lease": {
                    "expiresIn": 85837,
                    "type": "dhcp"
                },
                "name": "C11-BV9T71DR140",
                "mac": "F4:C8:8A:XXX",
                "active": false
            },
            {
                "ip": "192.168.50.97",
                "connectionType": "ethernet",
                "lease": {
                    "expiresIn": 78860,
                    "type": "dhcp"
                },
                "name": "apollo-air-1-0e1394",
                "mac": "E4:B3:23:XXX",
                "active": true
            },

        ]
    }
}

If you can store a list in an attribute (like a “list of dictionaries”), you can use auto-entities or flex-table-card.
Also, if I am not mistaken, flex-table-card can be populated by a response of a service.

1 Like

I don’t use it personally, but it seems the Fing integration does just what you need.

Had a look at the linked API in the integration docs above, and it will cover everything except the expiresIn:

{
  "networkId": "wifi-12345812839223",
  "devices": [
    {
      "mac": "00:11:22:33:44:55",
      "ip": [
        "192.168.0.1"
      ],
      "state": "UP",
      "name": "Bedroom Chromecast",
      "type": "STREAMING_DONGLE",
      "make": "Google",
      "model": "Chromecast",
      "contactId": "67363e09-5ad6-40d0-883f-3e17254eec7a",
      "first_seen": "2020-04-24T12:54:21.634Z",
      "last_changed": "2020-06-11T12:01:23.164Z"
    }
  ]
}