Nuki Card v10.2 released: sometimes script.nuki_bridge_polling_queue wasn’t called on startup. enforced it in the trigger.
Hey Alessandro, thanks for your great work on this!
I have an opener and was wondering if I could provide you with any Info to potentially get an Opener Integration going?
If you read some posts above, I said I’ll work on the opener when I get back from vacations. The problem is that in order to support the opener I need to change a lot of things, so it will take a little bit of time, you need to have some patience.
woops my bad… I jumped around using the sidebar navigation and skipped a few posts
it’s a long thread, I bet you did it, only a mad person would read everything.
@alexdelprete hi !
I installed the last version of your package, but I have these mistakes in the register. Is that only my problem?
I think so…
Excellent! Solutions?
You expect a solution looking at 4 screenshots, one of which doesn’t relate to the integration?
You are not installing it properly or you have other issues, but can’t help you with screenshots.
Describe what you did to install, describe what works and what doesn’t, show HA logs, show configuration.yaml, show secrets.yaml, show what HA version you’re using. etc.
You are doing the same thing like months ago: you expect help without providing proper information, it’ll never work.
Thank you for your answer!
I have the latest version available 2021.8.8
I created the token in the bridge
I created the token in followed your guide
created the folder and the file
covered your package inside
Every time I get started, I’ve had at least two mistakes (cousing for the screen not yours, it was a wrong click)
- Logger: homeassistant.helpers.entity_component
Source: helpers/entity_component.py:55
First occurred: 20:08:12 (3 occurrences)
Last logged: 20:08:14
Forced update failed. Entity sensor.nuki_bridge_endpoint_list not found.
Forced update failed. Entity sensor.nuki_bridge_endpoint_info not found.
Forced update failed. Entity sensor.nuki_bridge_callback_list not found.
- Logger: homeassistant.helpers.script
Source: helpers/script.py:653
First occurred: 20:08:15 (2 occurrences)
Last logged: 20:08:15
Error in ‘while[0]’ evaluation: In ‘template’ condition: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
That’s what… if you need anything else to help me, just ask me and I’ll be super happy to tell you everything
I asked you this. Those errors are too basic, it means the REST calls are not working, so you have something not configured correctly.
Did you uninstall the old nuki version? are you using also the official nuki integration in parallel? are you sure you configured the 4 secrets correctly? did you configure the bridge hostname/ip correctly? show me the config.yaml file, and also the secrets, masking the tokens etc.
Hi !
- uninstalled the old version in what sense? I had your 5.x. I deleted all lines of your code, and created the package
- I have the “official” nuki version installed
- sure I have written the 4 secrets correctly … I think
- correct bridge name / ip (I checked)
I paste the 2 files …
thank you with all my heart
In the sense that you need to clean all the previous code from all the various files. Hope you did it.
Uninstall it. It will do REST calls to the bridge, like this integration does, and the bridge doesn’t accept more than one call at the same time.
Looked at the config and it looks correct.
Now please uninstall the official integration, restart HA and tell me what happens.
If you have issues like before, you have to do some curl commands manually from a terminal, we need to check if the rest calls are working on the bridge.
Run each of this from the terminal, and paste each result here, wait a few seconds between each command:
curl -X GET 'http://bridge-ip:8080/log?token=xxxyyy'
curl -X GET ‘http://bridge-ip:8080/list?token=xxxxx’
curl -X GET ‘http://bridge-ip:8080/info?token=xxxxx’
curl -X GET ‘http://bridge-ip:8080/callback/list?token=xxxxx’
hi Alex, thanks for your work. I am looking forward for the opener integration! In the meanwhile a question:
is there any chance to have info about who opened the house? or if is opened by app or by keypad?
Hi, thanks for your kind words.
Unfortunately that info is not available through the Bridge API.
Hi! Thanks for your callback implementation!
Unfortunately, in my setup, the bridge most of the time replies with 503 service unavailable when the /list
endpoint gets polled 1 second after the callback had been executed.
After another second, the /info
then the /callback/list
endpoints succesfully return data (200 OK).
But the unsuccessful /list
call causes the error message to be parsed as json, which leads to some sensors like nuki_id
being overwritten with “unknown”. Thus subsequent commands will fail because there is no nuki_id
to call.
I can increase the delay after the callback to something like 2 seconds and the implementation will work most of the time. But there is still a chance that the bridge is busy when being polled by home assistant…
So is there a way to tell a rest-sensor to not update the attributes (keep the last attribute value) if the result cannot be parsed as JSON?
And secondly: Is there a way to automatically retry endpoint polls if the result is 503 service unavailable?
cheers,
–leo
Hi !
I have waited a bit to be sure -we are not screaming too loudly
that after the cancellation of official integration Nuki … the problems are all disappearing …
thank you still
ps: if I have other problems, I rewrite you XD
That’s correct, it’s by design, if you look at the code. The trigger for the rest commands is the callback (and HA startup), and each command is executed sequentially with a delay between each of them, because the bridge can’t handle more than 1 call at a time, so I had to implement a serialization mechanism. It’s working fine as far as I can tell from my specific experience and the one of the other users that are using this integration.
The problem you have is understanding why the /list command is failing with 503, it means that the bridge is busy processing other commands. This usually happens because you have also the official integration installed, or if you have the mobile app or the web app opened and doing things on the Nuki.
So please make sure no other app/integration/component is sending commands to the bridge, except for this integration.
Looking at the bridge log helps, if you can post it here we can take a look.
I wrote many times in this thread that the official integration running in parallel creates problems because of the bridge limitation of not being able to process more than one command at a time.
Glad it’s working now also for you.
Hi Alessandro!
Thanks for your answer!
My questions are more generic design questions than about solving that specific timing problem. (As I said, I know the code and I can make it go away by adding another second delay.)
But 503 errors may appear any time by coincidental interference with the app or the web-service.
I think on 503 responses, this integration should
- prevent the nuki_id from being reset to “unknown”, resulting in a broken state
- retry the request after a short delay
Do you have any idea how to solve that? I couldn’t find any info about reacting to HTTP status codes or to broken json responses in the rest sensor documentation. (Unfortunately I just started to use home assistant so I didn’t have the opportunity to dig into the automation documentation deeper, so I was hoping for your hints… )
P.S.: The official integration is not installed, and I didn’t have the app and nuki-web open at that time. I even captured the network-traffic of the bridge on the gateway and on the home-assistant host, there is no other request running at the same time. Looks like my bridge generally needs longer recovery times after a webhook…