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

smartthings-mqtt-proxy

v1.0.2

Published

Proxy between SmartThings and MQTT

Downloads

8

Readme

SmartThings MQTT Proxy

System to share and control device states via MQTT from SmartThings.

GitHub Tag

This project was spawned by the desire to integrate AqualinkD with SmartThings and is based on smartthings-mqtt-bridge. Since AqualinkD already supports MQTT, we chose to modify smartthings-mqtt-bridge to act as a proxy between SmartThings and MQTT.

MQTT Events

Events about a device (power, level, switch) are sent to MQTT using the following format:

{PREFACE}/{DEVICE_NAME}[/${ATTRIBUTE}]

PREFACE is defined as "aqualinkd" by default in your AqualinkD configuration

For example, my Filter Pump is called "Filter_Pump" in AqualinkD. The following topics are published:

# Filter Pump Enabled (0|1)
aqualinkd/Filter_Pump
# FIlter Pump Delay (0|1)
aqualinkd/Filter_Pump/delay

See the AqualinkD WiKi for further definition of the topics pusblished by AqualinkD.

The Proxy also provides the ability to subscribe to changes in these topics, so that SmartThings can receive updates to the device status via MQTT.

$ mqtt pub -t 'aqualinkd/Spa_Heater/set' -m '1'
# Spa Heater is enabled in AqualinkD

Configuration

The proxy has one yaml file for configuration:

---
mqtt:
    # Specify your MQTT Broker's hostname or IP address here
    host: localhost

    # Other optional settings from https://www.npmjs.com/package/mqtt#mqttclientstreambuilder-options
    # username: AzureDiamond
    # password: hunter2

    # Don't retain the values, as this can cause AqualinkD to receive old commands when it restarts
    retain: false

    # Port number to listen on
    port: 8080

Installation

To install the module, just use npm:

$ npm install -g smartthings-mqtt-proxy

If you want to run it, you can simply call the binary:

$ smartthings-mqtt-proxy
Starting SmartThings MQTT Proxy - v1.0.1
Loading configuration
No previous configuration found, creating one

Although we recommend using a process manager like [PM2][pm2]:

$ pm2 start smartthings-mqtt-proxy
[PM2] Starting smartthings-mqtt-proxy in fork_mode (1 instance)
[PM2] Done.
┌─────────────────────────┬────┬──────┬───────┬────────┬─────────┬────────┬────────────┬──────────┐
│ App name                │ id │ mode │ pid   │ status │ restart │ uptime │ memory     │ watching │
├─────────────────────────┼────┼──────┼───────┼────────┼─────────┼────────┼────────────┼──────────┤
│ smartthings-mqtt-proxy  │ 1  │ fork │ 20715 │ online │ 0       │ 0s     │ 7.523 MB   │ disabled │
└─────────────────────────┴────┴──────┴───────┴────────┴─────────┴────────┴────────────┴──────────┘

$ pm2 logs smartthings-mqtt-proxy
smartthings-mqtt-proxy-1 (out): info: Starting SmartThings MQTT Proxy - v1.0.1
smartthings-mqtt-proxy-1 (out): info: Loading configuration
smartthings-mqtt-proxy-1 (out): info: No previous configuration found, creating one

$ pm2 restart smartthings-mqtt-proxy