Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including pitemp with all npm packages installed. Try it out:

var pitemp = require("pitemp")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pitemp v1.1.1

pitemp

A quick and easy way to get the temperature of your Raspberry Pi with a single command. Built in NodeJS.

pitemp screenshot

Usage

Requires NodeJS.

1. Using pitemp with npx

The suggested usage is npx, because that way you'll always be running the latest version of pitemp without installing it. npx is installed by default with npm. You can get npm by installing NodeJS.

npx pitemp

// pitemp is reporting every X seconds.
// Main: 62.322° C - Max: 62.322° C

2. Installing globally and running

You can install pitemp globally with your favorite package manager.

npm install -g pitemp
yarn global add pitemp

Then simply run pitemp with the command.

pitemp

// pitemp is reporting every X seconds.
// Main: 61.323° C - Max: 62.826° C

Flags

Time -t <seconds>

  • Default: 1

Change the interval (in seconds) at which the temperature is reported.

Verbose -v

Reports a more verbose log of your temperature.

Example using every flag:

npx pitemp -v -t 3

Compatibility

MachineOperating SystemWorking
Raspberry Pi 4 (4GB RAM)Ubuntu 20.04Yes!
MacBook ProMacOS CatalinaYes!
Windows (Intel)Windows 10Yes!

If you test this somewhere, please create an issue with your information on your machine and operating system so we can add it to this compatibility table.

Troubleshooting

Try these steps only after you've tried the package and received bad results.

If you're on a Linux distro...

  1. In some cases, you'll need to install the linux sensors package to be able to measure temperature. For example, on DEBIAN based systems, you can install them sudo apt-get install lm-sensors.

If you're on Windows...

  1. Ensure you're running cmd with administrator privileges.

If you're on MacOS...

  1. Ensure you've installed Xcode CLT, or force a fresh install by:
    1. Get the path of your current Xcode CLT. xcode-select --print-path
    2. Delete it. sudo rm -r -f /Library/Developer/CommandLineTools
    3. Install Xcode CLT. xcode-select --install

If you're still facing issues, create an issue and I'll try my best to help you out.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free