witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.12k stars 307 forks source link

Can this library actively push notification to user? #183

Closed nkebx2 closed 4 years ago

nkebx2 commented 4 years ago

Good day, thanks for sharing this library. I tried to measure the temperature of my server room with some temperature sensors and I wanted the bot to actively inform me if the server room exceeded certain temperature. I wonder this could be done in this library, thanks!

witnessmenow commented 4 years ago

yup, use this example as your base: https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/master/examples/ESP32/SendMessageFromEvent/SendMessageFromEvent.ino

Just move the sendMessage call from the setup to be inside some logic for checking temp

if(temp > 25){
    bot.sendMessage(CHAT_ID, "Too hot!", "");
    delay(1000 * 60); //Do something to stop it repeating the message over and over again. This is a 60 second delay, but you probably should do something smarter than this
}
nkebx2 commented 4 years ago

Thanks Brian, please keep up the good work!

On Wed, Jun 24, 2020 at 6:37 PM Brian Lough notifications@github.com wrote:

Closed #183 https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/183 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/183#event-3476883762, or unsubscribe https://github.com/notifications/unsubscribe-auth/APECJX5P65Y4OAY4SOHTFMDRYHJNZANCNFSM4OGFUP7A .