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

openhabot

v1.0.1

Published

OpenHab Bot for Facebook Messenger

Downloads

4

Readme

OpenHaBot

This is NodeJS based implementation of openHAB Bot for Facebook Messenger

Installation

npm install express body-parser node-wit http-status-codes --save

git clone https://github.com/create1st/openhabot

Configuration

  1. Create a new Facebook Page for your Bot https://www.facebook.com/pages/create
  2. Create a new Facebook App for your Bot https://developers.facebook.com/quickstarts/?platform=web
  3. Add product Messanger and set up Webhooks with http://serveo.net/ host. Check http://serveo.net/ for more details how to configure your own domain
  4. Create Wit.Ai account
$ ./ssh -R mydomain:80:localhost:1337 serveo.net
  • Create config.json
{
	"port":"1337",
	"accessToken": "FB_PAGE_ACCESS_TOKEN",
	"verifyToken": "USER_RANDOM_VERIFICATION_TOKEN",
	"appSecret": "FB_APPLICATION_SECRET",
	"witAccessToken": "WIT_AI_ACCESS_TOKEN",
	"authorizedSenders": ["YOUR_FACEBOOK_NUMBER_ID"],
	"confidenceLevel": "0.77",
	"language": "en",
	"openHabRestUri": "http://127.0.0.1:8080/rest"
}
  • Create sitemap.json
{
	"openhab_location_workplace_room": {
		"openhab_settings_temperature": {
			"openhab_set": "zwave_device_id_node2_thermostat_setpoint_heating"
		}
	},
	"openhab_location_bathroom_first_floor": {
		"openhab_settings_temperature": {
			"openhab_set": "zwave_device_id_node3_thermostat_setpoint_heating"
		}
	},
	"openhab_location_sleeping_room": {
		"openhab_settings_temperature": {
			"openhab_get": "mihome_sensor_ht_1_temperature",
			"openhab_set": "zwave_device_id_node4_thermostat_setpoint_heating"
		},
		"openhab_settings_humidity": {
			"openhab_get": "mihome_sensor_ht_1_humidity"
		}
	},
	"openhab_location_living_room": {
		"openhab_settings_temperature": {
			"openhab_get": "mihome_sensor_ht_2_temperature",
			"openhab_set": "zwave_device_id_node5_thermostat_setpoint_heating"
		},
		"openhab_settings_humidity": {
			"openhab_get": "mihome_sensor_ht_2_humidity"
		}	
	},
	"openhab_location_studio_room": {
		"openhab_settings_temperature": {
			"openhab_set": "zwave_device_id_node6_thermostat_setpoint_heating"
		}
	}
}

Keys in json are Wit.Ai entities/roles which do structure a look up path for OpenHab item. e.g. entries from Wit.Ai look up can look like:

{ openhab_set:
   [ { confidence: 0.77588039802196, value: 'ustaw', type: 'value' },
     [length]: 1 ],
  openhab_settings_temperature:
   [ { confidence: 0.84355505856879,
       value: 'temperaturę',
       type: 'value' },
     [length]: 1 ],
  openhab_location_sleeping_room:
   [ { confidence: 0.77086080572739,
       value: 'sypialni',
       type: 'value' },
     [length]: 1 ],
  number: [ { confidence: 1, value: 23, type: 'value' }, [length]: 1 ],
  openhab_unit_degree:
   [ { confidence: 0.61746979290351, value: 'stopnie', type: 'value' },
     [length]: 1 ] }
  • Create dictionary_{language_id}.json for your language
{
	"unauthorized": "You are not authorized to use this service. Your id has been recorded.",
	"unsupported_message_type": "I don't understand. How can I help you?",
	"openhab_error": "OpenHab error: %s",
	"wit_error": "Wit.Ai error: %s",
	"unrecognized_command": "I don't understand. Please be more precise",
	"get_value": "The value is %s",
	"get_value_undefined": "The value is undefined",
	"set_value": "Tha value has been set"
}