@mangar2/pushover
v2.1.0
Published
sends data to the pushover app
Downloads
8
Readme
Abstract
Contents
Meta
Global functions
prepare
prepare (config, pushover) => {Pushover}
Prepares the object
prepare Parameters
| Name | Type | Attribute | Default | Description |
| ---------- | ------------ | ------------ | ------------ | ----------------- |
| config | Object | | | automation configuration | |
| pushover | Pushover | optional | null | existing automation class | |
prepare returns
| Type | Description |
| ---- | ----------- |
| Pushover | the 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
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| config | Object | configuration | |
config properties
| Name | Type | Attribute | Default | Description |
| ---------- | ------------ | ------------ | ------------ | ----------------- |
| host | string | | | name of the pushover host | |
| path | string | | | path to the interface | |
| port | number | optional | 443 | port number of open sense map ( usually 443 ) | |
| token | string | | | pushover token for authentication | |
| user | string | | | pushover user for authentication | |
| devices | Array.<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
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| message | Message | the data to publish to the messaging app | |
message properties
| Name | Type | Description |
| ---------- | ------------ | ----------------- |
| topic | string | the topic is used to select the sensor id from config | |
| value | number | the value to publish ( "alert" , "warning" , "message" ) | |
handleMessage returns
| Type | Description |
| ---- | ----------- |
| Array.<Message> | messages containing the status . Send it back to the broker |
