diff --git a/homeassistant/components/smart_meter_texas/__init__.py b/homeassistant/components/smart_meter_texas/__init__.py index 7b500ed58e7..16379dca8cb 100644 --- a/homeassistant/components/smart_meter_texas/__init__.py +++ b/homeassistant/components/smart_meter_texas/__init__.py @@ -1,8 +1,9 @@ """The Smart Meter Texas integration.""" import asyncio import logging +import ssl -from smart_meter_texas import Account, Client +from smart_meter_texas import Account, Client, ClientSSLContext from smart_meter_texas.exceptions import ( SmartMeterTexasAPIError, SmartMeterTexasAuthError, @@ -39,7 +40,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: password = entry.data[CONF_PASSWORD] account = Account(username, password) - smart_meter_texas_data = SmartMeterTexasData(hass, entry, account) + + client_ssl_context = ClientSSLContext() + ssl_context = await client_ssl_context.get_ssl_context() + + smart_meter_texas_data = SmartMeterTexasData(hass, entry, account, ssl_context) try: await smart_meter_texas_data.client.authenticate() except SmartMeterTexasAuthError: @@ -87,13 +92,17 @@ class SmartMeterTexasData: """Manages coordinatation of API data updates.""" def __init__( - self, hass: HomeAssistant, entry: ConfigEntry, account: Account + self, + hass: HomeAssistant, + entry: ConfigEntry, + account: Account, + ssl_context: ssl.SSLContext, ) -> None: """Initialize the data coordintator.""" self._entry = entry self.account = account websession = aiohttp_client.async_get_clientsession(hass) - self.client = Client(websession, account) + self.client = Client(websession, account, ssl_context=ssl_context) self.meters: list = [] async def setup(self): diff --git a/homeassistant/components/smart_meter_texas/config_flow.py b/homeassistant/components/smart_meter_texas/config_flow.py index 296040d85f0..53428131e17 100644 --- a/homeassistant/components/smart_meter_texas/config_flow.py +++ b/homeassistant/components/smart_meter_texas/config_flow.py @@ -3,7 +3,7 @@ import asyncio import logging from aiohttp import ClientError -from smart_meter_texas import Account, Client +from smart_meter_texas import Account, Client, ClientSSLContext from smart_meter_texas.exceptions import ( SmartMeterTexasAPIError, SmartMeterTexasAuthError, @@ -28,10 +28,11 @@ async def validate_input(hass: core.HomeAssistant, data): Data has the keys from DATA_SCHEMA with values provided by the user. """ - + client_ssl_context = ClientSSLContext() + ssl_context = await client_ssl_context.get_ssl_context() client_session = aiohttp_client.async_get_clientsession(hass) account = Account(data["username"], data["password"]) - client = Client(client_session, account) + client = Client(client_session, account, ssl_context) try: await client.authenticate() diff --git a/homeassistant/components/smart_meter_texas/manifest.json b/homeassistant/components/smart_meter_texas/manifest.json index 0e8a6b91236..f70cf59b9b9 100644 --- a/homeassistant/components/smart_meter_texas/manifest.json +++ b/homeassistant/components/smart_meter_texas/manifest.json @@ -3,7 +3,7 @@ "name": "Smart Meter Texas", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/smart_meter_texas", - "requirements": ["smart-meter-texas==0.4.0"], + "requirements": ["smart-meter-texas==0.4.7"], "codeowners": ["@grahamwetzler"], "iot_class": "cloud_polling" } diff --git a/requirements_all.txt b/requirements_all.txt index d68e8f854c1..8740a8b00a8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2146,7 +2146,7 @@ sleepyq==0.8.1 slixmpp==1.7.1 # homeassistant.components.smart_meter_texas -smart-meter-texas==0.4.0 +smart-meter-texas==0.4.7 # homeassistant.components.smarthab smarthab==0.21 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 60ba3fc80f4..cec84d474a3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1197,7 +1197,7 @@ slackclient==2.5.0 sleepyq==0.8.1 # homeassistant.components.smart_meter_texas -smart-meter-texas==0.4.0 +smart-meter-texas==0.4.7 # homeassistant.components.smarthab smarthab==0.21