Pull the current temperature and humidity levels for up to 8 remote sensors. Designed for Node.js.
npm install EpicVoyage/ambientweather-ws3000
async function main() {
let ws3000 = require('ambientweather-ws3000');
let sensors = await ws3000.query();
for (let x = 1; x <= 8; x++) {
if (sensors[x].active) {
console.info('Sensor', x + 1, 'Temperature:', sensors[x].temperature + '°C, Humidity:', sensors[x].humidity + '%');
}
}
}
main();
To enable console debug messages, pass true
to query()
:
let ws3000 = require('ambientweather-ws3000');
let sensors = await ws3000.query(true);
This turns on debug messages for libusb and prints all data sent or received from the WS-3000.
You will need the build-essential, git, libusb-dev and libudev-dev packages.
sudo apt-get install build-essential git libusb-dev libudev-dev nodejs npm
To connect to the USB port as the pi
user, create /etc/udev/rules.d/50-stmicro.rules
with these contents:
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5750", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev"
The node-usb driver currently requires NodeJS v10 which is unavailable on Raspbian Stretch.
$ cat /etc/debian_version 9.13 $ node -v v8.11.1
You will need to upgrade to Raspbian Buster.
$ cat /etc/debian_version 10.9 $ node -v v10.24.0