MTrab / pyworxcloud

PyPI module for integrating with Worx Cloud devices
GNU General Public License v3.0
22 stars 19 forks source link

Fix Schedule for Landroid Vision #177

Closed jderusse closed 1 year ago

jderusse commented 1 year ago

The current implementation fails to detect my Landroid.

Docker logs show the error

Traceback (most recent call last):                                                                                                                                                             
  File "/usr/local/lib/python3.11/site-packages/pyworxcloud/__init__.py", line 524, in _decode_data                                                                                            
    device.schedules[TYPE_TO_STRING[sch_type]][DAY_MAP[day]][                                                                                                                                  
                                               ~~~~~~~^^^^^        

I observed the decoded data and noticed that data.cfg.sc.slots contains more than 6 items. Each entry is not a day, but a schedule (I have several schedules per day) The day number is located in the property d of the item.

Bellow an extract of the decoded data

Show the payload ```json { "cfg": { "sc": { "slots": [ { "e": 1, "d": 0, "s": 660, "t": 135, "cfg": { "cut": { "b": 1, "z": [] } } }, { "e": 1, "d": 0, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 1, "s": 660, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 1, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 2, "s": 660, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 2, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 3, "s": 660, "t": 135, "cfg": { "cut": { "b": 1, "z": [] } } }, { "e": 1, "d": 3, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 4, "s": 660, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 4, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 5, "s": 660, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 5, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 6, "s": 660, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } }, { "e": 1, "d": 6, "s": 1080, "t": 135, "cfg": { "cut": { "b": 0, "z": [] } } } ] } } } ```