Open bgoncal opened 1 year ago
Confirmed, I see exactly the same behaviour.
For me nuki_ng also spams the logfiles since several weeks. Basically, the lock seems to work in HA, but it goes off- and online again from time to time for about a minute or so, maybe connected with the flood of errors reported in the log. The errors logged seem to vary, they look like this:
Jan 09 15:08:43 conmon[193278]: 2023-01-09 15:08:43.753 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Jan 09 15:08:43 conmon[193278]: Traceback (most recent call last):
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
Jan 09 15:08:43 conmon[193278]: await self._async_refresh(log_failures=True, scheduled=True)
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
Jan 09 15:08:43 conmon[193278]: self.async_update_listeners()
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
Jan 09 15:08:43 conmon[193278]: update_callback()
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coorainator_upd>
Jan 09 15:08:43 conmon[193278]: self.async_write_ha_state()
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
Jan 09 15:08:43 conmon[193278]: self._async_write_ha_state()
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in _async_write_ha_state
Jan 09 15:08:43 conmon[193278]: state = self._stringify_state(available)
Jan 09 15:08:43 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 562, in _stringify_state
Jan 09 15:08:43 conmon[193278]: if (state := self.state) is None:
Jan 09 15:08:43 conmon[193278]: File "/config/custom_components/nuki_ng/sensor.py", line 98, in state
Jan 09 15:08:43 conmon[193278]: return self.native_value
Jan 09 15:08:43 conmon[193278]: File "/config/custom_components/nuki_ng/sensor.py", line 94, in native_value
Jan 09 15:08:43 conmon[193278]: return self.data.get("bridge_info", {}).get("rssi")
Jan 09 15:08:43 conmon[193278]: AttributeError: 'NoneType' object has no attribute 'get'
or this
Jan 09 20:25:05 conmon[193278]: 2023-01-09 20:25:05.876 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Jan 09 20:25:05 conmon[193278]: Traceback (most recent call last):
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
Jan 09 20:25:05 conmon[193278]: await self._async_refresh(log_failures=True, scheduled=True)
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
Jan 09 20:25:05 conmon[193278]: self.async_update_listeners()
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
Jan 09 20:25:05 conmon[193278]: update_callback()
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coordinator_upd>
Jan 09 20:25:05 conmon[193278]: self.async_write_ha_state()
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
Jan 09 20:25:05 conmon[193278]: self._async_write_ha_state()
Jan 09 20:25:05 conmon[193278]: File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in _async_write_ha_state
Jan 09 20:25:05 conmon[193278]: attr.update(self.extra_state_attributes or {})
Jan 09 20:25:05 conmon[193278]: File "/config/custom_components/nuki_ng/sensor.py", line 220, in extra_state_attributes
Jan 09 20:25:05 conmon[193278]: "timestamp": datetime.fromisoformat(timestamp) if not None else None,
Jan 09 20:25:05 conmon[193278]: TypeError: fromisoformat: argument must be str
So basically the integration seems to work most of the time despite the errors, nevertheless I'm a bit worried about the amount of error messages (making up about 99% of the HA logfile) and am considering switching back to the standard integration.
That's my exact same situation, I have a dashboard that shows my lock state and very often I see it "unavailable" there for like 30 seconds (and all Nuki properties too, not just lock state)
Also having issues. About every hour or so the lock becomes unavailable for a couple seconds.
Failed to get latest data: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/nuki_ng/nuki.py", line 396, in _update
bridge_info = await self.api.bridge_info()
File "/config/custom_components/nuki_ng/nuki.py", line 78, in bridge_info
return await self.async_json(lambda r: r.get(self.bridge_url("/info"), timeout=BRIDGE_TIMEOUT))
File "/config/custom_components/nuki_ng/nuki.py", line 37, in async_json
response = await self.hass.async_add_executor_job(lambda: cb(requests))
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/nuki_ng/nuki.py", line 37, in <lambda>
response = await self.hass.async_add_executor_job(lambda: cb(requests))
File "/config/custom_components/nuki_ng/nuki.py", line 78, in <lambda>
return await self.async_json(lambda r: r.get(self.bridge_url("/info"), timeout=BRIDGE_TIMEOUT))
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
But I also get the following one:
Logger: custom_components.nuki_ng.nuki
Source: custom_components/nuki_ng/nuki.py:78
Integration: Nuki Lock ([documentation](https://github.com/kvj/hass_nuki_ng), [issues](https://github.com/kvj/hass_nuki_ng/issues))
First occurred: 17 januari 2023 om 12:03:36 (9 occurrences)
Last logged: 13:52:54
Failed to get latest data: ("Connection broken: InvalidChunkLength(got length b'HTTP/1.1 200 OK\\r\\n', 0 bytes read)", InvalidChunkLength(got length b'HTTP/1.1 200 OK\r\n', 0 bytes read))
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 761, in _update_chunk_length
self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b'HTTP/1.1 200 OK\r\n'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 444, in _error_catcher
yield
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 828, in read_chunked
self._update_chunk_length()
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 765, in _update_chunk_length
raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'HTTP/1.1 200 OK\r\n', 0 bytes read)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 816, in generate
yield from self.raw.stream(chunk_size, decode_content=True)
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 624, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 816, in read_chunked
with self._error_catcher():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 461, in _error_catcher
raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'HTTP/1.1 200 OK\\r\\n', 0 bytes read)", InvalidChunkLength(got length b'HTTP/1.1 200 OK\r\n', 0 bytes read))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/nuki_ng/nuki.py", line 396, in _update
bridge_info = await self.api.bridge_info()
File "/config/custom_components/nuki_ng/nuki.py", line 78, in bridge_info
return await self.async_json(lambda r: r.get(self.bridge_url("/info"), timeout=BRIDGE_TIMEOUT))
File "/config/custom_components/nuki_ng/nuki.py", line 37, in async_json
response = await self.hass.async_add_executor_job(lambda: cb(requests))
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/nuki_ng/nuki.py", line 37, in <lambda>
response = await self.hass.async_add_executor_job(lambda: cb(requests))
File "/config/custom_components/nuki_ng/nuki.py", line 78, in <lambda>
return await self.async_json(lambda r: r.get(self.bridge_url("/info"), timeout=BRIDGE_TIMEOUT))
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 745, in send
r.content
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 899, in content
self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 818, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'HTTP/1.1 200 OK\\r\\n', 0 bytes read)", InvalidChunkLength(got length b'HTTP/1.1 200 OK\r\n', 0 bytes read))
Multiple issues here:
see it "unavailable" there for like 30 seconds (and all Nuki properties too, not just lock state)
That's the result of Bridge and/or API unavailability. If the integration fails to fetch the data, it marks its state as "unavailable" (because it is) until the next polling time.
Remote end closed connection without response
and other connection errors, including InvalidChunkLength
- the Bridge isn't available at that time, the integration failed to connect and/or do http exchange. The Bridge is single-threaded piece of a not very powerful hardware, so connection errors just happen. I'm not aware of any report when this issue is being reported as persistent, e.g. each polling is failing.
TypeError: fromisoformat: argument must be str
This issue is being reported quite often. I don't fully understand what is causing it, most likely incomplete data built from the data polling. I will take another look.
return self.data.get("bridge_info", {}).get("rssi")
Kind of the same stuff - the data is incomplete, probably because the one http requests to bridge failed
Thanks for the reply. As I said, we are not talking about a few log entries, but the integration is literally flooding the log with errors. Every half a minute multiple error lines are logged. And this behavior is relatively new - it was working quietly and reliable until a few weeks/days (?) ago with the same hardware in my case. Unfortunately, I cannot say when the error occured for the first time.
Usual advice: since the bridge only manages 1 connection, if another sw is connecting often, another sw will fail. Make sure you don't have another integration (many users were using the official nuki integration in parallel) or the mobile APP always open etc. minimise all communication to the bridge, except for nuki_ng obviously.
The bridge unfortunately is a bad piece of hw, very poorly designed. I switched to Nuki Hub.
I only use the nuki_ng integration, and though I have the Android app installed, I hardly use it. I haven't changed the setup recently, and it was working previouslyr. There must have been a change with some recent update (HA/integration/bridge firmware/..)?!
The component hasn't been upgraded since September. Did you change wifi network or something like that? Because those InvalidChunk errors in the log are pretty strange, it looks like a network issue, is the bridge well connected to WiFi? What's the RSSI level?
I also didn't change anything in my network setup and never use the Android app. This started happening recently.
My advice to everybody: abandon the bridge (the hw and the firmware really suck) and switch to Nuki Hub.
With a $7-10 ESP32 device you have a much powerful and micro-sized bridge. Personally I'm using it on the M5 Atom U, but the M5 Atom Lite is good too. I got a bunch of these for other things, but as a bridge they're excellent. There are many other ESP32 devices you can use.
The Nuki Hub firmware is in active developement, it supports MQTT out of the box and HA AutoDiscovery, so you just install it, configure it, and the lock with all the sensors will be automatically configured in HA.
Nuki has finally decided, after years of users complaining, to implement MQTT support, but for now it's in beta only for the SL3 Pro. Since they declined to answer if MQTT will be available for the Nuki Bridge, I decided to switch to an open-source solution, much more reliable and stable vs the current Nuki Bridge. If they decide to implement MQTT support in Nuki Bridge, then finally Nuki would have made the best decision, but I don't think they will do it unfortunately, they want to sell the new SL3 Pro to old users who already invested in SL2.
What does that mean for who uses the Nuki keypad aswell? Will I still be able to manage codes etc? Can I keep the bridge from Nuki and the ESP32 in parallel?
Can I keep the bridge from Nuki and the ESP32 in parallel?
It's explained on the Github Page after klicking and scrolling a bit.
"Possible but not recommended"
What does that mean for who uses the Nuki keypad aswell? Will I still be able to manage codes etc? Can I keep the bridge from Nuki and the ESP32 in parallel?
Did you read the project's README? :)
I was asking more of your personal experience, plug-ins/custom firmares/addons say they can do many things, not all those things actually work nicely in real life, but thanks anyway.
When you bought Nuki did you talk to real users? I couldn't, it just came out. :)
Nuki Hub is an open-source project, you can check in the issues if something's not working because users are testing/using it and they give feedbacks about issues.
Personally I'm using it and it works fine, there were a couple of bugs but with the dev we managed to solve them. I highly recommend it, it's what Nuki Bridge should be, and it costs $10.
Thank you!On 19 Jan 2023, at 09:37, Alessandro Del Prete @.***> wrote: It's an open-source project, you can check in the issues if something's not working because users are testing/using it and they give feedbacks about issues. Personally I'm using it and it works fine, there were a couple of bugs but with the dev we managed to solve them. I highly recommend it, it's what Nuki Bridge should be, and it costs $10.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
For those who are in doubt whether ditching Nuki Bridge for ESP32 solution or not: your iOS/Android app stays fully functional as it connects to Nuki devices, keypads etc directly and not through the bridge
After all, the bridge is an optional device for Nuki.
If I switch to Nuki Hub from Nuki Bridge, what HomeAssistant integration should be used? Still nuki_ng or MQTT Lock? Or both?
If I switch to Nuki Hub from Nuki Bridge, what HomeAssistant integration should be used? Still nuki_ng or MQTT Lock? Or both?
Or none of them :smile:
You don't need any integration, except working MQTT setup. Nuki Hub provides HA MQTT discovery payloads, everything works out of the box
You don't need any integration, except working MQTT setup. Nuki Hub provides HA MQTT discovery payloads, everything works out of the box
Nuki Hub is what the Nuki Bridge shoul've always been. ;)
But the project needs a little bit of help from you Konstantin...:D
During researching, I found out that there is a beta firmware for the Smartlock 3 Pro which enables MQTT since some time. So maybe there will be no need for an additional bridge-like device in the future? At least for this Nuki lock. See this post: https://developer.nuki.io/t/nuki-bridge-mqtt-support/2498/16
That's my exact same situation, I have a dashboard that shows my lock state and very often I see it "unavailable" there for like 30 seconds (and all Nuki properties too, not just lock state)
I have the same issue.
Is it planned to make this integration work with the beta MQTT interface of the smart lock 3 pro?
If I switch to Nuki Hub from Nuki Bridge, what HomeAssistant integration should be used? Still nuki_ng or MQTT Lock? Or both?
Or none of them smile
You don't need any integration, except working MQTT setup. Nuki Hub provides HA MQTT discovery payloads, everything works out of the box
So you have solve the problem this custom integration has with the hardware it is designed to work with by using another hardware for which you don't need the integration anymore? Hmmm ;-) I understand that the ESP32 way is the more elegant way (and probably I'll go with it sooner or later, as I like tinkering with hard- and software), however I think that this integration should somehow be designed to deal with the limitations of the hardware it is supposed to work with.
`Failed to get latest data: ('Connection aborted.', BadStatusLine('5C\r\n')) Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 300, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: 5C
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 300, in _read_status
raise BadStatusLine(line)
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine('5C\r\n'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/config/custom_components/nuki_ng/nuki.py", line 400, in _update device_list = await self.api.bridge_list() File "/config/custom_components/nuki_ng/nuki.py", line 71, in bridge_list data = await self.async_json(lambda r: r.get(self.bridge_url("/list"), timeout=BRIDGE_TIMEOUT)) File "/config/custom_components/nuki_ng/nuki.py", line 37, in async_json response = await self.hass.async_add_executor_job(lambda: cb(requests)) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/nuki_ng/nuki.py", line 37, in
response = await self.hass.async_add_executor_job(lambda: cb(requests))
File "/config/custom_components/nuki_ng/nuki.py", line 71, in
data = await self.async_json(lambda r: r.get(self.bridge_url("/list"), timeout=BRIDGE_TIMEOUT))
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('5C\r\n'))`