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

sleekxmpp.basexmpp ERROR day is out of range for month #45

Open
btittelbach opened this issue Aug 6, 2018 · 48 comments
Open

sleekxmpp.basexmpp ERROR day is out of range for month #45

btittelbach opened this issue Aug 6, 2018 · 48 comments

Comments

@btittelbach
Copy link

  • Login works
  • Server used: eu
  • any further command throws the following error
sleekxmpp.basexmpp WARNING  fulljid property deprecated. Use boundjid.resource                                          
sleekxmpp.basexmpp ERROR    day is out of range for month
Traceback (most recent call last):                                                                                    
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
    if not self.__read_xml():                                                                                      
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)                                                                                                                     
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)                                                                                    
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)                                                                                
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)                                                                                        
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():                                            
  File "/home/bernhard/.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 "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 133, in verify           
    not_before, not_after = extract_dates(raw_cert)
  File "/home/bernhard/.local/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 111, in extract_dates 
    not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
  File "/usr/lib/python3.6/_strptime.py", line 565, in _strptime_datetime                                                                       
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib/python3.6/_strptime.py", line 528, in _strptime                                                   
    datetime_date(year, 1, 1).toordinal() + 1              
ValueError: day is out of range for month
@TonyFeestneus
Copy link

Look at my post here: home-assistant/core#16186

Can be fixed, but perhaps you will run in to other issues later, like I did.

@OverloadUT
Copy link
Collaborator

More to the point, it seems that this issue is upstream in sleekXMPP: fritzy/SleekXMPP#478

Considering how long that issue has been open, we may need to figure out a workaround here.

@UNICodehORN
Copy link

Any updates on this one? I got the same error and wonder if there is a fix for it.

@dgomes
Copy link

dgomes commented Oct 31, 2018

Also finding the same error

@lollo78
Copy link

lollo78 commented Nov 2, 2018

Same issue of the OP in Home Assistant 0.81.2

@h4nc
Copy link

h4nc commented Nov 5, 2018

Same issue here running hassio 0.81.6

@kmlucy
Copy link

kmlucy commented Nov 11, 2018

If I fix the date out of range error via fritzy/SleekXMPP#478 (comment), 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

@alagarath
Copy link

alagarath commented Nov 24, 2018

@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')

@kmlucy
Copy link

kmlucy commented Nov 24, 2018

@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: home-assistant/core#18054 (comment)

@alagarath
Copy link

@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.

@h4nc
Copy link

h4nc commented Nov 24, 2018

Would be nice if the working (latest) dependencies will be reported in this topic by the first one who see's it working.

@jpreiditsch
Copy link

Seeing this on 0.82.1

@maluueu
Copy link

maluueu commented Dec 1, 2018

@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 ?

@OverloadUT
Copy link
Collaborator

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.

@alagarath
Copy link

@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

@inputd
Copy link

inputd commented Dec 6, 2018

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?

@rschoolm
Copy link

I'm in the same boat. How do we work around this for HASSIO?

@alagarath
Copy link

alagarath commented Dec 12, 2018

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

@rschoolm
Copy link

Thanks alagarth. Appreciate the quick response. We will have to see what comes about with SleekXMPP.

@rschoolm
Copy link

Is this a BUG with the sleekxmpp or is the ecovac addon using an outdated or depreciated method within sleekxmpp?

@wpietri
Copy link
Owner

wpietri commented Dec 12, 2018

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.

@kmlucy
Copy link

kmlucy commented Dec 12, 2018

@wpietri With your setup, what version of sleekxmpp do you use?

@wpietri
Copy link
Owner

wpietri commented Dec 12, 2018

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

@kmlucy
Copy link

kmlucy commented Dec 12, 2018

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.

@OverloadUT
Copy link
Collaborator

@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: fritzy/SleekXMPP#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: fritzy/SleekXMPP#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.)

@rschoolm
Copy link

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

@OverloadUT
Copy link
Collaborator

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.

@kmlucy
Copy link

kmlucy commented Dec 12, 2018

home-assistant/core#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: home-assistant/core#17283

@leofuscaldi
Copy link

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?

@trhr
Copy link

trhr commented Jan 27, 2019

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?

@wpietri
Copy link
Owner

wpietri commented Jan 27, 2019

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.

@TogueSoftware
Copy link

TogueSoftware commented Feb 14, 2019

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

@h4nc
Copy link

h4nc commented Feb 15, 2019

@tongueSoftware does this solve this issue, would be great because this also destroyed the ecovacs components for some months.

@slmi
Copy link

slmi commented Feb 17, 2019

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

@Sha-Darim
Copy link

Sha-Darim commented Mar 6, 2019

@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>

@slmi
Copy link

slmi commented Mar 6, 2019

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()

@Sha-Darim
Copy link

Sha-Darim commented Mar 6, 2019

@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'}

@coolguymatt
Copy link

@Frippuz

Did you figure this out? I have the same issue.

@meyerdenney
Copy link

@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.

@Neustradamus
Copy link

The main code works no?

@inputd
Copy link

inputd commented Apr 8, 2019

@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 =/

@Neustradamus
Copy link

Do you need a 1.3.4 of SleekXMPP?

@Sha-Darim
Copy link

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

@Neustradamus
Copy link

@Frippuz: Thanks for your reply!
If you test with https://github.com/fritzy/SleekXMPP/commits/develop instead of 1.3.2?

@OverloadUT
Copy link
Collaborator

I spent some time last night finally sitting down to truly debug this. I ran into several issues:

  1. The HEAD of develop did not work out of the box at all, because it has invalid references to some deprecated properties of the SSL library. Hassio runs on Python 3.7 where this just blows up. I saw that a PR has been open in SleekXMPP for this for ages
  2. Once I fixed it to not use the deprecated properties, I ran in to certificate expiration errors. This does mean that the "day is out of range" issue is fixed in develop, but the certificate expiration is a blocker.
  3. I tried changing some parameters when SleekXMPP is created (such as not to use TLS at all) but these don't work. We need to have a way to use the secure connection, but to not error out if the cert is invalid, which is currently not a feature that is supported in SleekXMPP. This issue is described in Certificate expired error when trying to clean #62
  4. Once I commented out the code in SleekXMPP that does expiration validation, everything worked!

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.

@wpietri
Copy link
Owner

wpietri commented Apr 10, 2019

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.

@Neustradamus
Copy link

@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...

@OverloadUT
Copy link
Collaborator

@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.

OverloadUT added a commit to OverloadUT/sucks that referenced this issue Apr 18, 2019
This fork of SleekXMPP disables certificate validation to work around wpietri#62 and wpietri#45

This fix should be seen as a temporary hack until we figure out a long term solution.
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