Skip to content

Commit 98afd70

Browse files
change from evergy function call to class
1 parent 78f1d75 commit 98afd70

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

custom_components/evergy/config_flow.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import logging
55

6-
from .pyEvergy import configure_evergy
6+
from .pyEvergy import Evergy
77
import voluptuous as vol
88

99
from homeassistant import config_entries, core, exceptions
@@ -25,11 +25,8 @@ async def validate_input(hass: core.HomeAssistant, data):
2525
"""Validate the user input allows us to connect.
2626
Data has the keys from DATA_SCHEMA with values provided by the user.
2727
"""
28-
# try:
29-
await hass.async_add_executor_job(configure_evergy, data[CONF_USERNAME], data[CONF_PASSWORD])
30-
# except SerialException as err:
31-
# _LOGGER.error("Error connecting to Evergy")
32-
# raise CannotConnect from err
28+
evergy_api = Evergy(data[CONF_USERNAME], data[CONF_PASSWORD])
29+
await hass.async_add_executor_job(evergy_api.get_usage)
3330

3431
# Return info that you want to store in the config entry.
3532
return {CONF_USERNAME: data[CONF_USERNAME], CONF_PASSWORD: data[CONF_PASSWORD]}

0 commit comments

Comments
 (0)