Juergen
(Juergen)
July 27, 2017, 7:28pm
1
Folks,
I wanna use telegram for notification
Toke ist yxy from the BOT
configuration yaml
telegram_bot:
- platform: polling
api_key: botxyz
allowed_chat_ids:
- CHAT_ID_1
- CHAT_ID_2
- CHAT_ID_3
notify.yaml
- name: my_telegram
platform: telegram
chat_id: CHAT_ID_1
Automation:
alias: 'Information of Sonos'
trigger:
platform: sun
event: sunset
action:
service: notify.my_telegram
data:
title: "SONOS Status"
message: "Bad {{states.media_player.bad.state}}\n Büro {{states.media_player.buro.state}} \n Küche {{states.media_player.kuche.state}} \n Wohnzimmer {{states.media_player.wohnzimmer.state}} "
What went wrong?
pplucky
(Pplucky)
July 27, 2017, 9:07pm
2
I don’t think you can use template-like expressions in message…
You don’t mention exactly what is not working, so…
You can use templates, but you need to use data_template rather than data.
Also, /n does not work, you must use two line breaks directly into the automation text.
I don’t think the trigger is right either, but I can’t think off the top of my head what it should be instead.
As above, which bit isn’t working and are there any errors in the log?
Edit, I think the trigger should be:
platform: state
entity_id: sun.sun
state: 'below_horizon'
Juergen
(Juergen)
July 29, 2017, 8:40am
4
I do not receive any message on my bot.
I do run everything ti get chatid, but use the token starting with bot.
$ curl -X GET https://api.telegram.org/bot /getUpdates
{“ok”:true,“result”:[]}
$ curl -X GET https://api.telegram.org/bot /getMe
{“ok”:true,“result”:{“id”:429855417,“first_name”:“mindelheimbot”,“username”:“mindelheimbot”}}
Wit config.yaml I just use ghe without a leading bot.
Automation works with pushbuller and config checker is fine but I still do no get a message.
Also a 'hello world ’ message with a automation working with pushbullet does not send a message.
Would love to see a working config.
Juergen
(Juergen)
July 31, 2017, 12:35pm
5
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.components.telegram_bot.webhooks] Invalid telegram webhook http://192.168.1.120:8123/api/telegram_webhooks must be https
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.components.telegram_bot] Failed to initialize Telegram bot webhooks
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.setup] Setup failed for telegram_bot: Component failed to initialize.
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of notify.telegram. Setup failed for dependencies: telegram_bot
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform notify.telegram: Could not setup all dependencies.
2017-07-31 14:29:37 ERROR (MainThread) [homeassistant.components.notify] Unknown notification service specified
Did you find out the cause of this? I am seeing the same after upgrade.
Juergen
(Juergen)
November 1, 2017, 9:32am
7
happydutch:
cause of this?
well what I did and it is working are:
telegram_bot:
- platform: polling
api_key: !secret telegram_api_key
allowed_chat_ids:
- !secret telegram_chat_id
- !secret telegram_chat_js
!secret telegram_api_key came from the “$ curl -X GET https://api.telegram.org/bot/getMe ”
my api key what you get from telefram, no leading bot or anything else.
notify:
- name: telegram_ihaus
platform: telegram
api_key: !secret telegram_api_key
chat_id: !secret telegram_chat_js
and than the automation:
alias: 'Telegram bot that reply temperatur'
hide_entity: true
trigger:
platform: event
event_type: telegram_command
event_data:
command: '/Temperatur'
action:
service: notify.telegram_ihaus
data:
title: "Raumtemperatur"
message: "Wohnzimmer {{states.sensor.fibaro_wohnzimmer_temperature.state}} Grad\n
Wandthermostat {{climate.wohnzimmer_wandthermostat.temperature}} Grad \n
Büro FIBARO {{states.sensor.fibaro_buero_temperature.state}} Grad \n
Wandthermostat {{climate.buero_wandthermostat.temperature}} Grad \n
Küche FIBARO {{states.sensor.fibaro_kueche_temperature.state}} Grad\n
Bad FIBARO {{states.sensor.vision_multisensor_bad_temperature.state}} Grad \n
Wandthermostat {{climate.bad_wandthermostat.temperature}} Grad \n
Schlafzimmer {{states.sensor.fibaro_schlafzimmer_temperature.state}} Grad\n
Wandthermostat {{climate.schlafzimmer_wandthermostat.temperature}} Grad \n
Gang FIBARO {{states.sensor.fibaro_gang_temperature.state}} Grad"
So I do send a “/Temperatur” and got back the note