I'm having some trouble getting my nodejs program to find my DS18B20 temp sensor.
While the pi4's pins aren't shown this is the gist of the wiring. I have a 4.7K ohm jumper resistor between my yellow signal wire which connects to the blue GPIO16 wire and the red +5v wire. Maybe worth noting, I've also tried this using +3.3v
My wiring
My code
const tc = require('w1temp'); // https://github.com/kolarcz/node-w1temp
const Gpio = require('onoff').Gpio; // https://github.com/fivdi/onoff+
const temps = {
    calc: {
        huntingChkAvg: 0, // Used to avoid recording bounce between temps 0.1 degree apart
        prevAvg: 0,
        avg: 0,
        calcAvg: function (tcIds) {
            let avg = 0;
            Object.keys(temps).map((key) => {
                if (key !== 'calc') {
                    avg += ((temps[key] * 9) / 5) + 32
                }
            })
            this.avg = (avg / tcIds.length)
            if (this.prevAvg === 0) { this.prevAvg = avg }
        }
    }
}
module.exports = {
   logTemp: function () {
        tc.getSensorsUids()
        .then(function (tcIds) {
            function round (val, precision) {
                let multiplier = Math.pow(10, precision || 0);
                return Math.round(val * multiplier) / multiplier;
            }
            console.log('IDs: ', tcIds);
            for (let i = 0; i < tcIds.length; i++) {
                temps[tcIds[i]] = null
                tc.getSensor(tcIds[i], enablePolling=true, interval=250).then(function (sensor) {
                    sensor.on('change', function (temp) {
                        temps[tcIds[i]] = temp
                        temps.calc.calcAvg(tcIds)
                        let avg = temps.calc.avg
                        let f = round(temps.calc.prevAvg, 3)
                        if (!(f - 0.1 < avg > f + 0.1) && avg !== temps.calc.huntingChkAvg) {
                            temps.calc.huntingChkAvg = temps.calc.prevAvg 
                            temps.calc.prevAvg = avg
                           console.log(round(avg, 1))
                        } else if (!(f - 0.1 < avg > f + 0.1)) {
                            temps.calc.huntingChkAvg = temps.calc.prevAvg
                            temps.calc.prevAvg = avg 
                        }
                    })
                }).catch((err) => { console.log('getSensor Error: ', err) });
            }
        }).catch((err) => { console.log('Error: ', err) });
    }
}
See the comments in the image below but basically a device seems to be getting added for the DS18B20 but the node-w1temp getSensor() method isn't finding it.
My checks


 
    
(2) https://raspberrypi.stackexchange.com/questions/102078/ds18b20-temperature-sensor-rj-x. Happy New Year and Cheers.
– tlfong01 Dec 31 '19 at 01:15