-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvacstate.py
45 lines (39 loc) · 1.18 KB
/
vacstate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from sucks import *
from time import sleep
from sys import exit
import logging
logging.disable(logging.CRITICAL)
def On(vacbot):
vacbot.disconnect()
exit(0)
def Off(vacbot):
vacbot.disconnect()
exit(1)
def ConnectVac():
# Enter your credentials here.
config = {
'device_id': EcoVacsAPI.md5(str(time.time())),
'email': '<email>',
'password': EcoVacsAPI.md5('<password>'),
'country': '<country>',
'continent': '<continent>'
}
api = EcoVacsAPI(config['device_id'],config['email'],config['password'],
config['country'],config['continent'])
vac_id = api.devices()[0]
vacbot = VacBot(api.uid,api.REALM,api.resource, api.user_access_token, vac_id, config['continent'])
vacbot.connect_and_wait_until_ready()
return vacbot
vacbot = ConnectVac()
vacbot.run(GetChargeState())
sleep(1)
if vacbot.charge_status == "returning": #Returning
On(vacbot)
if vacbot.charge_status == "charging": #Charging
Off(vacbot)
vacbot.run(GetCleanState())
sleep(1)
if vacbot.clean_status == "stop": #Stuck
Off(vacbot)
else: #Cleaning
On(vacbot)