How do you identify something as a BluOs player? Do they have a recognisable MAC address pattern for example. The 1st 1/2 of a MAC address is assigned to the network card manufacturer, you can lookup the codes online.
Of course, probably the easiest thing to do is you use the settings in your router to give each player a fixed IP address in a known range or alternatively configure each player with its own fixed IP address, again in a known range.
Thank you for your reply.
Yes, the manufacturer has an own pool for mac.
As we know the mac, and the router knows the mac + leased IP (always a combination), then it shouy be possible to look it up, somehow.
At the routers info (Unifi controller node) or somehow using the OS hosting node-red (linux ARP table).
Isn't there a way to match? (Network name should also work, i think).
I would advise, if you can, to make the IP addresses of the devices static. I do that in my network by configuring DHCP. But I also maintain a list of all MAC and IP addresses found on my network along with some additional metadata that I add by hand so that I have both a human readable and a machine readable dataset. But then this is just a home network, a lot will depend on your network engineer(s).
I used to use an arpscan on my network to maintain the list but eventually replaced it with an nmap scan. While it requires sudo - so I run it from a sudo crontab - it gives a much better picture of what is on the network and it includes IP and MAC addresses.
Here is the script I run:
#! /usr/bin/env bash
# Fast scan the local network for live devices and record
# to /tmp/nmap.xml which can be used in Node-RED
# To run manually:
# sudo /home/home/nrmain/system/nmap_scan.sh
# To run via cron:
# sudo crontab -e
# 01,16,31,46 * * * * /home/home/nrmain/system/nmap_scan.sh
# Run the scan
nmap -sn --oX /tmp/nmap.xml --privileged -R --system-dns --webxml 192.168.1.0/24
# Make sure ownership & ACLs on the output are secure
chown root:home /tmp/nmap.xml
chmod --silent 640 /tmp/nmap.xml
# Trigger the Node-RED update
#curl --silent --output /dev/null 'http://localhost:1880/localnetscan' > /dev/null
#curl --insecure -I 'https://localhost:1880/localnetscan'
curl -I 'http://localhost:1880/localnetscan'
You will note that it creates a temporary XML file and I trigger a flow in Node-RED using a simple http endpoint. That flow reads the file and processes it. I could, of course have actually passed the XML back over the curl command.
The resulting conversion to JSON in Node-RED is then merged into my network devices global var, MQTT and a CSV file. I have a simple and rather cranky uibuilder web page that lets me view, search, add, delete and modify records. I have some descriptive columns so that I can add and maintain notes should I need to.
All lots of overkill for a small network but handy anyway.