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

elk-message

v1.1.0

Published

A message parsing and generation library for the Elk M1 security system ASCII protocol

Downloads

20

Readme

elk-message

styled with prettier Greenkeeper badge Travis Coveralls Dev Dependencies

A module for parsing and generating messages for the Elk M1 security system.

Fully* implements the Elk M1 RS232 ASCII protocol revision 1.84 (Feb 26, 2016).

*Section 4.3 describes a message called "Send ASCII String To IP Address", with the command "AP". Upper-case commands are supposed to be responses from the M1, but the documentation for this makes it sound like this is a command that can be sent to the M1. I've decided to include it as a response, but haven't fully implemented it because of the unclear documentation.

Usage

Install with NPM or Yarn

npm install elk-message
// or
yarn add elk-message
import { 
  Arm, 
  ArmingLevel, 
  EthernetModuleTest, 
  UnknownElkResponse, 
  parse,
} from 'elk-message';

// Parse a message

const message = parse('16XK2636115020605110006F\r\n');

if (message instanceof EthernetModuleTest) {
  // EthernetModuleTest is sent every 30 seconds by the M1
  console.log(`M1 ping @ ${message.date}`);
} else if (message instanceof UnknownElkResponse) {
  console.warn(`Recieved unknown command "${message.command}" from M1!`);
}

// Create a message to arm area 1 using code "3456"
const arm = new Arm(ArmingLevel.ArmedAway, 1, '3456');

API

The base interface for all messages sent to or received from the Elk M1 implement ElkMessage.

Messages are either "commands" (ElkCommand) sent to the control panel, or "responses" (ElkResponse) received from it.

See the API documentation for more details on each type of message. Each message in the documentation also includes the section in the protocol specification document where it is officially documented.

Commands

Commands are instantiated directly with specific parameters depending on the type of command. Some commands expect the control panel to return a response, others do not.

  • AlarmByZoneRequest
  • AlarmReportAcknowledge
  • AlarmReportTestAcknowledge
  • Arm
  • ArmingStatusRequest
  • AudioCommandIncoming
  • AudioDataRequest
  • ControlOutputOff
  • ControlOutputOn
  • ControlOutputStatusRequest
  • ControlOutputToggle
  • CounterValueRead
  • CounterValueWrite
  • CustomValueRead
  • CustomValueWrite
  • CustomValuesReadAll
  • DisplayTextOnScreen
  • ElkCommand
  • EthernetModuleTestAcknowledge
  • InsteonLightingDeviceProgramRequest
  • InsteonLightingDeviceStatusRequest
  • KeypadAreaAssigmentsRequest
  • KeypadFunctionKeyPressRequest
  • KeypadFunctionKeyStatusRequest
  • LightingDeviceStatusRequest
  • Omnistat2Request
  • PlcDeviceControl
  • PlcDeviceOff
  • PlcDeviceOn
  • PlcDeviceStatusRequest
  • PlcDeviceToggle
  • RealTimeClockDataRequest
  • RealTimeClockDataWrite
  • SpeakPhrase
  • SpeakWord
  • SystemLogDataReadRequest
  • SystemLogDataWriteRequest
  • SystemTroubleStatusRequest
  • TaskActivation
  • TemperatureDataRequest
  • TemperatureRequest
  • TextDescriptionRequest
  • ThermostatDataRequest
  • ThermostatSet
  • ThermostatSetCoolSetPoint
  • ThermostatSetFan
  • ThermostatSetHeatSetPoint
  • ThermostatSetHold
  • ThermostatSetMode
  • UserCodeAreasRequest
  • UserCodeChangeRequest
  • VersionNumberRequest
  • ZoneBypassRequest
  • ZoneDefinitionRequest
  • ZonePartitionRequest
  • ZoneStatusRequest
  • ZoneTrigger
  • ZoneVoltageRequest

Responses

Responses are parsed from their raw packet data (as described in section 4 of the specification document.

A parse function is exported that will parse a packet and return it's associated response.

import { parse } from 'elk-message';

const dataPacket = '16XK2636115020605110006F';

// parse will return an instance of `EthernetModuleTest`
const ethernetModuleTest = parse(dataPacket);
assert(ethernetModuleTest instanceof EthernetModuleTest);

The parse function will return a UnknownElkResponse if the response type was unknown or could not be determined for some reason (malformed packet, undocumented response, etc...)

  • AlarmByZoneReport
  • AlarmMemoryUpdate
  • AlarmReport
  • AlarmReportTest
  • ArmingStatusReport
  • AudioCommandOutgoing
  • AudioDataReply
  • ControlOutputStatusReport
  • CounterValueReply
  • CustomValueReply
  • ElkResponse
  • ElkRPConnected
  • EmailSendTrigger
  • EntryExitTimer
  • EthernetModuleReset
  • EthernetModuleTest
  • InstallerModeExited
  • InsteonLightingDeviceProgrammed
  • InsteonLightingDeviceStatusReply
  • KeypadAreaAssignments
  • KeypadFunctionKeyPressReply
  • KeypadKeyChange
  • LightingDeviceDataReply
  • Omnistat2Reply
  • OutputChangeUpdate
  • PlcChangeUpdate
  • PlcDeviceStatusReply
  • RealTimeClockDataReply
  • SendASCIIStringToIPAddress
  • SystemLogDataUpdate
  • SystemTroubleStatusReply
  • TaskChangeUpdate
  • TemperatureData
  • TemperatureReply
  • TextDescriptionReply
  • ThermostatData
  • UnknownElkResponse
  • UserCodeAreasReply
  • UserCodeChangeReply
  • UserCodeEntry
  • VersionNumberReply
  • ZoneBypassReply
  • ZoneChangeUpdate
  • ZoneDefinitionData
  • ZonePartitionReport
  • ZoneStatusReport
  • ZoneVoltageData