marconfus / ha-nefit-ng

Rewrite of the „nefit“ component. Still in development!
11 stars 4 forks source link

HA 0.87 breaks component at startup #6

Open marconfus opened 5 years ago

marconfus commented 5 years ago

And it's broken again... The callback of the XMPP server leads to the following error:

Traceback (most recent call last):
  File "uvloop/handles/stream.pyx", line 827, in uvloop.loop.__uv_stream_on_read_impl
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/xmlstream.py", line 406, in data_received
    self._spawn_event(xml)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/xmlstream.py", line 970, in _spawn_event
    stanza = self._build_stanza(xml)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/xmlstream.py", line 951, in _build_stanza
    stanza = stanza_type(self, xml)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 1389, in __init__
    ElementBase.__init__(self, xml, parent)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 415, in __init__
    if self.setup(xml):
  File "/usr/local/lib/python3.6/site-packages/slixmpp/stanza/stream_features.py", line 27, in setup
    self.values = self.values
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 614, in _set_stanza_values
    self[full_interface] = value
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 752, in __setitem__
    lang=lang)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 958, in _set_sub_text
    return self._del_sub(name, lang=lang)
  File "/usr/local/lib/python3.6/site-packages/slixmpp/xmlstream/stanzabase.py", line 1039, in _del_sub
    parent = self.xml.find(parent_path)
  File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 298, in find
    return ElementPath.find(self, path, namespaces)
  File "/usr/local/lib/python3.6/xml/etree/ElementPath.py", line 298, in find
    return next(iterfind(elem, path, namespaces), None)
TypeError: 'NoneType' object is not an iterator
2019-02-09 19:51:29 WARNING (MainThread) [homeassistant.components.climate] Platform nefit not ready yet. Retrying in 180 seconds.

slixmpp library version is unchanged and it only happens in my "fully configured" HA instance. In the stripped down dev instance it still works fine. So I have no idea how to debug the situation. After a couple of restarts it starts to work again.

The same error occurs with the XMPP notify component (also based on slixmpp) so it's not my fault 😄

marconfus commented 5 years ago

and we're not alone: https://github.com/home-assistant/home-assistant/issues/20860

marconfus commented 5 years ago

https://lab.louiz.org/poezio/slixmpp/issues/3429

marconfus commented 5 years ago

Forked the slixmpp library, added a quick workaround and added a dependency to the forked version. This is not an ideal solution, but it works for me.

ehendrix23 commented 5 years ago

Adding my name to interested party for moving Harmony component to use XMPP

m11tch commented 5 years ago

Seems I am experiencing the same issue, in some rare cases the component does work (like once every 20 HA restarts)

2019-05-01 20:17:40 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on transport TCPTransport
Traceback (most recent call last):
  File "uvloop/handles/stream.pyx", line 827, in uvloop.loop.__uv_stream_on_read_impl
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 406, in data_received
    self._spawn_event(xml)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 970, in _spawn_event
    stanza = self._build_stanza(xml)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 951, in _build_stanza
    stanza = stanza_type(self, xml)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 1390, in __init__
    ElementBase.__init__(self, xml, parent)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 416, in __init__
    if self.setup(xml):
  File "/usr/local/lib/python3.7/site-packages/slixmpp/stanza/stream_features.py", line 27, in setup
    self.values = self.values
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 615, in _set_stanza_values
    self[full_interface] = value
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 753, in __setitem__
    lang=lang)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 959, in _set_sub_text
    return self._del_sub(name, lang=lang)
  File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 1040, in _del_sub
    parent = self.xml.find(parent_path)
  File "/usr/local/lib/python3.7/xml/etree/ElementTree.py", line 299, in find
    return ElementPath.find(self, path, namespaces)
  File "/usr/local/lib/python3.7/xml/etree/ElementPath.py", line 307, in find
    return next(iterfind(elem, path, namespaces), None)
TypeError: 'NoneType' object is not an iterator
2019-05-01 20:17:45 WARNING (MainThread) [homeassistant.components.climate] Platform nefit not ready yet. Retrying in 180 seconds.

Edit: Switched to your modified slixmpp package.. seems to work for now.. Let me know if you need me to collect any logs or anything..

b10m commented 5 years ago

The modified slixmpp package raises this error for me.

2019-05-19 13:12:35 ERROR (MainThread) [homeassistant.core] Error doing job: SSL error in data received
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 189, in feed_ssldata
    self._sslobj.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1056)
2019-05-19 13:12:35 ERROR (MainThread) [slixmpp.xmlstream.xmlstream] CERT: Invalid certificate trust chain.

Any pointers?

update: this looks like it is a OpenSSL / Python / Debian bug ...

tomlevels commented 5 years ago

Since upgrading to 0.94, I also get the same errors as m11tch ('NoneType' object is not an iterator), so my Nefit component never starts. Is there any news about this issue? Or any workaround for HassIO?

tomlevels commented 5 years ago

Is there any way I could help to fix this issue? I would like to update my HASS.IO to 0.95 (I'm at 0.93 now), but this bug is preventing me to do so.

ksya commented 5 years ago

Is this bug still present? I have not seen this in my setup.

regelneef commented 5 years ago

@ksya Same here. Still running on 0.95.4 but no issues what so every for the last couple of weeks

tomlevels commented 5 years ago

Is this bug still present? I have not seen this in my setup.

Yes, for me it is, I just upgraded to 0.96.3 and getting the same error:

2019-07-23 11:16:10 INFO (MainThread) [homeassistant.components.climate] Setting up climate.nefit 2019-07-23 11:16:10 DEBUG (MainThread) [aionefit] Initializing XMPP client 2019-07-23 11:16:10 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on transport TCPTransport Traceback (most recent call last): File "uvloop/handles/stream.pyx", line 827, in uvloop.loop.uv_stream_on_read_impl File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 406, in data_received self._spawn_event(xml) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 970, in _spawn_event stanza = self._build_stanza(xml) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/xmlstream.py", line 951, in _build_stanza stanza = stanza_type(self, xml) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 1390, in init ElementBase.init(self, xml, parent) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 416, in init__ if self.setup(xml): File "/usr/local/lib/python3.7/site-packages/slixmpp/stanza/stream_features.py", line 27, in setup self.values = self.values File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 615, in _set_stanza_values self[full_interface] = value File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 753, in setitem lang=lang) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 959, in _set_sub_text return self._del_sub(name, lang=lang) File "/usr/local/lib/python3.7/site-packages/slixmpp/xmlstream/stanzabase.py", line 1040, in _del_sub parent = self.xml.find(parent_path) File "/usr/local/lib/python3.7/xml/etree/ElementTree.py", line 299, in find return ElementPath.find(self, path, namespaces) File "/usr/local/lib/python3.7/xml/etree/ElementPath.py", line 307, in find return next(iterfind(elem, path, namespaces), None) TypeError: 'NoneType' object is not an iterator

Edit: after changing to "requirements": [ "aionefit==0.3", "https://github.com/marconfus/slixmpp/archive/master.zip#slixmpp==1.4.2.1" ] it works now