ESP-KVM writes to Telegram through a bot you make yourself. Messages go from the device straight to Telegram, with no server of mine in between. It needs only a way out to the internet. Notifications are off by default.
Making the bot
- In Telegram open a chat with @BotFather and send
/newbot. - Give the bot a name, then a username that ends in
bot, such asmy_espkvm_bot. - BotFather answers with a token like
123456789:AAH.... Copy it. Anyone with the token can write as the bot, so keep it to yourself. - Open the chat with your new bot and press Start, or send it any message. A bot cannot write to someone who has never written to it.
For alerts in a group, add the bot to the group and send a message there.
Setting up the device
- In the console open Settings, Notifications, and turn on Send notifications.
- Paste the token into Telegram bot token.
- Press Find chats. It lists the chats that wrote to the bot lately: pick yours. A group or channel id can also be typed in by hand.
- In the table under What goes where, tick what Telegram gets. Everything but the blank screen is ticked to start with.
- Save, then press Send a test in the Automation panel. A message should come in a few seconds.
The token stays on the device and is never sent back to the console.
What sends an alert
Each of these is a row in the table, so Telegram can get some and a webhook or a browser others.
- A phrase on the screen. Turn on Watch the screen for words under Settings, Video, and list the phrases, such as
kernel panicorPress F1. The device reads a text screen even with nobody watching. - A blank screen. The output stays one colour: a stop screen, a display that went dark. Not ticked to start with.
- A screen area. An area set up in Screen areas, with its alert on, sends one each time it fires.
- A dashcam clip. A clip under 50 MB comes as a video that plays in the chat. A bigger one is named, and the file stays on the card.
- The Tailscale key. A reminder 14 days before the node key runs out, or as many days as you set.
- The target's log. With Receive the target's log on, a line with a watched word sends an alert.
- New firmware. With Offer firmware updates on, the device looks once a day for a newer release and says so once, with a link to what changed.
What comes with it
- A screenshot of the screen at the moment of the alert, on either codec. It can be turned off.
- The tail of the device log, if Attach recent log is on.
When the network is down
An alert that cannot go out waits and goes out later, oldest first. With a microSD card it waits on the card and survives a restart. A late message says when it happened, and the screenshot shows the screen as it was then.