We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04d35bf commit c69cdd8Copy full SHA for c69cdd8
index.js
@@ -11,9 +11,9 @@ module.exports = function(homebridge) {
11
12
function getSerial(){
13
var fs = require('fs');
14
- var content = fs.readFileSync('/proc/cpuinfo', 'utf8').split("\n");
15
- var serial = content[content.length-2].split(":");
16
- return serial[1].slice(9);
+ var cpuinfo = fs.readFileSync('/proc/cpuinfo', 'utf8');
+ var match = cpuinfo.match(/Serial\s*:\s*([a-f0-9]+)/i);
+ return match ? match[1] : null;
17
}
18
19
function ElecticRimLockAccessory(log, config) {
0 commit comments