srveit/insteon-hub2

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# insteon-hub2

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![MIT License][license-image]][license-url]
[![Node.js Version][node-version-image]][node-version-url]
[![GitHub Build Status][github-build-badge]][github-build-url]
[![Codecov Status][codecov-image]][codecov-url]
[![Code Climate][code-climate-image]][code-climate-url]
[![Gitter][gitter-image]][gitter-url]
[![Known Vulnerabilities][snyk-badge]][snyk-url]
<!-- [![js-canonical-style][canonical-image]][canonical-url] -->

Library for monitoring and controlling Insteon devices through an Insteon hub.

## Architucture

The INSTEON Hub 2 has a HTTP port that allows for controlling and monitoring
the hub and the devices controlled by it. To send a command to the hub, you
send a HTTP request. To read responses from the hub is a little trickier.
You send a HTTP request to get the buffer which returns a string of
hexadecimal characters. This string implements a
[ring (or circular) buffer][circular-buffer-url]. In order to not miss and
messages, this buffer must be read at a rate of 20 times per second.

## INSTEON Command Types

SD, Standard-length Direct Commands
  direct SDO v
  directAck SDK v
  directNak SDN v

ED, Extended-length Direct Commands
  direct EDO v
  directAck EDK
  directNak EDN

SA, Standard-length ALL-Link Commands
  allLinkBroadcast SAO v

EA, Extended-length ALL-Link Commands
  allLinkBroadcast EAO

SC, Standard-length ALL-Link Cleanup Commands
  allLinkCleanup SCO v
  allLinkCleanupAck SCK v
  allLinkCleanupNak SCN v

EC, Extended-length ALL-Link Cleanup Commands
  allLinkCleanup ECO
  allLinkCleanupAck ECK
  allLinkCleanupNak ECN

SB, Standard-length Broadcast Commands
  broadcast SBO v

EB, Extended-length Broadcast Commands
  broadcast SBO

## INSTEON Message Types

There are 16 logically possible INSTEON Message Types denoted by four bits in the Message Flags byte within an INSTEON Message. A three-letter mnemonic designates the INSTEON Message Type. The first letter is S for Standard-length or E for Extended-length messages. The second letter is D for Direct, B for Broadcast, A for ALL-Link Broadcast, or C for ALL-Link Cleanup messages. The third letter, which is optional, is O for Outgoing, K for ACK, or N for NAK messages. Valid Outgoing INSTEON Message Types are SD, ED, SA, SC, and SB. Valid INSTEON Acknowledgement Message Types are SDK, SDN, SCK, and SCN.

Currently used (as of 2/2009):

- SD, Standard-length Direct Commands
  - direct SDO v (receives acknowledgement)
  - directAck SDK v
  - directNak SDN v

- ED, Extended-length Direct Commands
  - direct EDO v (receives acknowledgement)

- SA, Standard-length ALL-Link Commands
  - allLinkBroadcast SAO v

- SC, Standard-length ALL-Link Cleanup Commands
  - allLinkCleanup SCO v (receives acknowledgement)
  - allLinkCleanupAck SCK v
  - allLinkCleanupNak SCN v

- SB, Standard-length Broadcast Commands
  - broadcast SBO

## Undocumented IM commands

- 59-5F (5C received)
- 74-7F (77 and 7F received)

## Hardware

| Model    | Version | Revision | Category | Subcategory | Other                                             |
| -------- | ------- | -------- | -------- | ----------- | ------------------------------------------------- |
| 2477D    | 8.2     | 3117     | 01       | 20          | 45                                                |
| 2477DH   | 8.2     | 3117     | 01       | 2D          | 44                                                |
| 2477S    | 7.2     | 2717     | 01       | 2A          | 45                                                |
| 2663-222 | 7.4     | 4117     | 01       | 39          | 44                                                |
| 2245-222 | 2.8     | 3417     | 03       | 33          | A3 04-20140904  1013  Build Dec 18 2017  09:43:02 |

## Files

- allLinkDatabase.js
  - createAllLinkDatabase
- allLinkRecord.js
  - createAllLinkRecord
- commandAnnotator.js
  - createCommandAnnotator
- constants.js
  - ALL\_LINK\_CODES
  - ALL\_LINK\_CONTROL\_CODES
  - ALL\_LINK\_CONTROL\_NAMES
  - ALL\_LINK\_TYPES
  - BUTTON\_EVENTS
  - INSTEON\_MESSAGE\_TYPES
  - NAK\_ERROR\_CODES
  - OPERATING\_FLAGS
  - OUTLET\_CODES
  - OUTLET\_NAMES
  - ENGINE\_VERSION\_CODES
  - ENGINE\_VERSION\_NAMES
  - X10\_COMMANDS
  - X10\_HOUSE\_CODES
  - X10\_UNIT\_CODES
- device.js
  - createDevice
- deviceCategories.js
  - '00'
  - '01'
  - '02'
  - '03'
  - '04'
  - '05'
  - '06'
  - '07'
  - '08'
  - '09'
  - '0A'
  - '0B'
  - '0C'
  - '0D'
  - '0E'
  - '0F'
  - '10'
  - '11'
  - '12'
  - '13'
  - '14'
  - '15'
  - '16'
  - '17'
  - FE
  - FF
- deviceManager.js
  - createDeviceManager
- encodeCommand.js
  - encodeCommand
  - commandResponseMatcher
- house.js
  - createHouse
- parseInsteonCommand.js
  - parseInsteonCommand
- parsePlmBuffer.js
  - parsePlmBuffer
- parsers.js
  - parsers
- plm.js
  - createPlm
- plmBase.js
  - createPlmBase
- plmBufferProcessor.js
  - createPlmBufferProcessor
