Telegram Notification has stopped working in version 0.43.1

I have upgraded my HA to version 0.43.1 and I notice all notifications via Telegram has stopped working.

Anyone else experiencing this?

Yes, my problem is same. Also

trigger:
platform: event
event_type: homeassistant_start

stopped working too.

Back to 0.43.0

sudo pip3 install --upgrade homeassistant==0.43.0

Downgraded to 0.43.0 still doesn’t work. It was working but not sure why is has stopped working.

I see this in the log…

ERROR (MainThread) [homeassistant.components.notify] Error setting up platform telegram
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/notify/__init__.py", line 101, in async_setup_platform
    None, platform.get_service, hass, p_config, discovery_info)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/notify/telegram.py", line 49, in get_service
    username = bot.getMe()['username']
  File "/home/pi/.homeassistant/deps/telegram/bot.py", line 125, in decorator
    result = func(self, *args, **kwargs)
  File "/home/pi/.homeassistant/deps/telegram/bot.py", line 174, in getMe
    result = self._request.get(url)
  File "/home/pi/.homeassistant/deps/telegram/utils/request.py", line 170, in get
    result = self._request_wrapper('GET', url)
  File "/home/pi/.homeassistant/deps/telegram/utils/request.py", line 132, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "/home/pi/.homeassistant/deps/urllib3/request.py", line 66, in request
    **urlopen_kw)
  File "/home/pi/.homeassistant/deps/urllib3/request.py", line 87, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
  File "/home/pi/.homeassistant/deps/urllib3/poolmanager.py", line 303, in urlopen
    conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
  File "/home/pi/.homeassistant/deps/urllib3/poolmanager.py", line 219, in connection_from_host
    return self.connection_from_context(request_context)
  File "/home/pi/.homeassistant/deps/urllib3/poolmanager.py", line 232, in connection_from_context
    return self.connection_from_pool_key(pool_key, request_context=request_context)
  File "/home/pi/.homeassistant/deps/urllib3/poolmanager.py", line 245, in connection_from_pool_key
    pool = self.pools.get(pool_key)
  File "/usr/lib/python3.4/_collections_abc.py", line 425, in get
    return self[key]
  File "/home/pi/.homeassistant/deps/urllib3/_collections.py", line 53, in __getitem__
    item = self._container.pop(key)
  File "/usr/lib/python3.4/collections/__init__.py", line 178, in pop
    if key in self:
TypeError: unhashable type: 'list'

The issue here is that urllib3 has been upgraded to 1.21 which causes issues with python-telegram-bot. Downgrading to urllib 1.20 resolves this issue for now. There doesn’t seem to be a hard dependency for this version in either HA or the telegram lib.

This fixed it for me:

sudo pip3 install urllib3==1.20
1 Like

I have sudo pip3 install urllib3==1.20 but the problem is still not fixed.

Did you restart HA afterwards?

restarted and rebooted

2 Likes

thanks. but how do I apply the fix?

Check out my latest comment on the issue

If you have a virtualenv in /home/hass use the line below

~/bin/pip3 install urllib3==1.20 --upgrade --target /home/hass/.homeassistant/deps/

im not using virtualenv. I just install HA using sudo pip3 install homeassistant

Then sudo to the hass user and do:

pip3 install urllib3==1.20 --upgrade --target ~/.homeassistant/deps/

The urllib3 installation that is used by hass is in the deps folder.

3 Likes

thanks. it works!

hi @kirichkov HA is running on windows… will you please tell me how can i fix this issue on windows?
my /deps/ directory looks like this “C:\Users\mohammed\AppData\Roaming.homeassistant\deps”

I’m sorry but I never used python on windows so I have no idea how this would work. If you have pip3 in your PATH, then this should theoretically fix it. TRY IT AT YOUR OWN RISK!:

 pip3 install urllib3==1.20 --upgrade --target  "C:\Users\mohammed\AppData\Roaming.homeassistant\deps"

it successfully installed still I get an error when I restart

C:\Users\mohammed>pip3 install urllib3==1.20 --upgrade --target  C:\Users\mohammed\AppData\Roaming.homeassistant\deps
Collecting urllib3==1.20
  Using cached urllib3-1.20-py2.py3-none-any.whl
Installing collected packages: urllib3
Successfully installed urllib3-1.20

this fix supposed to work for both telegram notification and webhook?

Perfect thanks! It worked great.

I run hass in VirtualEnv and all I did was:

sudo su -s  /bin/bash hass

(my HA user is called hass not homeassistant)

Then I ran this to activate the VirtualEnv:

source /srv/hass/bin/activate

The finally this (as above) to install the correct version:

pip3 install urllib3==1.20 --upgrade --target ~/.homeassistant/deps/

Quick restart of the HA service and I now get notifications when my iKettle boils again ! :slight_smile: