Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot send any image with telegram after Upgrade to 0.45.0 #7705

Closed
pattyland opened this issue May 22, 2017 · 4 comments · Fixed by #7709
Closed

Cannot send any image with telegram after Upgrade to 0.45.0 #7705

pattyland opened this issue May 22, 2017 · 4 comments · Fixed by #7709

Comments

@pattyland
Copy link
Contributor

pattyland commented May 22, 2017

Home Assistant release (hass --version):
0.45.0

Python release (python3 --version):
Python 3.4.2

Component/platform:
notify.telegram

Description of problem:
After upgrading to hass 0.45.0 the notify.telegram doesn't images via URL anymore.

Problem-relevant configuration.yaml entries and steps to reproduce:

action:
      - service: notify.telegram
        data:
          message: "XiaoFang Snapshot"
          title: "Home Assistant"
          data:
            photo:
              - url: https://upload.wikimedia.org/wikipedia/en/5/58/Penny_test.jpg

Traceback (if applicable):

2017-05-21 22:27:19 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 222, 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 217, in _render_template_attr
    attribute_templ.hass = hass
AttributeError: 'str' object has no attribute 'hass'

Additional info:
This exact configuration worked fine with 0.44! Maybe is has something to do with this change @azogue?

@pattyland pattyland changed the title Cannot send any image after Upgrade to Cannot send any image after Upgrade to 0.45.0 May 22, 2017
@pattyland pattyland changed the title Cannot send any image after Upgrade to 0.45.0 Cannot send any image with telegram after Upgrade to 0.45.0 May 22, 2017
@azogue
Copy link
Member

azogue commented May 22, 2017

It's a bug, in 0.45, when calling notify.telegram, it then calls telegram_bot/send_XXX, so some attributes are 'being rendered' two times, and the second time it fails with an AttributeError.

I have proposed to @fabaff a minimal change in his PR #7704 to fix this.

In the meantime, you can call telegram_bot.send_photo like this:

action:
      - service: telegram_bot.send_photo
        data:
          caption: "XiaoFang Snapshot"
          url: https://upload.wikimedia.org/wikipedia/en/5/58/Penny_test.jpg

(message and title fields are not working with the Telegram API when sending pics, only caption works)

@pattyland
Copy link
Contributor Author

Thanks for the tip, using telegram_bot.send_photo works for all photos beside the ones from the camery proxy (#7413) again!

@Actpohomoc
Copy link

in 45.1 still does not work. Have same issue.

@azogue
Copy link
Member

azogue commented May 29, 2017

@Actpohomoc, can you test the dev branch, which includes #7771?
if your problem is related to sending more than one image, it should be fixed in 0.45.2

@home-assistant home-assistant locked and limited conversation to collaborators Sep 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants