Giter VIP home page Giter VIP logo

ups-telegram-notify's Issues

No emoji showed

Hello,
the script works fine, I get the notification from Telegram but unfortunately no emoji are appearing.

Screenshot from 2023-09-13 20-56-54

If i pass

-F "text=echo -e '\U0001F514'" \ (bell)

to the curl, I'm able to see the emoji but there should be a better way.

Thank you!

Something is not working Correctly?

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

IMG_5268

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.