Closed ftarolli closed 1 year ago
Is it still working fine if you run the software normally? Can you please share the script used to autostart it?
Not at all. But I understood yesterday I was following the wrong way… HASSOS is using docker containers so I’ll move to learn how to build an ADDON from scratch to run your code with all dependencies needed and come back to u in a while during test phase maybe. I’m learning everything on the job…
your code was perfectly running before I messed up with openrc but anyway an update of HASSOS yesterday overwrote everything I did —> need to build and addon into a container
@ftarolli here's a very basic proof of concept: https://github.com/f1ren/RaspiNukiBridge/ Tested on my Home Assistant (RPi 4) and it works.
However, would love some help with it:
@f1ren I've finished today my own version and it's under testing. https://github.com/ftarolli/NukiBridgeAddon
I modified the main.py and the run.sh to do automatic configuration after you entered the lock Mac address.
working fine with my NUKI3.0 on a PI4 out of several exception as u mentioned that are not however stopping the service to work right now.
Like this:
Task exception was never retrieved future: <Task finished name='Task-13' coro=<Nuki._notification_handler() done, defined at /opt/nuki.py:309> exception=BleakDBusError('org.freedesktop.DBus.Error.NoReply', 'Message recipient disconnected from message bus without replying')> Traceback (most recent call last): File "/opt/nuki.py", line 337, in _notification_handler await self.disconnect() File "/opt/nuki.py", line 438, in disconnect await self.manager.start_scanning() File "/opt/nuki.py", line 135, in start_scanning await self._scanner.start() File "/usr/local/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 133, in start assert_reply(reply) File "/usr/local/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply raise BleakDBusError(reply.error_name, reply.body) bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.NoReply] Message recipient disconnected from message bus without replying
or this:
Task exception was never retrieved future: <Task finished name='Task-21' coro=<NukiManager._detected_ibeacon() done, defined at /opt/nuki.py:144> exception=KeyError(76)> Traceback (most recent call last): File "/opt/nuki.py", line 146, in _detected_ibeacon manufacturer_data = advertisement_data.manufacturer_data[76] KeyError: 76
@dauden1184 any suggestion?
@ftarolli I hope @dauden1184 can be more helpful, but here are my temporary solutions:
BleakDBusError
in start_scanning
, you can check my exponential-backoff solution. It succeeds on second attempt.KeyError: 76
I return quietly.did the changes u suggested and uploaded to git. I'll have a try tomorrow. btw, since 1 day now the add-on is working fine without issues while I'm instead annoyed by this log...
2022-04-26 22:19:41.022|I|web_log.py:206|172.30.32.1 [26/Apr/2022:20:19:41 +0000] "GET /list?ts=2022-04-26T20:19:41Z&rnr=xxxxxx&hash=xxxxxxxxxxxxxxxxxxxx HTTP/1.1" 200 543 "-" "python-requests/2.27.1"
I'm wondering if modifying the verbose mode requiring a minimum arg of 0 as below would be the solution
if args.verbose == 0: logger.setLevel(level=logging.INFO) logging.getLogger("aiohttp").setLevel(level=logging.INFO) #ERROR logging.getLogger("bleak").setLevel(level=logging.INFO) #ERROR elif args.verbose == 1: logger.setLevel(level=logging.ERROR) #DUBUG logging.getLogger("aiohttp").setLevel(level=logging.ERROR) #INFO logging.getLogger("bleak").setLevel(level=logging.ERROR) #INFO elif args.verbose == 2: logger.setLevel(level=logging.DEBUG) logging.getLogger("aiohttp").setLevel(level=logging.DEBUG) logging.getLogger("bleak").setLevel(level=logging.DEBUG)
or this:
Task exception was never retrieved future: <Task finished name='Task-21' coro=<NukiManager._detected_ibeacon() done, defined at /opt/nuki.py:144> exception=KeyError(76)> Traceback (most recent call last): File "/opt/nuki.py", line 146, in _detected_ibeacon manufacturer_data = advertisement_data.manufacturer_data[76] KeyError: 76
@dauden1184 any suggestion?
What nuki device are you using? Is it a lock? what version?
did the changes u suggested and uploaded to git. I'll have a try tomorrow. btw, since 1 day now the add-on is working fine without issues while I'm instead annoyed by this log...
2022-04-26 22:19:41.022|I|web_log.py:206|172.30.32.1 [26/Apr/2022:20:19:41 +0000] "GET /list?ts=2022-04-26T20:19:41Z&rnr=xxxxxx&hash=xxxxxxxxxxxxxxxxxxxx HTTP/1.1" 200 543 "-" "python-requests/2.27.1"
I'm wondering if modifying the verbose mode requiring a minimum arg of 0 as below would be the solution
if args.verbose == 0: logger.setLevel(level=logging.INFO) logging.getLogger("aiohttp").setLevel(level=logging.INFO) #ERROR logging.getLogger("bleak").setLevel(level=logging.INFO) #ERROR elif args.verbose == 1: logger.setLevel(level=logging.ERROR) #DUBUG logging.getLogger("aiohttp").setLevel(level=logging.ERROR) #INFO logging.getLogger("bleak").setLevel(level=logging.ERROR) #INFO elif args.verbose == 2: logger.setLevel(level=logging.DEBUG) logging.getLogger("aiohttp").setLevel(level=logging.DEBUG) logging.getLogger("bleak").setLevel(level=logging.DEBUG)
If the flag --verbose
is not specified, by default the value is 0.
Is that what you meant?
I'm using a PI4 with HASSIO. Core 2022.4.7 Supervisor 2022.04.0 Nuki lock 3.0
ABOUT VERBOSE: I saw it. In fact I was thinking to changed the first line of the "if" sentence to require an argument (0/1/2) to log something otherwise proceed smoothly...
What do I think?
My Home Assitant Addon is quite stable now. It even finds the MAC address for you :)
Will merge the stuff in the next days, sorry but i was on vacation :sweat_smile:
My Home Assitant Addon is quite stable now. It even finds the MAC address for you :)
I tried your add-on in hassio, but it doesn't work ==>
022-05-17 14:38:24.987|I|nuki.py:193|Stop scanning 2022-05-17 14:38:24.987|I|nuki.py:200|Error while stop scanning. Scan was probably not started. 2022-05-17 14:38:24.987|E|nuki.py:201|'NoneType' object has no attribute 'call' Traceback (most recent call last): File "/opt/./nuki.py", line 195, in stop_scanning await self._scanner.stop() File "/usr/local/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 169, in stop reply = await self._bus.call( AttributeError: 'NoneType' object has no attribute 'call' 2022-05-17 14:38:24.990|I|nuki.py:591|Nuki connecting
Ps: sorry to hijack this discussion, @f1ren, I cannot post this error in your git!
@sensei73 this log actually looks ok. What does it print next?
@f1ren This is the full log
@sensei73 which setup are you using? Which RPi model and HA installation method?
I'm wondering how to make it run in a HASSIO core (Alpine) config....
So far I've been able to install all needed, pair the lock and get it working but then I broke everything trying to run the service as u mentioned but through openrc instead.
Now I'm stopped here and can0t find how to go ahead...
PS: I'm definitely not an expert on any linux distro.... still much to learn