2.1.0 • Published 2 years ago

@mangar2/pushover v2.1.0

Weekly downloads
3
License
LGPL-3.0-or-later
Repository
github
Last release
2 years ago

Abstract

Contents

Meta

Global functions

prepare

prepare (config, pushover) => {Pushover}

Prepares the object

prepare Parameters

NameTypeAttributeDefaultDescription
configObjectautomation configuration
pushoverPushoveroptionalnullexisting automation class

prepare returns

TypeDescription
Pushoverthe prepared automation object

Class Pushover

new Pushover(config)

Creates a pushover class with the ability to send messages to the pushover app

Example

const message = new Message("very bad incident", 1, "very bad incident detected")
const config = {
  pushover: {
      host: 'your host',
      path: '/1/messages.json',
      port: 443,
      token: 'your pushover token',
      user: 'your pushover user',
      devices: ['your device', 'your other device'],
      subscriptions: {
          '$SYS/incident/#': 1
      }
  }
}

Pushover Parameters

NameTypeDescription
configObjectconfiguration

config properties

NameTypeAttributeDefaultDescription
hoststringname of the pushover host
pathstringpath to the interface
portnumberoptional443port number of open sense map ( usually 443 )
tokenstringpushover token for authentication
userstringpushover user for authentication
devicesArray.<string>array of device name

Pushover Methods

getSubscriptions

getSubscriptions ()

Get needed subscriptions for pushover

handleMessage

async handleMessage (message) => {Array.<Message>}

Publishes a value to pushover ( a messaging app )

handleMessage Parameters
NameTypeDescription
messageMessagethe data to publish to the messaging app

message properties

NameTypeDescription
topicstringthe topic is used to select the sensor id from config
valuenumberthe value to publish ( "alert" , "warning" , "message" )
handleMessage returns
TypeDescription
Array.<Message>messages containing the status . Send it back to the broker