Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

VacBot.*_status never gets set #57

Open
cyclomaniac opened this issue Nov 24, 2018 · 3 comments
Open

VacBot.*_status never gets set #57

cyclomaniac opened this issue Nov 24, 2018 · 3 comments

Comments

@cyclomaniac
Copy link

I've been able to use the sucks library to start and stop my Ecovacs N79s. However, I can't get it to accurately to report status on anything.

I'm using the Cmdswitch2-Ecovacs script: https://github.com/EtienneMD/Cmdswitch2-Ecovacs to integrate with Homebridge.

Running the script through the debugger, I can see the request to get charge status:

DEBUG:sucks:Sending command <iq id="XXX" to="XXX" from="XXX" type="set"><query xmlns="com:ctl"><ctl td="GetChargeState" /></query></iq> DEBUG:sleekxmpp.xmlstream.xmlstream:SEND: <iq id="XXX" to="XXX" from="XXX" type="set"><query xmlns="com:ctl"><ctl td="GetChargeState" /></query></iq> DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <iq to="XXX" type="result" id="XXX" from="XXX" /> DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <iq to="XXX" type="set" id="25665" from="XXX"><query xmlns="com:ctl"><ctl id="" ret="ok" errno=""><charge type="SlotCharging" /></ctl></query></iq>

I see the response is sending the correct answer, but inside EcoVacsXMPP._handl_ctl(), the message.getpayload() call only returns the outer element and none of the <charge> element that actually contains the information. I'm guessing this is why the status information isn't being set.

I don't know enough about SleekXMPP to get to the next step. I'm hoping you can shed some light as to where to look to solve the problem.

@OverloadUT
Copy link
Collaborator

The outer element should contain the inner elements. When debugging did you keep stepping forward to see what happens in _handle_charge_state? That's where the VacBot logic happens to handle that message.

It would be best if you set your sucks log level to DEBUG and post the full console output when trying to run your script.

@cyclomaniac
Copy link
Author

_handle_charge_state never gets called (put a breakpoint there first...)

Here's what I'm running:

`vacbot = ConnectVac()
vacbot.run(GetChargeState())

_LOGGER.debug("Charge Status:[" + str(vacbot.charge_status) + "]")

sleep(5)

_LOGGER.debug("Charge Status:[" + str(vacbot.charge_status) + "]")
`

