ioBroker.discovery
ioBroker.discovery copied to clipboard
Support for rpi2 adapter
It would be very nice if I run the discovery on a Raspberry Pi, the list of suggested adapters would also show rpi2.
How to detect a raspi?
My suggestions would be:
- Read /sys/firmware/devicetree/base/model: https://raspberrypi.stackexchange.com/questions/5100/detect-that-a-python-program-is-running-on-the-pi or
- grep Hardware /proc/cpuinfo: https://www.raspberrypi.org/forums/viewtopic.php?t=54413
Side note: if the detection is too narrow (i.e. it doesn't detect if the device is a RasPi), that's not too much of an issue IMHO. The other way around it would be worse (we shouldn't detect a RasPi if it isn't one).
if (require('fs').existsSync('/proc/cpuinfo')) {
const lines = require('fs').readFileSync('/proc/cpuinfo').toString().split(/\n|\r/);
const isRaspi = lines.find(line => line.indexOf('Hardware') !== -1 && line.indexOf('BCM2708') !== -1);
console.log(`IS Raspi: ${!!isRaspi}`);
} else {
console.log(`IS Raspi: ${false}`);
}