Skip to content

Commit

Permalink
Addntfysh (#19)
Browse files Browse the repository at this point in the history
* add ntffy

* woopise forgor to add ntfy notification
  • Loading branch information
bernes1 authored Sep 12, 2023
1 parent d811f76 commit 0f87191
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import dotenv from "dotenv";
import * as mqtt from "mqtt";
import {sendPushover, openmsg, closedmsg} from "./pushovernotify.js";
import {sendDiscordClosed, sendDiscordOpen} from "./discordnotify.js";
import {sendNtfyClosed, sendNtfyOpen} from "./ntfy.js";

//dotenv config
dotenv.config();
Expand Down Expand Up @@ -43,11 +44,14 @@ client.on("connect", () => {
const parsePayload = payload.toString();
if ((previousState == States.open || previousState == States.default) && parsePayload == States.closed) {
sendPushover(closedmsg);
sendNtfyClosed();
sendDiscordClosed();
console.log("CLOSED");
} else if ((previousState == States.closed || previousState == States.default) && parsePayload == States.open) {
sendPushover(openmsg);
sendNtfyOpen();
sendDiscordOpen();
sen
console.log("OPEN");
}
previousState = parsePayload;
Expand Down

0 comments on commit 0f87191

Please sign in to comment.