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

openhab-webhook

v1.0.3

Published

A nodejs webhook server to use Locative & Geofency iOS apps to conrol OpenHAB presence items. When a geofence or iBeacon is entered/exited, ON/OFF command is sent.

Downloads

10

Readme

openhab-webhook

A nodejs webhook server to use Locative & Geofency iOS apps to conrol OpenHAB presence items. When a geofence or iBeacon is entered/exited, ON/OFF command is sent.

No authenication is implemented.

Getting Started

Prerequisites

Nodejs
NPM
PM2 (Optional. For running node apps as a background services)

Update your local package index:

sudo apt-get update

Install Node.js:

sudo apt-get install nodejs

Install NPM (Node Package Manager):

sudo apt-get install npm

Installation

Install openhab-webhook from NPM:

sudo npm install openhab-webhook -g

By default, the OpenHAB server is set to localhost at port 8080, and the webhook listener listens on port 8000. To change this, edit the settings.json file in /usr/local/lib/node/openhab-webhook

Test it!

Run openhab-webhook in terminal:

openhab-webhook

It should print out what port the webhook listener is running on, and the OpenHAB connection status. You should be able to visit serverip:8000 from a browser. (to quit, hit Ctrl + C)

Locative (iOS app) configuration

In GLOBAL HTTP SETTINGS on the settings page:

  • Set the URL to: http://serverip:8000
  • Select POST and leave HTTP Basic Authentication off.

When you add a Geofence or iBeacon:

  • Give Custom Location ID or Custom iBeacon ID the same name as the item you want to switch ON/OFF in OpenHAB.
  • Set Trigger on Arrival and Trigger on Departure on/off as desired.
  • Don't edit the url, this way it will use the global url you set in GLOBAL HTTP SETTINGS.

Geofency (iOS app) configuration

  • Add an iBeacon
  • Tap the menu button on that iBeacon, then tap Edit Name and make this the same name as the item you want to switch ON/OFF in OpenHAB.
  • Tap the again, then tap Webhook
  • Tap Event → URL Settings
  • Set Notify on Entry and Notify on Exit on/off as desired.
  • Set both URLs to http://serverip:8000
  • Leave POST Format on Default

Proximity Events (iOS app)

(Implemented, but not tested)

Run as background service with PM2

Install PM2 to run node apps as background services:

sudo npm install pm2 -g

start openhab-webhook as service with PM2:

pm2 start openhab-webhook

Generate PM2 startup script:

sudo pm2 startup

How the PM2 startup script works

The PM2 startup script that starts your Node applications, (called 'pm2-init.sh.') lives in the 'etc/init.d/' directory. It does not specically start openhab-webhook. Instead, it starts the programs that were running under PM2 the last time the server shutdown.

License

This project is licensed under the MIT License - see the LICENSE file for details