dmoranf / home-assistant-wattio

Wattio Smart Home custom integration for Home Assistant
MIT License
7 stars 0 forks source link

Insecure Request Warning #3

Closed cyberdie closed 3 years ago

cyberdie commented 4 years ago

Hi, i'm running HA with docker over Raspberry with Wattio custom component. The issue is related to API connections that seems to be doing in a insecure way ....or the certificate of the site is not public and cannot be validated....

The HA logs are clear:

/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: **Unverified HTTPS request is being made to host 'api.wattio.com**'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning,

cyberdie commented 4 years ago

I've just verified that api.wattio.com certificate is public and can be correctly validate from my browser so the problem must be the other one...

2020-02-06 09_53_03-Clipboard

dmoranf commented 4 years ago

Hi! I think that when the component was made, my python, for some reason, couldn't verify certificate's authenticity so instead of more research i just forced them to go on an unsecure way ...

I can probably do some test this weekend, however, if you want to test your self you just need to remove the parameter verify=False from requests calls on __init__.py (lines 415, 437, 451, 468, 492, 510, 523 and 537).

E.g:

 api_call_response = requests.get(
                WATTIO_STATUS_URI, headers=api_call_headers, verify=False
            )

Change to:

api_call_response = requests.get(
                WATTIO_STATUS_URI, headers=api_call_headers
            )

That should do the trick :)

cyberdie commented 4 years ago

Hi @dmoranf , i'll try it and get back to you ASAP. Thank you

cyberdie commented 4 years ago

You were right. I've deleted all "verify=false" ocurrences and errors have gone. Thanks you!

dmoranf commented 4 years ago

Thank you for your testing! i've modified the file in the repo :)