Update version for smart-meter-texas to 0.4.7 (#54493)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Richard Meyer 2021-08-24 14:10:28 -05:00 committed by GitHub
parent 8570502681
commit 2932a3d6a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 10 deletions

View file

@ -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):

View file

@ -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()

View file

@ -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"
}

View file

@ -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

View file

@ -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