Telegram issues in 0.45

Remove api key from your notify platforms and add a telegram_bot config in configuration.yaml eg:

telegram_bot:
  platform: polling
  api_key: <telegram api key>
  allowed_chat_ids:
    - 12345
    - 67890

but i have two api keys. my phone i have one apy key, but wife other api key.

telegram_bot:
  platform: polling
  api_key: <telegram api key> can add other line with another apykey?
  allowed_chat_ids:
    - 12345
    - 67890

The api key is for the telegram bot you created with bot father. Did you create two bots? If not you only have one api key.

yes i create, two bots. as i said with other version HA, that works great.
Now how put two api keys on telegram_bot??

Dont think that is possible. I would recommend you to only use one bot. Usually you want to communicate with only one bot per app, ie one bot per home automation. Two bots can’t communicate with each other. Invite your wife to your bot and let her start the conversation with that. Then check her chat id and add both your chat id and yours to the config.

ok , late i will try. thank you for atention.

1 Like

@martinhjelmare sorry ask you again, but i have another problem.
on my last version 0.44 all worked fine.

Now with my automation:

- alias: 'Campainha'
  trigger:
    platform: state
    entity_id: binary_sensor.Campainha
    state: 'on'
  action:
    - service: mqtt.publish
      data:
        topic: 'home/433toMQTT'
        payload: '10340193off'
        retain: 'true'
    - service: notify.telegramrodolfo
      data:
        photo:
          url: http://192.168.1.69:8080/photo.jpg
          caption: 'Campainha da Escada'  

I dont receive photo, on 0.44 version, i receveid it.

It’s not possible?

Because it was possible in the pas in Hass.
Reason is:
I have 1 bot for normal notifications and 1 bot for Urgent notifications.

With actual implementation, it is not posible to handle 2 bots, but if you need to separate destinations you can define one bot which can talk to multiple targets, including you as a direct chat, and you as a group of two members (you and the bot). Don’t need 2 bots for that:

telegram_bot:
  platform: polling
  api_key: UNIQUE_BOT_API_KEY
  allowed_chat_ids:
    - YOUR_CHAT_ID  # positive integer
    - GROUP_CHAT_ID  # negative integer

notify:
  - platform: telegram
    name: telegram_direct
    chat_id: YOUR_CHAT_ID

  - platform: telegram
    name: telegram_group
    chat_id: GROUP_CHAT_ID

Look here to see if it’s you case. If it is, a correction is proposed here, and I hope it will go out with 0.45.2.

1 Like

Hi. I’m having an issue where if I send an alert to multiple telegram notifiers(in my case 3 of them), I just get 3 notifications to one of my chatID’s, and the other 2 don’t get anything. Here’s the error I get. Any ideas why that is happeing? I have confirmed that the CHATID’s are correct. And they were both working before:

2017-05-25 16:00:18 WARNING (Thread-7) [urllib3.connectionpool] Connection pool is full, discarding connection: api.telegram.org 
2017-05-25 16:27:02 WARNING (Thread-5) [homeassistant.components.telegram_bot] ALL BAD TARGETS: [CHATID1] 
2017-05-25 16:27:03 WARNING (Thread-6) [homeassistant.components.telegram_bot] ALL BAD TARGETS: [CHATID2]

And here is my relevant code:

notify:
  - platform: telegram
name: telegramBot0
api_key: APIKEY
chat_id: ID0
  - platform: telegram
name: telegramBot1
api_key: APIKEY
chat_id: ID1
  - platform: telegram
name: telegramBot2
api_key: APIKEY
chat_id: ID2

telegram_bot:
 platform: polling
 api_key: APIKEY
 allowed_chat_ids:
   - ID0

You need to include ID1 and ID2 in allowed_chat_ids

Awesome. That was it. I guess I didn’t realize it broke right after I configured the telegram bot. I thought that the telegram_bot was just for being able to ‘talk back’ to HA.Thanks for the help.

1 Like

Worked perfectly! Thanks !

1 Like

Same here. Messages are fine, but photos aren’t being sent.

I get this error on version 0.45.1 on rpi3 in virtual environment. Was working on 0.43.x

2017-05-28 10:56:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 237, in _step
result = next(coro)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py”, line 1015, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/telegram_bot/init.py”, line 223, in async_send_telegram_message
_render_template_attr(kwargs, ATTR_MESSAGE)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/telegram_bot/init.py”, line 218, in _render_template_attr
attribute_templ.hass = hass
AttributeError: ‘str’ object has no attribute ‘hass’

Hello, anyone has problems today with telegram bots?

Exactly the same error message here. Was working in 0.43.x, but since upgrading to 0.45.1 no luck.

Probably because of this: https://twitter.com/telegram/status/869870878393348096

Thanks, still bot working for me.

I have the same error message in 45.1 (centos VM) have not tried it on 43.x

2017-06-01 20:24:47 ERROR (MainThread) [homeassistant.core] Error doing job: 
Task exception was never retrieved Traceback (most recent call last): 
File "/opt/rh/rh-python35/root/usr/lib64/python3.5/asyncio/tasks.py", line 239, in _step result = coro.send(None) 
File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/homeassistant/core.py", line 1015, in _event_to_service_call yield from service_handler.func(service_call) 
File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/homeassistant/components/telegram_bot/__init__.py", line 223, in async_send_telegram_message _render_template_attr(kwargs, ATTR_MESSAGE) 
File "/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/homeassistant/components/telegram_bot/__init__.py", line 218, in _render_template_attr attribute_templ.hass = hass AttributeError: 'str' object has no attribute 'hass'