`DEBUG:root:Switching to shorter UID XXX
DEBUG:root:EcoVacsAPI connection complete
DEBUG:sucks:calling user api GetDeviceList with {'userid': 'XXX', 'auth': {'with': 'users', 'userid': 'XXX', 'realm': 'ecouser.net', 'token': 'XXX', 'resource': 'XXX'}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): users-na.ecouser.net:8000
DEBUG:urllib3.connectionpool:https://users-na.ecouser.net:8000 "POST /user.do HTTP/1.1" 200 171
DEBUG:sucks:got {'todo': 'result', 'result': 'ok', 'devices': [{'did': 'XXX', 'name': 'XXX', 'class': '155', 'resource': 'atom', 'nick': None, 'company': 'eco-legacy'}]}
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 6120: Stream Feature: STARTTLS
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 6120: Stream Feature: Resource Binding
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 3920: Stream Feature: Start Session
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 6121: Stream Feature: Roster Versioning
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 6121: Stream Feature: Subscription Pre-Approval
DEBUG:sleekxmpp.plugins.base:Loaded Plugin: RFC 6120: Stream Feature: SASL
WARNING:sleekxmpp.basexmpp:fulljid property deprecated. Use boundjid.resource
DEBUG:sleekxmpp.xmlstream.xmlstream:Waiting 1.9544798217727324 seconds before connecting.
DEBUG:sleekxmpp.xmlstream.resolver:DNS: Querying msg-na.ecouser.net for AAAA records.
DEBUG:sleekxmpp.xmlstream.resolver:DNS: Querying msg-na.ecouser.net for A records.
DEBUG:sleekxmpp.xmlstream.xmlstream:Connecting to [::ffff:47.88.66.164]:5223
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: connected
DEBUG:sleekxmpp.thirdparty.statemachine: ==== TRANSITION disconnected -> connected
DEBUG:sleekxmpp.xmlstream.xmlstream:Starting HANDLER THREAD
DEBUG:sleekxmpp.xmlstream.xmlstream:Loading event runner
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED): <stream:stream to='ecouser.net' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:stream version="1.0" id="XXX" from="ecouser.net">
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:features xmlns="http://etherx.jabber.org/streams">PLAIN</stream:features>
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED):
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:sleekxmpp.features.feature_starttls.starttls:Starting TLS
INFO:sleekxmpp.xmlstream.xmlstream:Negotiating TLS
INFO:sleekxmpp.xmlstream.xmlstream:Using SSL version: TLSv1
DEBUG:sleekxmpp.xmlstream.xmlstream:CERT: -----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----

DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: ssl_cert
WARNING:sleekxmpp.xmlstream.cert:Could not find pyasn1 and pyasn1_modules. SSL certificate COULD NOT BE VERIFIED.
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED): <stream:stream to='ecouser.net' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:stream version="1.0" id="XXX" from="ecouser.net">
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:features xmlns="http://etherx.jabber.org/streams">PLAIN</stream:features>
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED): XXX
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: auth_success
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED): <stream:stream to='ecouser.net' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:stream version="1.0" id="XXX" from="ecouser.net">
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: <stream:features xmlns="http://etherx.jabber.org/streams"></stream:features>
DEBUG:sleekxmpp.features.feature_bind.bind:Requesting resource:
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED):
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV: XXX@XXX
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: session_bind
INFO:sleekxmpp.features.feature_bind.bind:JID set to: XXX@XXX
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED):
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:sleekxmpp.features.feature_session.session:Established Session
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: session_start
DEBUG:sleekxmpp.clientxmpp:Finished processing stream features.
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: stream_negotiated
WARNING:sleekxmpp.xmlstream.cert:Could not find pyasn1 and pyasn1_modules. SSL certificate expiration COULD NOT BE VERIFIED.
DEBUG:sucks:----------------- starting session ----------------
DEBUG:sucks:event = {}
DEBUG:sucks:Sending command
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND:
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:main:Charge Status:[None]
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:main:Charge Status:[None]
DEBUG:sucks:Sending command
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND:
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:sleekxmpp.xmlstream.xmlstream:RECV:
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: session_end
DEBUG:sleekxmpp.xmlstream.xmlstream:SEND (IMMED): </stream:stream>
INFO:sleekxmpp.xmlstream.xmlstream:Waiting for </stream:stream> from server
DEBUG:sleekxmpp.xmlstream.xmlstream:End of stream recieved
DEBUG:sleekxmpp.xmlstream.xmlstream:Waiting for 3 threads to exit.
DEBUG:sleekxmpp.xmlstream.xmlstream:Stopped event runner thread. 2 threads remain.
DEBUG:sleekxmpp.xmlstream.xmlstream:Stopped send thread. 1 threads remain.
DEBUG:sleekxmpp.xmlstream.scheduler:Quitting Scheduler thread
DEBUG:sleekxmpp.xmlstream.xmlstream:Stopped scheduler thread. 0 threads remain.
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: socket_error
DEBUG:sleekxmpp.xmlstream.xmlstream:Event triggered: disconnected
DEBUG:sleekxmpp.thirdparty.statemachine: ==== TRANSITION connected -> disconnected
DEBUG:sleekxmpp.thirdparty.statemachine:State was not ready`

@jasonarends
Copy link

Same here - I added a debug line in my module and printed the responses below - seems they don't have the td attribute, just an empty id="" so this line 462 is causing it to just return.

DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok"><ns0:clean a="" speed="standard" st="h" t="" type="stop" /></ns0:ctl>
DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok"><ns0:charge type="SlotCharging" /></ns0:ctl>
DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok"><ns0:battery power="039" /></ns0:ctl>
DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok" total="365" type="Brush" val="084" />
DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok" total="365" type="SideBrush" val="061" />
DEBUG:sucks:Message payload: <ns0:ctl xmlns:ns0="com:ctl" errno="" id="" ret="ok" total="365" type="DustCaseHeap" val="064" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants