Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions custom_components/bemfa/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class TopicSuffix(StrEnum):
MSG_SPEED_COUNT: Final = 4 # for fans, 4 speed supported at most

# #### Service Api ####
HTTP_BASE_URL: Final = f"https://api.{MQTT_HOST}/api/"
FETCH_TOPICS_URL: Final = "https://api.bemfa.com/api/device/v1/topic/?uid={uid}&type=2"
CREATE_TOPIC_URL: Final = f"{HTTP_BASE_URL}user/addtopic/"
RENAME_TOPIC_URL: Final = f"{HTTP_BASE_URL}device/v1/topic/name/"
DEL_TOPIC_URL: Final = f"{HTTP_BASE_URL}user/deltopic/"
HTTP_BASE_URL: Final = f"https://pro.{MQTT_HOST}/v1"
FETCH_TOPICS_URL: Final = "https://apis.bemfa.com/va/alltopic?uid={uid}&type=1"
CREATE_TOPIC_URL: Final = f"{HTTP_BASE_URL}/addtopic"
RENAME_TOPIC_URL: Final = f"https://apis.bemfa.com/va/setName"
DEL_TOPIC_URL: Final = f"{HTTP_BASE_URL}/deltopic"
6 changes: 3 additions & 3 deletions custom_components/bemfa/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ async def async_fetch_all_topics(self) -> dict[str, str]:
FETCH_TOPICS_URL.format(uid=self._uid),
) as res:
res.raise_for_status()
res_dict = await res.json(content_type="text/html", encoding="utf-8")
res_dict = await res.json(content_type="application/json", encoding="utf-8")
if res_dict["code"] == 111 and res_dict["status"] == "get ok":
return {
topic["topic_id"]: topic["v_name"]
topic["topic"]: topic["name"]
for topic in res_dict["data"]
if topic["topic_id"].startswith(TOPIC_PREFIX)
if topic["topic"].startswith(TOPIC_PREFIX)
}
return {}

Expand Down
2 changes: 1 addition & 1 deletion custom_components/bemfa/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"issue_tracker": "https://github.com/larry-wong/bemfa/issues",
"requirements": ["paho-mqtt==1.6.1"],
"ssdp": [],
"version": "1.4.0",
"version": "1.4.2",
"zeroconf": []
}