Domoticz notifications on the TV
Domoticz has Telegram built in as a notification subsystem. Fill in the bot token and the "Home" group's chat id in Settings, enable the overlay on that group in Tevegram, and device notifications or dzVents scripts show up over the TV picture.
What you need
- Domoticz (any recent version; the Telegram notifier is built in).
- A Telegram bot token from @BotFather (/newbot), the bot added to a dedicated "Home" group, and that group's chat id (send a message in the group and forward it to @getidsbot, or read the "chat":{"id"} field from https://api.telegram.org/bot<TOKEN>/getUpdates; group ids start with -100).
- An Android TV or Google TV with Tevegram signed in to the account that is a member of the "Home" group.
Setup
Enable the Telegram notifier. Setup, Settings, Notifications tab, Telegram section: paste the Bot API token and the chat id of the "Home" group (several ids can be separated by ";"). Press Test: the message must arrive in the group. Save.
Send notifications from devices or scripts. On a device, open Notifications and add one (for example "On" for a door sensor) with Telegram selected as the system. From dzVents, call domoticz.notify with the Telegram subsystem, as in the excerpt.
Enable the overlay on the "Home" group in Tevegram. On the TV, in the Chats tab, select the "Home" group and turn on its notification bell. Allow "Display over other apps" when Android asks. From now on, every message posted in that group appears over the TV picture.
Test. Trigger the automation, or type a message in the group from your phone. It should appear on the TV within a second or two, then fade out.
Configuration
dzVents script sending a Telegram notification
return {
on = { devices = { 'Front door' } },
execute = function(domoticz, device)
if device.state == 'Open' then
domoticz.notify('Home', 'Front door opened',
domoticz.PRIORITY_NORMAL, domoticz.SOUND_DEFAULT, '',
domoticz.NSS_TELEGRAM)
end
end
}Good to know
Title and message
Domoticz sends the title and the body; the overlay shows the text of the Telegram message. Put the fact in the body, keep the title short.
Frequently asked questions
Does the TV need to be on Tevegram?
No. Tevegram runs in the background and draws the overlay over whatever is on screen: live TV, another app, the home screen. Open it once after the TV has been turned on if notifications stop appearing.
Will my other chats interrupt the TV too?
Only if you turn their bell on. Keep the overlay enabled on the "Home" group alone and the TV shows nothing else.
Can I send a camera snapshot?
Device notifications can attach a camera image in Domoticz. The image lands in the group and is visible in Tevegram's conversation; the overlay shows the text.
