ecovacs-part4 Writing a python script
ecovacs-part4
python3 --version
Python 3.11.2
sudo apt-get update
apt-get install python3-pip
step 1.first copy p1jij8.py and rename as n0vyif.py within deebot_client/hardware/deebot/
cp lr4qcs.py mxse7w.py
step 2.Writing a python script using CleanV2 instructs the robovac to start cleaning.
import aiohttp
import asyncio
import logging
import time
from deebot_client.api_client import ApiClient
from deebot_client.authentication import Authenticator, create_rest_config
from deebot_client.commands.json.clean import CleanAction, CleanV2
from deebot_client.events import BatteryEvent
from deebot_client.mqtt_client import MqttClient, create_mqtt_config
from deebot_client.util import md5
from deebot_client.device import Device
device_id = md5(str(time.time()))
account_id = "your email or phonenumber (cn)"
password_hash = md5("yourPassword")
country = "DE"
async def main():
async with aiohttp.ClientSession() as session:
logging.basicConfig(level=logging.DEBUG)
rest_config = create_rest_config(session, device_id=device_id, alpha_2_country=country)
authenticator = Authenticator(rest_config, account_id, password_hash)
api_client = ApiClient(authenticator)
devices_ = await api_client.get_devices()
bot = Device(devices_.mqtt[0], authenticator)
mqtt_config = create_mqtt_config(device_id=device_id, country=country)
mqtt = MqttClient(mqtt_config, authenticator)
await bot.initialize(mqtt)
# Execute commands
await bot.execute_command(CleanV2(CleanAction.START))
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()
https://github.com/DeebotUniverse/client.py/issues/832
https://github.com/DeebotUniverse/client.py/issues/845#issuecomment-2802200673
Comments
Be the first to post a comment