Open btittelbach opened 5 years ago
Look at my post here: https://github.com/home-assistant/home-assistant/issues/16186
Can be fixed, but perhaps you will run in to other issues later, like I did.
More to the point, it seems that this issue is upstream in sleekXMPP: https://github.com/fritzy/SleekXMPP/issues/478
Considering how long that issue has been open, we may need to figure out a workaround here.
Any updates on this one? I got the same error and wonder if there is a fix for it.
Also finding the same error
Same issue of the OP in Home Assistant 0.81.2
Same issue here running hassio 0.81.6
If I fix the date out of range error via https://github.com/fritzy/SleekXMPP/issues/478#issuecomment-367328327, I get this error instead:
2018-11-10 20:56:07 INFO (read_thread) [sleekxmpp.xmlstream.xmlstream] Negotiating TLS
2018-11-10 20:56:07 INFO (read_thread) [sleekxmpp.xmlstream.xmlstream] Using SSL version: TLSv1
2018-11-10 20:56:07 ERROR (read_thread) [sleekxmpp.xmlstream.xmlstream] Connection error.
2018-11-10 20:56:07 ERROR (read_thread) [sleekxmpp.basexmpp] <TagSet object at 0x7f44641cdba8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7f43d05314a8 tagSet <TagSet object at 0x7f446417c908 tags 0:0:4> encoding iso-8859-1>
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
if not self.__read_xml():
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
self.__spawn_event(xml)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
handler.prerun(stanza_copy)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
self.run(payload, True)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
self._pointer(payload)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
if self.xmpp.start_tls():
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
cert.verify(self._expected_server_name, self._der_cert)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 140, in verify
cert_names = extract_names(raw_cert)
File "/usr/local/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 73, in extract_names
asn1Spec=OctetString())[0]
File "/usr/local/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1318, in __call__
'%s not in asn1Spec: %r' % (tagSet, asn1Spec)
pyasn1.error.PyAsn1Error: <TagSet object at 0x7f44641cdba8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7f43d05314a8 tagSet <TagSet object at 0x7f446417c908 tags 0:0:4> encoding iso-8859-1>
2018-11-10 20:56:07 INFO (read_thread) [sleekxmpp.xmlstream.xmlstream] Waiting for </stream:stream> from server
@kmlucy Just bought one of these off Amazon on sale and I'm getting the same error after I tried the fix from that thread. For now I've just removed the component from my configuration.yaml because it's a bit chatty in the Home Assistant logs and it delays reboots. Looking forward to seeing how this develops.
Line 111
not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
Replaced with...
try:
not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
except ValueError:
not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ')
Line 115
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
Replaced with...
try:
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
except ValueError:
not_after = datetime.strptime(not_after, '%y%m%d%H%M%SZ')
@alagarath I actually ended up just reverting to the previous dependencies, which fixed the problem for the moment. It's not a long term solution, but it fixes the issue for the moment: https://github.com/home-assistant/home-assistant/issues/18054#issuecomment-438657231
@kmlucy That worked for me! Long live workarounds! I'll keep my eyes peeled for this issue to be closed and then I'll revert back to the latest dependencies.
Would be nice if the working (latest) dependencies will be reported in this topic by the first one who see's it working.
Seeing this on 0.82.1
@kmlucy Just bought one of these off Amazon on sale and I'm getting the same error after I tried the fix from that thread. For now I've just removed the component from my configuration.yaml because it's a bit chatty in the Home Assistant logs and it delays reboots. Looking forward to seeing how this develops.
Line 111
not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
Replaced with...
try: not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ') except ValueError: not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ')
Line 115
not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
Replaced with...
try: not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ') except ValueError: not_after = datetime.strptime(not_after, '%y%m%d%H%M%SZ')
Hey, did you managed to get it working ?
The good news is that it appears that @fritzy is active again on SleekXMPP as two commits were put in today. I just left a note on the open issue over there with a hopeful prod.
If we can't get a new version of SleekXMPP then we can simply pin sucks to use 1.3.2 to fix this issue.
@marlonalkan Yes, but only by rolling back to the previous dependencies mentioned by kmlucy.
I ran the following in my docker container terminal from the link kmlucy posted
RUN pip uninstall -y pyasn1 pyasn1-modules sleekxmpp slixmpp && pip install pyasn1==0.3.7 pyasn1 modules==0.1.5 sleekxmpp==1.3.2 dnspython3==1.15.0
I've read the workarounds you guys posted, but it seems to me its for non-hass.io versions of HA. Has anyone found success adopting the workaround in Hass.io?
I'm in the same boat. How do we work around this for HASSIO?
I would imagine it's using the same sort of dependencies somewhere in the virtual directory for hassio. Unfortunately I have no experience with hassio atm
Thanks alagarth. Appreciate the quick response. We will have to see what comes about with SleekXMPP.
Is this a BUG with the sleekxmpp or is the ecovac addon using an outdated or depreciated method within sleekxmpp?
For what it's worth, I do a clean download-and-build with this code every day to run my vacuum. I don't get this error ever. So I believe this is something specific to HomeAssistant users. I'm happy to take a patch that fixes the problem, though.
@wpietri With your setup, what version of sleekxmpp do you use?
Looking at the logs from the last nightly build, I see this: Successfully installed atomicwrites-1.2.1 attrs-18.2.0 certifi-2018.11.29 chardet-3.0.4 click-7.0 coverage-4.5.2 idna-2.7 more-itertools-4.3.0 pathlib2-2.3.3 pluggy-0.8.0 pprintpp-0.4.0 py-1.7.0 pycountry-18.12.8 pycountry-convert-0.7.2 pycryptodome-3.7.2 pytest-4.0.1 pytest-cov-2.6.0 pytest-mock-1.10.0 repoze.lru-0.7 requests-2.20.1 scandir-1.9.0 six-1.11.0 sleekxmpp-1.3.3 stringcase-1.2.0 sucks-0.9.3 urllib3-1.24.1
Home Assistant has moved from sleekxmpp to slixmpp==1.4.1. I believe this is where the problems comes from. I, and others, have been able to get it working again by reverting to sleekxmpp temporarily.
@wpietri: The issue is related to the way timestamps are coming from or being sent to the XMPP server. I find it entirely likely that this could be an issue experienced differently on different combinations of OS and hardware. On my dev machine, sucks works fine via Home Assistant, but on my production Raspberry Pi, it does not. :(
If you look at the comments on the issue in SleekXMPP you can some other users outside of Home Assistant that have been experiencing this issue: https://github.com/fritzy/SleekXMPP/issues/478
The second comment has a person experiencing it on only one out of a pool of servers, so there's something weird going on.
There are a bunch more people reporting having the issue here in a pull request that was rejected: https://github.com/fritzy/SleekXMPP/issues/461
I don't know enough about XMPP to make an authoritative call here, which is the only reason I haven't pinned sucks to XMPP 1.3.2 (before the issue was introduced.)
Wow! What a community!
I was digging around @fritzy/SleekXMPP some this AM and I saw the same thing. I really wish I could contribute here, but I'm not a developer. I do know scripting languages though and currently learning Python.
I do want to say thank you for the time and effort to put this addon together.
rschoolm
Home Assistant has moved from sleekxmpp to slixmpp==1.4.1
@kmlucy Can you link me to where discussion on this suspicion is taking place? I'd like to dig in on why slixmpp might be affecting what SleekXMPP is doing.
https://github.com/home-assistant/home-assistant/issues/18054
I had problems starting from 0.81.0, which corresponds to when they switched. By manually reverting, I was able to get everything working again.
This PR seems to be the change that triggered this for me: https://github.com/home-assistant/home-assistant/pull/17283
I'm using HassIO and I don't know how to go back to 1.3.2 or 1.3.1... can someone point me on how to do it?
i did some digging and noticed that the xmpp is a pretty minor part of this library...
can someone with better python chops just swap the xmpp library to one that works?
All of the communication with the vacuum itself is over XMPP, so in some sense it's the heart of it. When I wrote this I looked at a variety of options, and this seemed like the best of a shaky lot. But if somebody would like to take a swing at trying a different library, I'd be very interested to see how it turns out.
Same problem with XMPP 1.3.3
Edit the file _strptime.py located in ..\Python\Lib\
And add the following code before the line 527 (starting with # If we know the week )
if month == 2 and day > 28 :
day = 28
@tongueSoftware does this solve this issue, would be great because this also destroyed the ecovacs components for some months.
for sleekxmpp-1.3.3
--- sleekxmpp/xmlstream/cert.py
+++ sleekxmpp/xmlstream/cert.py 2019-02-17 16:09:21.738607425 +0100
@@ -108,11 +108,20 @@
not_before = validity.getComponentByName('notBefore')
not_before = str(not_before.getComponent())
- not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
+
+ if not_before.__len__() == 13:
+ not_before = datetime.strptime(not_before, '%y%m%d%H%M%SZ')
+ else:
+ not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
not_after = validity.getComponentByName('notAfter')
not_after = str(not_after.getComponent())
- not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
+
+ if not_after.__len__() == 13:
+ not_after = datetime.strptime(not_after, '%y%m%d%H%M%SZ')
+ else:
+ not_after = datetime.strptime(not_after, '%Y%m%d%H%M%SZ')
+
return not_before, not_after
@slmi I've tried the above code and the date error seems to be fixed. But... I get this instead:
Mar 06 13:02:17 hassbian hass[8366]: 2019-03-06 13:02:17 ERROR (read_thread) [sleekxmpp.xmlstream.xmlstream] Connection error. Mar 06 13:02:17 hassbian hass[8366]: 2019-03-06 13:02:17 ERROR (read_thread) [sleekxmpp.basexmpp] <TagSet object at 0x6a696850 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x646fe350 tagSet <TagSet object at 0x69e5eb90 tags 0:0:4> encoding iso-8859-1> Mar 06 13:02:17 hassbian hass[8366]: Traceback (most recent call last): Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process Mar 06 13:02:17 hassbian hass[8366]: if not self.read_xml(): Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml Mar 06 13:02:17 hassbian hass[8366]: self.spawn_event(xml) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in spawn_event Mar 06 13:02:17 hassbian hass[8366]: handler.prerun(stanza_copy) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun Mar 06 13:02:17 hassbian hass[8366]: self.run(payload, True) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run Mar 06 13:02:17 hassbian hass[8366]: self._pointer(payload) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed Mar 06 13:02:17 hassbian hass[8366]: if self.xmpp.start_tls(): Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls Mar 06 13:02:17 hassbian hass[8366]: cert.verify(self._expected_server_name, self._der_cert) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 144, in verify Mar 06 13:02:17 hassbian hass[8366]: cert_names = extract_names(raw_cert) Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 73, in extract_names Mar 06 13:02:17 hassbian hass[8366]: asn1Spec=OctetString())[0] Mar 06 13:02:17 hassbian hass[8366]: File "/srv/homeassistant/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1318, in call__ Mar 06 13:02:17 hassbian hass[8366]: '%s not in asn1Spec: %r' % (tagSet, asn1Spec) Mar 06 13:02:17 hassbian hass[8366]: pyasn1.error.PyAsn1Error: <TagSet object at 0x6a696850 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x646fe350 tagSet <TagSet object at 0x69e5eb90 tags 0:0:4> encoding iso-8859-1>
https://github.com/fritzy/SleekXMPP/pull/482/files
--- sleekxmpp/xmlstream/cert.py
+++ sleekxmpp/xmlstream/cert.py 2019-03-06 14:32:21.715036120 +0100
@@ -69,8 +69,7 @@
if oid != SUBJECT_ALT_NAME:
continue
- value = decoder.extension.getComponentByName('extnValue'),
- asn1Spec=OctetString())[0]
+ value = extension.getComponentByName('extnValue')
sa_names = decoder.decode(value, asn1Spec=SubjectAltName())[0]
for name in sa_names:
name_type = name.getName()
@slmi I'm getting closer :-) New error thou. Edited this after I got a more clear error message.
Mar 06 21:30:59 hassbian hass[11914]: 2019-03-06 21:30:59 DEBUG (SyncWorker_8) [sucks] got {'code': '0000', 'msg': '操作成功', 'time': 1551904259229, 'data': {'uid': 'XXXXXXXXXX', 'username': 'XXXXX', 'email': 'XXXXXXXXXX@gmail.com', 'country': 'se', 'accessToken': 'XXXXXXXXXX'}} Mar 06 21:30:59 hassbian hass[11914]: 2019-03-06 21:30:59 DEBUG (SyncWorker_8) [sucks] calling main api user/getAuthCode with (('uid', 'XXXXXXXXXX'), ('accessToken', 'XXXXXXXXXX')) Mar 06 21:31:00 hassbian hass[11914]: 2019-03-06 21:31:00 DEBUG (SyncWorker_8) [sucks] got {'code': '0000', 'msg': '操作成功', 'time': 1551904259989, 'data': {'authCode': 'XXXXXXXXXX', 'ecovacsUid': 'XXXXXXXXXX'}} Mar 06 21:31:00 hassbian hass[11914]: 2019-03-06 21:31:00 DEBUG (SyncWorker_8) [sucks] calling user api loginByItToken with {'country': 'SE', 'resource': 'XXXXX', 'realm': 'ecouser.net', 'userId': 'XXXXXXXXXX', 'token': 'XXXXXXXXXX'} Mar 06 21:31:02 hassbian hass[11914]: 2019-03-06 21:31:02 DEBUG (SyncWorker_8) [sucks] got {'todo': 'result', 'result': 'fail', 'errno': 0, 'error': 'set token error.'} Mar 06 21:31:02 hassbian hass[11914]: 2019-03-06 21:31:02 ERROR (SyncWorker_8) [sucks] call to loginByItToken failed with {'todo': 'result', 'result': 'fail', 'errno': 0, 'error': 'set token error.'} Mar 06 21:31:02 hassbian hass[11914]: 2019-03-06 21:31:02 ERROR (MainThread) [homeassistant.setup] Error during setup of component ecovacs Mar 06 21:31:02 hassbian hass[11914]: Traceback (most recent call last): Mar 06 21:31:02 hassbian hass[11914]: File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 154, in _async_setup_component Mar 06 21:31:02 hassbian hass[11914]: component.setup, hass, processed_config) # type: ignore Mar 06 21:31:02 hassbian hass[11914]: File "/usr/local/lib/python3.6/asyncio/futures.py", line 331, in iter Mar 06 21:31:02 hassbian hass[11914]: yield self # This tells Task to wait for completion. Mar 06 21:31:02 hassbian hass[11914]: File "/usr/local/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup Mar 06 21:31:02 hassbian hass[11914]: future.result() Mar 06 21:31:02 hassbian hass[11914]: File "/usr/local/lib/python3.6/asyncio/futures.py", line 244, in result Mar 06 21:31:02 hassbian hass[11914]: raise self._exception Mar 06 21:31:02 hassbian hass[11914]: File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run Mar 06 21:31:02 hassbian hass[11914]: result = self.fn(*self.args, **self.kwargs) Mar 06 21:31:02 hassbian hass[11914]: File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/ecovacs/init.py", line 51, in setup Mar 06 21:31:02 hassbian hass[11914]: config[DOMAIN].get(CONF_CONTINENT)) Mar 06 21:31:02 hassbian hass[11914]: File "/srv/homeassistant/lib/python3.6/site-packages/sucks/init.py", line 126, in init Mar 06 21:31:02 hassbian hass[11914]: login_response = self.call_login_by_it_token() Mar 06 21:31:02 hassbian hass[11914]: File "/srv/homeassistant/lib/python3.6/site-packages/sucks/init.py", line 185, in call_login_by_it_token Mar 06 21:31:02 hassbian hass[11914]: 'token': self.auth_code} Mar 06 21:31:02 hassbian hass[11914]: File "/srv/homeassistant/lib/python3.6/site-packages/sucks/init.py", line 177, in __call_user_api Mar 06 21:31:02 hassbian hass[11914]: "failure {} ({}) for call {} and parameters {}".format(json['error'], json['errno'], function, params)) Mar 06 21:31:02 hassbian hass[11914]: RuntimeError: failure set token error. (0) for call loginByItToken and parameters {'todo': 'loginByItToken', 'country': 'SE', 'resource': 'XXXXX', 'realm': 'ecouser.net', 'userId': 'XXXXXXXXXX', 'token': 'XXXXXXXXXX'}
@Frippuz
Did you figure this out? I have the same issue.
@Frippuz - how are you pushing these changes to hassio? I'm getting the same error but only on my Raspberry Pi 3 that is running hassio. I would like to try and make a fix myself but I'm not sure how would I push the change to hassio.
The main code works no?
@Frippuz - how are you pushing these changes to hassio? I'm getting the same error but only on my Raspberry Pi 3 that is running hassio. I would like to try and make a fix myself but I'm not sure how would I push the change to hassio.
AFAIK, there is no work around for hassio yet =/
Do you need a 1.3.4 of SleekXMPP?
It seems that the fixes above helps. But it also seems like I have issues with two libs at the same time. I'm trying to get sucks to work. But it looks like the error wasn't with sucks in the end anyway. My type of 'bot wasn't supported by sucks at all - something that wasn't clear when In started testing it all. There are solutions on the way for that part.
I got stuck with the error above. But I think it is more related to sucks and not SleekXMPP itself. To resolve my original error, I downgraded to 1.3.2 and removed the certificate check. I am also running an experimental version of sucks and it works - unsafe, but it works at least.
Check this out: https://github.com/bmartin5692/sucks/tree/D901
@Frippuz: Thanks for your reply! If you test with https://github.com/fritzy/SleekXMPP/commits/develop instead of 1.3.2?
I spent some time last night finally sitting down to truly debug this. I ran into several issues:
I am wondering if it makes sense for us to try switching to Slixmpp, which is a form of SleekXMPP (so hopefully compatible without too many changes) that has had more recent development. It's either that or I will publish a version of SleekXMPP just for sucks that has patches for these issues.
I have no attachment to any particular XMPP library, and this one has been a thorn in our sides for a long time now, so I'm happy to switch to anything that works better.
@OverloadUT: Please create PR for your changes...
I try to relaunch the dev of the lib, I wait changes from @fritzy and @bear since several months, for a best SleekXMPP...
@Neustradamus The problem is that I don't have clean changes. I had to just comment out busted stuff and circumvent the cert expiration checks. It would take some time to fix it in such a manner as to be PR-worthy.