diff --git a/custom_components/china_southern_power_grid_stat/config_flow.py b/custom_components/china_southern_power_grid_stat/config_flow.py index 3550257..d0a15b0 100644 --- a/custom_components/china_southern_power_grid_stat/config_flow.py +++ b/custom_components/china_southern_power_grid_stat/config_flow.py @@ -21,14 +21,46 @@ from homeassistant.exceptions import ConfigEntryAuthFailed from requests import RequestException -from .const import (ABORT_ALL_ADDED, ABORT_NO_ACCOUNT, CONF_ACCOUNT_NUMBER, CONF_ACTION, CONF_AUTH_TOKEN, - CONF_ELE_ACCOUNTS, CONF_GENERAL_ERROR, CONF_LOGIN_TYPE, CONF_REFRESH_QR_CODE, CONF_SETTINGS, - CONF_SMS_CODE, CONF_UPDATED_AT, CONF_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL, DOMAIN, - ERROR_CANNOT_CONNECT, ERROR_INVALID_AUTH, ERROR_QR_NOT_SCANNED, ERROR_UNKNOWN, - LOGIN_TYPE_TO_QR_APP_NAME, STEP_ADD_ACCOUNT, STEP_ALI_QR_LOGIN, STEP_CSG_QR_LOGIN, STEP_INIT, - STEP_QR_LOGIN, STEP_SETTINGS, STEP_SMS_LOGIN, STEP_SMS_PWD_LOGIN, STEP_USER, STEP_VALIDATE_SMS_CODE, - STEP_WX_QR_LOGIN) -from .csg_client import (CSGClient, CSGElectricityAccount, InvalidCredentials, LOGIN_TYPE_TO_QR_CODE_TYPE, LoginType) +from .const import ( + ABORT_ALL_ADDED, + ABORT_NO_ACCOUNT, + CONF_ACCOUNT_NUMBER, + CONF_ACTION, + CONF_AUTH_TOKEN, + CONF_ELE_ACCOUNTS, + CONF_GENERAL_ERROR, + CONF_LOGIN_TYPE, + CONF_REFRESH_QR_CODE, + CONF_SETTINGS, + CONF_SMS_CODE, + CONF_UPDATE_INTERVAL, + CONF_UPDATED_AT, + DEFAULT_UPDATE_INTERVAL, + DOMAIN, + ERROR_CANNOT_CONNECT, + ERROR_INVALID_AUTH, + ERROR_QR_NOT_SCANNED, + ERROR_UNKNOWN, + LOGIN_TYPE_TO_QR_APP_NAME, + STEP_ADD_ACCOUNT, + STEP_ALI_QR_LOGIN, + STEP_CSG_QR_LOGIN, + STEP_INIT, + STEP_QR_LOGIN, + STEP_SETTINGS, + STEP_SMS_LOGIN, + STEP_SMS_PWD_LOGIN, + STEP_USER, + STEP_VALIDATE_SMS_CODE, + STEP_WX_QR_LOGIN, +) +from .csg_client import ( + LOGIN_TYPE_TO_QR_CODE_TYPE, + CSGClient, + CSGElectricityAccount, + InvalidCredentials, + LoginType, +) _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/china_southern_power_grid_stat/csg_client_demo.py b/custom_components/china_southern_power_grid_stat/csg_client_demo.py index c751225..1aa548d 100644 --- a/custom_components/china_southern_power_grid_stat/csg_client_demo.py +++ b/custom_components/china_southern_power_grid_stat/csg_client_demo.py @@ -5,7 +5,12 @@ import sys import time -from csg_client import (CSGClient, CSGElectricityAccount, LOGIN_TYPE_TO_QR_CODE_TYPE, LoginType) +from csg_client import ( + LOGIN_TYPE_TO_QR_CODE_TYPE, + CSGClient, + CSGElectricityAccount, + LoginType, +) QR_SCAN_TIMEOUT = 300 diff --git a/custom_components/china_southern_power_grid_stat/sensor.py b/custom_components/china_southern_power_grid_stat/sensor.py index 2ef615e..f314b97 100644 --- a/custom_components/china_southern_power_grid_stat/sensor.py +++ b/custom_components/china_southern_power_grid_stat/sensor.py @@ -62,9 +62,20 @@ SUFFIX_THIS_YEAR_KWH, SUFFIX_YESTERDAY_KWH, ) -from .csg_client import (CSGAPIError, CSGClient, CSGElectricityAccount, JSON_KEY_METERING_POINT_NUMBER, NotLoggedIn, - WF_ATTR_CHARGE, WF_ATTR_DATE, WF_ATTR_KWH, WF_ATTR_LADDER, WF_ATTR_LADDER_REMAINING_KWH, - WF_ATTR_LADDER_START_DATE, WF_ATTR_LADDER_TARIFF) +from .csg_client import ( + JSON_KEY_METERING_POINT_NUMBER, + WF_ATTR_CHARGE, + WF_ATTR_DATE, + WF_ATTR_KWH, + WF_ATTR_LADDER, + WF_ATTR_LADDER_REMAINING_KWH, + WF_ATTR_LADDER_START_DATE, + WF_ATTR_LADDER_TARIFF, + CSGAPIError, + CSGClient, + CSGElectricityAccount, + NotLoggedIn, +) _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/china_southern_power_grid_stat/strings.json b/custom_components/china_southern_power_grid_stat/strings.json index 7206c67..4587df9 100644 --- a/custom_components/china_southern_power_grid_stat/strings.json +++ b/custom_components/china_southern_power_grid_stat/strings.json @@ -65,9 +65,6 @@ "add_account": { "title": "选择缴费号" }, - "remove_account": { - "title": "移除缴费号" - }, "settings": { "title": "参数设置", "data": { diff --git a/custom_components/china_southern_power_grid_stat/translations/en.json b/custom_components/china_southern_power_grid_stat/translations/en.json index 8d024e3..67057c9 100644 --- a/custom_components/china_southern_power_grid_stat/translations/en.json +++ b/custom_components/china_southern_power_grid_stat/translations/en.json @@ -69,9 +69,6 @@ "init": { "title": "\u9009\u62e9\u64cd\u4f5c" }, - "remove_account": { - "title": "\u79fb\u9664\u7f34\u8d39\u53f7" - }, "settings": { "data": { "update_interval": "\u66f4\u65b0\u95f4\u9694\uff08\u79d2\uff09" diff --git a/custom_components/china_southern_power_grid_stat/translations/zh-Hans.json b/custom_components/china_southern_power_grid_stat/translations/zh-Hans.json index 8d024e3..67057c9 100644 --- a/custom_components/china_southern_power_grid_stat/translations/zh-Hans.json +++ b/custom_components/china_southern_power_grid_stat/translations/zh-Hans.json @@ -69,9 +69,6 @@ "init": { "title": "\u9009\u62e9\u64cd\u4f5c" }, - "remove_account": { - "title": "\u79fb\u9664\u7f34\u8d39\u53f7" - }, "settings": { "data": { "update_interval": "\u66f4\u65b0\u95f4\u9694\uff08\u79d2\uff09"