- plmCommandQueue.js
  - createPlmCommandQueue
- plmCommandStream.js
  - createPlmCommandStream
- plmStream.js
  - createPlmStream

## References

- [openHAB 1 Add-ons resources](https://github.com/openhab/openhab1-addons/tree/master/bundles/binding/org.openhab.binding.insteonplm/src/main/resources)
- [leftover code](https://web.archive.org/web/20191230021838/http://www.leftovercode.info/)
- [Leftover Code SmartLinc](https://web.archive.org/web/20181213025708/http://leftovercode.info/smartlinc.php)
- [The Insteon Hub and SmartLinc 2414N HTTP API for X10 Devices](https://web.archive.org/web/20181222053916/http://leftovercode.info/smartlinc_x10.php)
- [Quick Reference Guide for Smarthome Device Manager for INSTEON](https://web.archive.org/web/20130519075719/http://www.insteon.com/sdk/files/dm/docs/)
- [Insteon Custom Commands for HouseLinc](https://web.archive.org/web/20141125100324/http://www.insteon.com/houselinc-insteon-custom-commands.html)
- [Insteon Hacking Guides](http://efundies.com/guides/)
- [Insteon Device Controller for Windows](https://web.archive.org/web/20151008042115/http://fredricksensoftware.us/Insteon/Device%20Controller/index.htm)
- [INSTEON COMMAND LIST](http://www.madreporite.com/insteon/commands.htm)
- [Under the Insteon Hub Hood](https://web.archive.org/web/20150503192537/http://blog.automategreen.com/post/under-the-insteon-hub-hood)
- [Intellihome 2.5 - Now supports ISY and iPhone 5!](https://forum.smarthome.com/topic.asp?TOPIC_ID=11063&whichpage=2)
- [Insteon Direct Commands](http://www.richstevenson.com/2014/01/06/insteon-direct-commands/)
- [Insteon Hub Commands](https://openremote.github.io/archive-dotorg/forums/attachments/22882151/23036480.pdf)
- [2242-222dev-062013-en](http://cache.insteon.com/developer/2242-222dev-062013-en.pdf)
- [INSTEON Device Categories and Product Keys](http://cache.insteon.com/pdf/INSTEON_DevCats_and_Product_Keys_20081008.pdf)
- [INSTEON Devices XML](https://www.insteon.com/s/houselinc-device-definitions-2987-bjb7.zip)
- [Device Categories from Wiki](https://forum.universal-devices.com/topic/17006-new-insteon-products/)

[circular-buffer-url]: https://en.wikipedia.org/wiki/Circular_buffer
[code-climate-image]: https://img.shields.io/codeclimate/maintainability/srveit/insteon-hub2.svg
[code-climate-url]: https://codeclimate.com/github/srveit/insteon-hub2
[codecov-image]: https://img.shields.io/codecov/c/github/srveit/insteon-hub2/master.svg?style=flat
[codecov-url]: https://codecov.io/gh/srveit/insteon-hub2
[downloads-image]: https://img.shields.io/npm/dm/insteon-hub2.svg
[downloads-url]: https://npmjs.org/package/insteon-hub2
[github-build-badge]: https://img.shields.io/github/workflow/status/srveit/insteon-hub2/build-actions
[github-build-url]: https://github.com/srveit/insteon-hub2/actions/workflows/test-actions.yml
[gitter-image]: https://img.shields.io/gitter/room/insteon-hub2/Lobby.svg
[gitter-url]: https://gitter.im/insteon-hub2/Lobby
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: http://choosealicense.com/licenses/mit/
[node-version-image]: https://img.shields.io/node/v/insteon-hub2.svg
[node-version-url]: https://nodejs.org/en/download/
[npm-image]: https://img.shields.io/npm/v/insteon-hub2.svg
[npm-url]: https://npmjs.org/package/insteon-hub2
[snyk-badge]: https://snyk.io/test/github/srveit/insteon-hub2/badge.svg
[snyk-url]: https://snyk.io/test/github/srveit/insteon-hub2

<!--

https://sonarcloud.io/dashboard/index/srveit:insteon-hub2

[testling-image]: https://ci.testling.com/srveit/insteon-hub2.png
[testling-url]: https://ci.testling.com/srveit/insteon-hub2
[cdnjs-image]: https://img.shields.io/cdnjs/v/insteon-hub2.svg
[cdnjs-url]: https://cdnjs.com/libraries/insteon-hub2

[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges)
[![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde)
[![Doug's Gratipay][gratipay-image-dougwilson]][gratipay-url-dougwilson]
[![API documented](https://img.shields.io/badge/API-documented-brightgreen.svg)](https://raszi.github.io/node-tmp/)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/thlorenz/convert-source-map/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
[![Bower version](https://img.shields.io/bower/v/spdx-license-ids.svg)](https://github.com/shinnn/spdx-license-ids/releases)
[![Codeship Status for ashtuchkin/iconv-lite](https://www.codeship.com/projects/81670840-fa72-0131-4520-4a01a6c01acc/status)](https://www.codeship.com/projects/29053)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![ExternalEditor uses the MIT](https://img.shields.io/npm/l/external-editor.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
[![Follow on Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/hiddentao)
[![Known Vulnerabilities](https://snyk.io/test/npm/promise-core/badge.svg?style=flat-square&maxAge=2592000)](https://snyk.io/test/npm/promise-core)
[![NPM Stats](https://nodei.co/npm/iconv-lite.png?downloads=true&downloadRank=true)](https://npmjs.org/packages/iconv-lite/)
[![NPM](https://nodei.co/npm-dl/deep-extend.png?height=3)](https://nodei.co/npm/deep-extend/)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin)
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit)
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/nyc-ilw23/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/nyc-ilw23)
[![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4)

-->