Skip to content

Commit

Permalink
fix: rename MSmartHome cloud (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 authored Oct 8, 2024
1 parent bcfb554 commit 62fcd20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/2-issue_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body:
required: true
attributes:
label: Working mobile app
placeholder: MSmartHome
placeholder: SmartHome
description: Which mobile app is used to successfully control the device
- type: textarea
validations:
Expand Down
14 changes: 9 additions & 5 deletions custom_components/midea_ac_lan/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from homeassistant.util.json import load_json
from midealocal.cloud import (
PRESET_ACCOUNT_DATA,
SUPPORTED_CLOUDS,
MideaCloud,
get_midea_cloud,
)
Expand Down Expand Up @@ -88,6 +89,9 @@
"cache": "Remove login cache",
}

# Select SmartHome from the list of supported cloud
SMARTHOME: str = list(SUPPORTED_CLOUDS)[1]

STORAGE_PATH = f".storage/{DOMAIN}"

SKIP_LOGIN = "Skip Login (input any user/password)"
Expand Down Expand Up @@ -127,7 +131,7 @@ def __init__(self) -> None:
self.preset_password: str = bytes.fromhex(
format((PRESET_ACCOUNT_DATA[0] ^ PRESET_ACCOUNT_DATA[2]), "X"),
).decode("ASCII")
self.preset_cloud_name: str = "MSmartHome"
self.preset_cloud_name: str = SMARTHOME

def _save_device_config(self, data: dict[str, Any]) -> None:
"""Save device config to json file with device id."""
Expand Down Expand Up @@ -279,11 +283,11 @@ async def async_step_login(
self.hass.data[DOMAIN] = {}
# check skip login option
if user_input[CONF_SERVER] == next(iter(default_keys)):
# use preset account and MSmartHome cloud
# use preset account and SMARTHOME cloud
_LOGGER.debug("skip login matched, cloud_servers: %s", cloud_servers)
# get MSmartHome key from dict
# get SMARTHOME key from dict
key = next(
key for key, value in cloud_servers.items() if value == "MSmartHome"
key for key, value in cloud_servers.items() if value == SMARTHOME
)
cloud_server = cloud_servers[key]
account = bytes.fromhex(
Expand Down Expand Up @@ -473,7 +477,7 @@ async def _check_key_from_cloud(
appliance_id: int,
default_key: bool = True,
) -> dict[str, Any]:
"""Use perset MSmartHome account to get v3 device token and key.
"""Use perset SMARTHOME account to get v3 device token and key.
Returns
-------
Expand Down

0 comments on commit 62fcd20

Please sign in to comment.