Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 34ecd7e

Browse files
authored
Merge pull request #42 from And3rsL/fix-cn-mqtt
use special MQTT url for china
2 parents 72d3c80 + 0534046 commit 34ecd7e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

deebotozmo/ecovacs_mqtt.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ def _get_topic(vacuum: Vacuum) -> str:
2020

2121
class EcovacsMqtt:
2222

23-
def __init__(self, auth: RequestAuth, *, continent: str):
23+
def __init__(self, auth: RequestAuth, *, continent: str, country: str):
2424
self._subscribers: MutableMapping[str, VacuumBot] = {}
25-
self._hostname = f"mq-{continent}.ecouser.net"
2625
self._port = 443
26+
self._hostname = f"mq-{continent}.ecouser.net"
27+
if country.lower() == "cn":
28+
self._hostname = "mq.ecouser.net"
2729

2830
client_id = f"{auth.user_id}@ecouser/{auth.resource}"
2931
self._client = Client(client_id)
3032

3133
async def _on_message(client, topic: str, payload: bytes, qos, properties) -> int:
32-
3334
try:
3435
_LOGGER.debug(f"Got message: topic={topic}; payload={payload};")
3536
topic_split = topic.split("/")

0 commit comments

Comments
 (0)