home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.98k stars 30.53k forks source link

SSL: WRONG_SIGNATURE_TYPE error in the REST sensor #74383

Closed marlonqpa closed 1 year ago

marlonqpa commented 2 years ago

The problem

Hi

After update from the core from 2022.6.7 to 2022.7.0b one of my REST sensor stopped working. No changes in the configuration from my side.

What version of Home Assistant Core has the issue?

core-2022.7.1

What was the last working version of Home Assistant Core?

core-2022.6.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

RESTful

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rest/

Diagnostics information

No response

Example YAML snippet

- authentication: basic
  scan_interval: 3600
  resource: https://www.tauron-dystrybucja.pl/iapi/outage/GetOutages?gaid=897411&type=street
  sensor:
    - name: "Tauron_1"
      json_attributes_path: "$.CurrentOutagePeriods[0]"
      value_template: "OK"
      json_attributes:
        - "Message"
        - "StartDate"
        - "EndDate"
        - "OutageType"

Anything in the logs that might be useful for us?

Logger: homeassistant.components.rest
Source: components/rest/data.py:60
Integration: RESTful (documentation, issues)
First occurred: 00:27:17 (447 occurrences)
Last logged: 08:59:47

Unexpected error fetching rest data data: [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:997)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 60, in async_update
    response = await self._async_client.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1614, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1642, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1679, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1716, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 86, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 63, in handle_async_request
    stream = await self._connect(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 150, in _connect
    stream = await stream.start_tls(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 76, in start_tls
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 67, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
  File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 122, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 130, in _call_sslobject_method
    result = func(*args)
  File "/usr/local/lib/python3.10/ssl.py", line 975, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:997)

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

rest documentation rest source (message by IssueLinks)

marlonqpa commented 2 years ago

There is also a new message in the log, but it looks like it is truncated somehow.

Logger: homeassistant.components.rest.data Source: components/rest/data.py:74 Integration: RESTful (documentation, issues) First occurred: 10:06:37 (1 occurrences) Last logged: 10:06:37

Error fetching data: https://www.tauron-dystrybucja.pl/iapi/outage/GetOutages?gaid=897411&type=street failed with

kkosyl commented 2 years ago

Got similar issue with wrong signature type

kkosyl commented 2 years ago

Just FYI

As far as I know the issue occurs because of the new python version. Because we do not know when it is going to be fixed I made a quick work around for it. From REST platform I changed it quickly to command line like this

platform: command_line
name: MY NAME
command: >
  curl 
  "<GET URL>"
json_attributes:
  - "ATTRIBUTE HERE"
scan_interval: 900
value_template: OK

and it works perfectly

paaboo2013 commented 2 years ago

try to disable the system proxy proxies = {"http": None, "https": None}

marlonqpa commented 2 years ago

Hi @kkosyl, your approaching works well, thank you.

marlonqpa commented 2 years ago

try to disable the system proxy proxies = {"http": None, "https": None}

Hi. Where I should put that, somewhere in config files?

paaboo2013 commented 2 years ago

res = requests.get(url,data,proxies=proxies)

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.