npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pi-ip

v2.1.0

Published

Global nodejs module that upon boot saves the Pi's IP Address to Firebase, to make it easy to find.

Downloads

12

Readme

pi-ip

What Is This?

pi-ip is a global node module for installing on your Raspberry Pi, so that when it starts up it will report it's IP address in a cloud hosted Firebase database of your choosing.

Additionally, this module supports being installed on multiple Raspberry Pi's, all with differently configured names. All of the Pi IP addresses will be available in the same Firebase database.

Prerequisites

  1. A raspberry pi
  2. NodeJS installed (some instructions: https://learn.adafruit.com/node-embedded-development/installing-node-dot-js)
  3. A Firebase account, and database (get started: https://www.firebase.com/)

Setup

Install & Configure pi-ip

  1. Login to your raspberry pi

  2. Install pi-ip: npm install -g pi-ip

  3. Configure pi-ip: pi-ip config

  4. Test it out: pi-ip

    You should see something like the following

    { connected: true, interfaces: { eth0: '192.168.1.119' } }

Setup Wifi settings in Firebase

Pi-ip also allows you to put your wifi ssid and password in Firebase, so that when you bootup on ethernet, pi-ip will configure your wifi automatically. After the wifi is setup, pi-ip will update Firebase with the IP address of the wireless adapter. To set this up, add the following JSON to your Firebase database:

"pi-ip" : {
   "wifi" : {
      "ssid" : "REQUIRED SSID PROPERTY - your wifi network name",
      "secret-wpa" : "OPTIONAL PASSWORD PROPERTY - if using WPA or WPA2 security",
      "secret-wep" : "OPTIONAL PASSWORD PROPERTY - if using WEP security"
   }
}

The ssid is required. Though the secret-wpa and secret-wep are optional. (pi-ip will not configure the wifi if the pi is already connected to wifi.)

Setup to Run on Startup

  1. Create an init.d run script /etc/init.d/pi-ip.sh with the following contents:

    #!/bin/bash
    
    case "$1" in
        start)
        su pi -c 'pi-ip'
        ;;
        stop)
        echo "Stop not supported"
        ;;
        restart)
        echo "Restart not supported"
        ;;
        status)
        echo "Status not supported"
        ;;
    esac
       
    exit 0
  2. Make sure the pi-ip.sh script is executable: sudo chmod ugoa+rx /etc/init.d/pi-ip.sh

  3. Set the script to run on startup: sudo update-rc.d pi-ip.sh defaults

  4. Reboot your pi: sudo reboot

  5. Watch your Firebase database for updates! The database will have a node named pi-ip, with a node for each Pi within it. The JSON would look something like this:

    {
      "pi-ip" : {
        "my-pi" : {
          "interfaces" : {
             "eth0" : "192.168.1.124",
             "wlan0" : "192.168.1.126"
          }
          "timestamp" : "2015-05-11 07:21:45"
        }
      }
    }

Boot Partition Configuration

If you have many Pi's that all need to be setup, it may be inconvenient to boot all of them, and run pi-ip config on each of them.

I have added an alternate way of configuring pi-ip for these scenarios. Simply create a file called pi-ip.json in the boot partition of the Pi's SD card and fill it with configuration like so...

{"firebaseDb":"your-firebase-db-name-here","piName":"your-pi-name-here"}

(The boot partition is the one file system you see if you put your Pi's SD card into a Mac or Windows computer. If you are logged into the Pi via SSH, the boot partition can be found at /boot/.)

pi-ip will look for the config file in the usual place first, /home/pi/.pi-ip.json, and then check /boot/pi-ip.json. So if you want the boot partition version to be used, delete any existing /home/pi/.pi-ip.json file.