wpietri / sucks

Simple command-line script for the Ecovacs series of robot vacuums
GNU General Public License v3.0
281 stars 104 forks source link

Charge command fails if it's already charging #56

Open guillebot opened 5 years ago

guillebot commented 5 years ago

If its cleaning, sucks charge works ok:

sucks.cli DEBUG waiting on charge_status for value charging sucks DEBUG *** charge_status = returning sucks DEBUG *** charge_status = returning sucks DEBUG *** clean_status = stop fan_speed = None sucks DEBUG *** sending ping *** sucks DEBUG *** charge_status = charging sucks.cli DEBUG wait complete; charge_status is now charging done

But if its charging,

sucks.cli DEBUG waiting on charge_status for value charging sucks DEBUG *** charge_status = returning sucks DEBUG *** sending ping *** sucks DEBUG *** sending ping *** sucks DEBUG *** sending ping ***

it keeps as this forever.

In my particular use case I will try to use the library, but perhaps you would like to correct that for cli users.

Thanks again.

wpietri commented 5 years ago

Interesting! When I tried it the first time, the vaccum re-parked itself, so it worked just fine. But when I tried it the second time, I got a different result:


DEBUG    SEND: <iq id="06c..." type="set" from="2017...b1" to="E0..."><query xmlns="com:ctl"><ctl td="Charge"><charge type="go" /></ctl></query></iq>
DEBUG    RECV: <iq to="2017...b1" type="result" from="E0..." id="06c..." />
DEBUG    waiting on charge_status for value charging
DEBUG    RECV: <iq to="2017...b1" type="set" from="E0..." id="3459"><query xmlns="com:ctl"><ctl td="ChargeState"><charge type="Going" /></ctl></query></iq>
DEBUG    *** charge_status = returning

The vacuum, however, wasn't going anywhere. It just sat on its base. So this appears to be a bug in the vacuum itself where it lies about its state.

I'm not sure how to solve this. Perhaps the best thing to do is to query state before charging and then just skip sending the charge command? That breaks a symmetry the current code relies on, though, so perhaps there's a simpler fix.

Thanks for reporting it!