filipnet / ups-telegram-notify Goto Github PK
View Code? Open in Web Editor NEWNotification of the status of an Uninterruptible Power Supply by Telegram
License: BSD 3-Clause "New" or "Revised" License
Notification of the status of an Uninterruptible Power Supply by Telegram
License: BSD 3-Clause "New" or "Revised" License
I followed your instructions and it's not working?
If I feed it some text into notifycmd.sh for example [ ./etc/nut/notifycmd.sh "test" ] I get a notification on Telegram, like this
But when I test the UPS, by pulling power, I don't get any notification?
Here's my notifycmd.sh
#!/bin/bash
GROUP_ID=#######
BOT_TOKEN=######
NOW=$(date)
case "${NOTIFYTYPE}" in
ONLINE|COMMOK)
EMOJI=$'\xE2\x9C\x85' # white heavy check mark
;;
ONBATT|COMMBAD|REPLBATT)
EMOJI=$'\xE2\x9A\xA0' # warning sign
;;
LOWBATT|FSD|NOCOMM|SHUTDOWN)
EMOJI=$'\xF0\x9F\x86\x98' # squared sos
;;
NOPARENT)
EMOJI=$'\xF0\x9F\x94\x84' # anticlockwise downwards and upwards open circle arrows
;;
esac
EMOJI+=$'\xEF\xB8\x8F' # The emoji should be displayed with emoji presentation
MESSAGE="${EMOJI} UPS Notification%0A"
MESSAGE+="UPS Name: $UPSNAME %0ANotify type: $NOTIFYTYPE %0ANotify message: $*"
curl \
-s \
--data "parse_mode=HTML" \
--data "text=$MESSAGE" \
--data "chat_id=$GROUP_ID" 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage' > /dev/null
And I added the text in the /etc/nut upsmod.config as recommended, also added the correct permission to the notifycmd.sh file and added it to the Nut group.
Please help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.