Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid MAC Address in MQTT Topic #433

Closed
SeLLeRoNe opened this issue Jan 7, 2021 · 35 comments
Closed

Avoid MAC Address in MQTT Topic #433

SeLLeRoNe opened this issue Jan 7, 2021 · 35 comments

Comments

@SeLLeRoNe
Copy link

Is your feature request related to a problem? Please describe.
I usually share my config, and I would prefer not to share my MAC Addresses

Describe the solution you'd like
Use the "name" value for MQTT Topic instead of the MAC Address

Describe alternatives you've considered
Haven't think on alternative solution TBH

Additional context
N/A

@mKeRix
Copy link
Owner

mKeRix commented Jan 7, 2021

Fair point! Since the ID is the actual permanent part of the configuration (names can change) I'm a bit wary of changing this. Plus, changing it for everyone would also be a breaking change.

As a counter suggestion: what if you could override the ID of the entity in the room-assistant config? That way you could set an alias in your room-assistant config (which always needs to contain the MAC anyway) and your shared Home Assistant or NodeRED configs only contain the alias. Would that solve your problem as well?

@SeLLeRoNe
Copy link
Author

SeLLeRoNe commented Jan 7, 2021

Well I was actually doing that for 1 device:

bluetoothLowEnergy:
  whitelist:
    - myDeviceId
  maxDistance: 17
  tagOverrides:
    myDeviceId:
      name: Andrea Flex 2
#      measuredPower: -61

But it didn't work, so yes, if I can set a name per-MAC I'm satisfied.
I definetely understand your point and agree on it.

A

@mKeRix mKeRix added this to To do in room-assistant roadmap Feb 6, 2021
@mKeRix mKeRix moved this from To do to In progress in room-assistant roadmap Feb 14, 2021
@mKeRix mKeRix closed this as completed in e41034e Feb 14, 2021
room-assistant roadmap automation moved this from In progress to Done Feb 14, 2021
@dwf
Copy link

dwf commented Feb 17, 2021

Sorry to hijack this, but @SeLLeRoNe, I'm very curious, is "Andrea Flex 2" a Fitbit Flex 2 that you are successfully using as a BLE beacon? I'm very curious how you got it working if so, I've been trying without success.

@SeLLeRoNe
Copy link
Author

That was indeed a test for a Fitbit Flex 2, but it did never work :)

github-actions bot pushed a commit that referenced this issue Feb 28, 2021
# [2.14.0](v2.13.1...v2.14.0) (2021-02-28)

### Bug Fixes

* **bluetooth:** respect connecting state during retry ([8f36d87](8f36d87))
* **entities:** prevent dates from being proxied ([d861486](d861486))

### Features

* add generic MQTT integration ([848a25b](848a25b)), closes [#434](#434)
* **bluetooth-classic:** allow id overrides ([f5fc88d](f5fc88d))
* **bluetooth-low-energy:** allow id overrides ([e41034e](e41034e)), closes [#433](#433)
* **entities:** bunch entity updates together ([52f0197](52f0197))
* **home-assistant:** add discoveryPrefix option ([#546](#546)) ([1056bb5](1056bb5))
@github-actions
Copy link

🎉 This issue has been resolved in version 2.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SeLLeRoNe
Copy link
Author

Hi @mKeRix , I see this has been implemented only for BLE, could this be also implemented for normal BT devices?

@mKeRix mKeRix reopened this Mar 1, 2021
@mKeRix
Copy link
Owner

mKeRix commented Mar 1, 2021

The BT Classic part for this was implemented in f5fc88d - does that not work? Note that the option name is slightly different.

I’ve reopened the issue so that we can track this problem :)

@SeLLeRoNe
Copy link
Author

To be fair, I cannot test because I can't get Room Assistant to start anymore on 3 devices since the update.
RPi Zero:
malloc(): invalid size (unsorted) Aborted

RPi 3:
[Nest] 3959 - 02/03/2021, 10:30:30 [ClusterService] libnode.so.64: cannot open shared object file: No such file or directory Error: libnode.so.64: cannot open shared object file: No such file or directory at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object.<anonymous> (/usr/local/lib/node_modules/room-assistant/node_modules/mdns/lib/dns_sd.js:24:20) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14)

I have the feeling that this is due to the NodeJS update suggested on the release page (using the commands provided).
Any idea on what can I do to have it fixed?

Thanks

@SeLLeRoNe SeLLeRoNe reopened this Mar 2, 2021
@SeLLeRoNe
Copy link
Author

Wrong button press sorry :)

@dwf
Copy link

dwf commented Mar 2, 2021

Still subscribed to this because of my earlier off-topic inquiry, but I recently had a lot of trouble upgrading after 2.12, and the solution for me was to nuke /opt/nodejs and use Heiko's Ansible playbooks to start from scratch, with the added benefit of not having to manually fiddle around with every new node I add.

@mKeRix
Copy link
Owner

mKeRix commented Mar 2, 2021

If you don't want to get into ansible you should also be able to just run the commands mentioned in the release notes to upgrade your NodeJS version, e.g. for Pi Zeros:

wget -O - https://gist.githubusercontent.com/mKeRix/88b7b81e9bca044f74de1dc51696efb2/raw/799a20bca44cc61d8f8ae93878f2f28af8365a69/getNodeLTS.sh | bash

It's a modified version of the previous install script, which will replace old versions with the current LTS (14.x).

@SeLLeRoNe
Copy link
Author

I do have NodeJS 14 correctly installed as far as I can see.
For my RPi Zero I am nuking now /opt/ and retrying the install.
Any idea for the RPi 3?

@SeLLeRoNe
Copy link
Author

Ok, doesn't seems to help unfrotunately, same error as above on RPi Zero

@mKeRix
Copy link
Owner

mKeRix commented Mar 2, 2021

@SeLLeRoNe What does node -v and npm -v say? Did you re-installing room-assistant after you upgraded NodeJS? It's possible that the linked install script has an issue... not sure what could be wrong that would result in such error messages though.

For the Pi 3 I think the other commands from the release notes should work, since those can use the official distributions. If you just add the repository for the 14.x versions I think it will offer the package upgrade on the next apt-get update && apt-get upgrade.

@SeLLeRoNe
Copy link
Author

They are actually using nodejs 14 and I did reinstall room assistant after updating nodejs.

I will post the exact versions tomorrow.
Both system nodejs were updated with the provided instructions.

@SeLLeRoNe
Copy link
Author

SeLLeRoNe commented Mar 3, 2021

Raspberry Pi 3:

node -v
v14.16.0
npm -v
6.14.11

Starting up manually, this is the log:

>/usr/local/bin/room-assistant -c /home/user/room-assistant/config/local.yml
[Nest] 5204   - 03/03/2021, 15:42:55   [ClusterService] libnode.so.64: cannot open shared object file: No such file or directory
Error: libnode.so.64: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/room-assistant/node_modules/mdns/lib/dns_sd.js:24:20)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
03/03/2021, 15:42:56 - info - IntegrationsModule: Loading integrations: none
03/03/2021, 15:42:56 - info - NestFactory: Starting Nest application...
03/03/2021, 15:42:57 - info - InstanceLoader: AppModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: ConfigModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: NestEmitterModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: IntegrationsModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: HttpModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: DiscoveryModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: PrometheusModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: ClusterModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: TerminusModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: ScheduleModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: EntitiesModule dependencies initialized
03/03/2021, 15:42:57 - info - InstanceLoader: StatusModule dependencies initialized
03/03/2021, 15:42:57 - info - RoutesResolver: EntitiesController {/entities}:
03/03/2021, 15:42:57 - info - RouterExplorer: Mapped {/entities, GET} route
03/03/2021, 15:42:57 - info - RoutesResolver: StatusController {/status}:
03/03/2021, 15:42:57 - info - RouterExplorer: Mapped {/status, GET} route
03/03/2021, 15:42:57 - info - RoutesResolver: PrometheusController {/metrics}:
03/03/2021, 15:42:57 - info - RouterExplorer: Mapped {/metrics, GET} route
03/03/2021, 15:42:57 - info - ConfigService: Loading configuration from /usr/local/lib/node_modules/room-assistant/dist/config/definitions/default.js
03/03/2021, 15:42:57 - warn - ConfigService: No configuration found in /home/user/room-assistant/config/local.yml
03/03/2021, 15:42:57 - warn - ClusterService: Dependency "mdns" was not found, automatic discovery has been disabled. You will have to provide the addresses of other room-assistant nodes manually in the config.
03/03/2021, 15:42:57 - info - NestApplication: Nest application successfully started
03/03/2021, 15:42:59 - info - ClusterService: raspberry.livingroom.casa has been elected as leader
03/03/2021, 15:42:59 - info - EntitiesService: Refreshing entity states

Raspberry Pi Zero:

node -v
v14.16.0
npm -v
6.14.11

And if I try to start it:

>/usr/local/bin/room-assistant -c /home/user/room-assistant/config/local.yml
malloc(): corrupted top size
Aborted

@mKeRix
Copy link
Owner

mKeRix commented Mar 4, 2021

For the Pi 3: possibly try un- and re-installing the nodejs package. Maybe also run the usual apt-get upgrade. Unfortunately I don't have a Pi 3 available for immediate testing atm, Google seems to not give me any new hints either.

For the Pi Zero: I just re-installed NodeJS and room-assistant using the script as I provided it in the release notes on one of my Pi Zero Ws and couldn't reproduce the issue that you are having. I'm a bit clueless as to what is the cause of your issue here, as I'm also not finding anything usable about that for NodeJS. I'd suggest to try an apt-get upgrade - and if that doesn't help, flashing a fresh version of Raspberry Pi OS.

@SeLLeRoNe
Copy link
Author

I did actually already tried to uninstall and reinstall.
It is very odd indeed, being the only one who have this issue clearly means something went upside down during the upgrade.

I'll try to reflash the Pi zero tomorrow and possibly also the 3

I'll update one I've done so possibly we can go back on the issue topic :)

@SeLLeRoNe
Copy link
Author

Hi there,
I've just finished to re-build the Pi Zero W and now they start.
Slight note, I had to also install npm package "x2js" due to this error:

pi@master:~/room-assistant $ room-assistant
/opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:844
    throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
    ^

Error: Cannot parse config file: 'config/local.xml': Error: Cannot find module 'x2js'
Require stack:
- /opt/nodejs/lib/node_modules/room-assistant/node_modules/config/parser.js
- /opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js
- /opt/nodejs/lib/node_modules/room-assistant/dist/app.module.js
- /opt/nodejs/lib/node_modules/room-assistant/dist/main.js
- /opt/nodejs/lib/node_modules/room-assistant/bin/room-assistant.js
    at Config.util.parseFile (/opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:844:11)
    at /opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:644:26
    at Array.forEach (<anonymous>)
    at Config.util.loadFileConfigs (/opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:643:16)
    at new Config (/opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:116:27)
    at Object.<anonymous> (/opt/nodejs/lib/node_modules/room-assistant/node_modules/config/lib/config.js:1492:31)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)

One thing that I noticed is that it doesn't look like it is connecting to MQTT, full startup log:

09/03/2021, 12:39:44 - info - IntegrationsModule: Loading integrations: none
09/03/2021, 12:39:47 - info - NestFactory: Starting Nest application...
09/03/2021, 12:39:47 - info - InstanceLoader: AppModule dependencies initialized
09/03/2021, 12:39:47 - info - InstanceLoader: ConfigModule dependencies initialized
09/03/2021, 12:39:47 - info - InstanceLoader: NestEmitterModule dependencies initialized
09/03/2021, 12:39:47 - info - InstanceLoader: IntegrationsModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: HttpModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: DiscoveryModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: PrometheusModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: ClusterModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: TerminusModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: ScheduleModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: EntitiesModule dependencies initialized
09/03/2021, 12:39:48 - info - InstanceLoader: StatusModule dependencies initialized
09/03/2021, 12:39:50 - info - RoutesResolver: EntitiesController {/entities}:
09/03/2021, 12:39:51 - info - RouterExplorer: Mapped {/entities, GET} route
09/03/2021, 12:39:51 - info - RoutesResolver: StatusController {/status}:
09/03/2021, 12:39:51 - info - RouterExplorer: Mapped {/status, GET} route
09/03/2021, 12:39:51 - info - RoutesResolver: PrometheusController {/metrics}:
09/03/2021, 12:39:51 - info - RouterExplorer: Mapped {/metrics, GET} route
09/03/2021, 12:39:51 - info - ConfigService: Loading configuration from /opt/nodejs/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/local.xml
09/03/2021, 12:39:51 - info - ClusterService: Starting mDNS advertisements and discovery
09/03/2021, 12:39:51 - info - NestApplication: Nest application successfully started
09/03/2021, 12:39:51 - info - ClusterService: bedroom.casa has been elected as leader
09/03/2021, 12:39:51 - info - EntitiesService: Refreshing entity states

Hopefully I'll find the time today to re-build also the Pi 3

@SeLLeRoNe
Copy link
Author

Hi @mKeRix do you have any idea? I am not sure why no one is having this issuenor why you can't replicate... I didn't do anything "specific"

@mKeRix
Copy link
Owner

mKeRix commented Mar 13, 2021

It seems like it just doesn't load any integrations at all (see the top of the logs), which means there wouldn't even be an attempt at connecting to your MQTT. Double-check that your config(s) are well formatted - I can at least see that it's picking up your local.yml. Do you have this issue on both the Zero W and the Pi 3 now, or just on one of them?

I can't really speak to the x2js issue, that of course shouldn't be the case. I also didn't find any recent issues regarding that on the node-config repo. Maybe it was just a temporary failure during the room-assistant installation via npm?

@SeLLeRoNe
Copy link
Author

That's odd because the config is the same I have been using before the update..
I still haven't found the time to format the RPi3 to be honest.

What I can do is to share the config, maybe I missed something very obious:

global:
  instanceName: "Master Bedroom"
  integrations:
    - bluetoothClassic
    - bluetoothLowEnergy
    - homeAssistant
  cluster:
    autoDiscovery: false
    networkInterface: eth0
    port: 6425
    peerAddresses:
      - redacted:6425 # Living Room
      - redacted:6425 # Studio
      - redacted:6425 # Master Bedroom
      - redacted:6425 # Luca's Bedroom
  entities:
    behaviors:
      d6t_occupancy_count:
        debounce:
          wait: 0.75
          maxWait: 2
homeAssistant:
  mqttUrl: 'mqtt://redacted:1883'
  mqttOptions:
    username: redacted
    password: redacted
bluetoothClassic:
  hciDeviceId: 0
  interval: 5
  scanTimeLimit: 5
  timeoutCycles: 5
  minRssi: -5
  addresses:
    - 'redacted'
    - 'redacted'
bluetoothLowEnergy:
  whitelist:
    - redacted
  maxDistance: 4
  tagOverrides:
    redacted:
      name: Andrea Flex 2
      measuredPower: -61

@SeLLeRoNe
Copy link
Author

I think I also managed to clean nodejs on the RPi3 now.. I've made a clean installa nd I got:

[~/room-assistant]
>room-assistant
/usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:844
    throw new Error("Cannot parse config file: '" + fullFilename + "': " + e3);
    ^

Error: Cannot parse config file: 'config/local.xml': Error: Cannot find module 'x2js'
Require stack:
- /usr/local/lib/node_modules/room-assistant/node_modules/config/parser.js
- /usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js
- /usr/local/lib/node_modules/room-assistant/dist/app.module.js
- /usr/local/lib/node_modules/room-assistant/dist/main.js
- /usr/local/lib/node_modules/room-assistant/bin/room-assistant.js
    at Config.util.parseFile (/usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:844:11)
    at /usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:644:26
    at Array.forEach (<anonymous>)
    at Config.util.loadFileConfigs (/usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:643:16)
    at new Config (/usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:116:27)
    at Object.<anonymous> (/usr/local/lib/node_modules/room-assistant/node_modules/config/lib/config.js:1492:31)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)

I've tried to install it using:
sudo npm i --global --unsafe-perm x2js

But this time didn't fix... it's becoming a quest to fix this mess :D

@SeLLeRoNe
Copy link
Author

Ok.. I am an IDIOT!

I was wondering why the file was an xml but the code inside did look more like YAML...
I miss-read the extension filename and I did write xml instead of yml!!!!

That fixed all the issues........ I am so sorry for the waste of time

@SeLLeRoNe
Copy link
Author

Now the question would be.. how the hell was it working before? But I really do not care XD
I'll test it now and I'll get back to you regarding the actual topic of the issue

@SeLLeRoNe
Copy link
Author

Side note, with latest version I got an error for invalid "cluster" config

The config is the one I posted earlier today

@mKeRix
Copy link
Owner

mKeRix commented Mar 15, 2021

Oh wow - yeah, that makes sense. It's always the tiniest issues that cause the most trouble. 😄 Thanks for posting the solution in this thread.

The cluster issue you mentioned is just a friendly warning that your config is formatted slightly wrong - room-assistant will still work like before (by ignoring the wrong options), but this lovely feature by @PeteBa makes the issues more transparent. Try to make your config look more like this (cluster & entities on top-level):

global:
  instanceName: "Master Bedroom"
  integrations:
    - bluetoothClassic
    - bluetoothLowEnergy
    - homeAssistant
cluster:
  autoDiscovery: false
  networkInterface: eth0
  port: 6425
  peerAddresses:
    - redacted:6425 # Living Room
    - redacted:6425 # Studio
    - redacted:6425 # Master Bedroom
    - redacted:6425 # Luca's Bedroom
entities:
  behaviors:
    d6t_occupancy_count:
      debounce:
        wait: 0.75
        maxWait: 2

@SeLLeRoNe
Copy link
Author

I see, I tought those 2 elements were part of glonal

@SeLLeRoNe
Copy link
Author

I've tried to test the BLE one but that doesn't work with my phone (not really sure it should).
The Classic one doesn't have the name mapping (which I would say it should have for the reason I opened the ticket :) )
But one thing it's driving me nuts is:
My phone is on my desk, right next ot me and next to an Room Assistant instance (like 25cm apart), and yet my phone appear to be in the next room (instance at about 2.5m from the phone), am I doing something wrong?

@SeLLeRoNe
Copy link
Author

SeLLeRoNe commented Mar 16, 2021

If I set it that way (I did actually try this yesterday but didn't work, that's why I thought it was part of global), I get:

16/03/2021, 10:10:00 - error - ExceptionHandler: Cannot read property 'address' of undefined

@mKeRix
Copy link
Owner

mKeRix commented Mar 17, 2021

The id option for BT Classic will at least allow you to hide your MAC address from your HA configs, as it will alter the generated topics and entity IDs. Extending these options to also include name overrides is a good idea regardless, I think I'll look at that together with #596.

As for the location detection, that is hard to say without more details. I'd recommend to look at the API to determine why exactly this issue appears - is it because there are no recent readings from the closer node or because the RSSI strength is just better on that one? It could also be that this is because of different antennas on your two Pis, which could make one report less signal strength even though it is closer. If that is the case I could add a scaling setting, which would let you manually adjust this.

I just quickly scanned through where the address access might happen - could you try removing the networkInterface option? It could be that it doesn't correctly find or map that interface, which would lead to it not finding its IP address. Since that option wasn't in effect before I suppose the default was working fine as well.

@SeLLeRoNe
Copy link
Author

Hi,

The "networkInterface" was the cause of the reported error indeed, you might want to remove it from the sample in the docs maybe?:
image

For what concern the "id", it was quite hard to find the Bluetooth Classic documentation (maybe direct link in the left-menu would be helpful for many), but once I found it I can confirm it works.

I use also the "availability" to know when Room Assistant is offline (in order to exclude those sensors from the automations and/or person location), but there is a problem with that in my opinion, right now the system is creating a sensor for each "instance", but not a "general" sensor whic is false when all Room Assistant are offline rather than having only a per--room/per-instance value.

For what concern the device "positioning" and specs, my current setup is:
1 Intel NUC (which runs HA aswell)
1 Raspberry Pi 3
2 Raspberry W Zero

The one in my office is the Intel NUC, now even understanding your logic about antennas and such, I really find hard to believe that 10/15cm can get a worse signal than 2/3mt.

I will investigate the API as suggeted to see what are reporting.

Thanks
Andrea

@SeLLeRoNe
Copy link
Author

For what concern the NUC, this is likely to be the cause:

3/18/2021, 12:22:20 PM - error - BluetoothClassicService: Failed to retrieve RSSI for XX:XX:XX:XX:XX:XX: Trying to lock adapter 0 even though it is already locked

As menthioned, this is on the same instance of HA, I think this might be caused by HA getting MiFlora informations.
The reason why I am not using in within HA the Bluetooth Device Tracker is because that will not provide a per-room value, which is what I am trying to achieve with Room Assistant of course :)

I've now disabled the MiFlora sensor from HA but the problem (HA and RA restarted) seems to be the same.

mKeRix added a commit that referenced this issue Mar 18, 2021
It's only meant to be an advanced option and might cause confusion, as
discussed in #433.
@mKeRix
Copy link
Owner

mKeRix commented Mar 18, 2021

Yeah, networkInterface is only meant to be an advanced option. I've just pushed a commit that removes it from the docs example to avoid confusion in the future.

The availability thing is an issue indeed, it's a tricky one to solve as you cannot really trust that you are the last instance (there might be split cluster issues for example), which is why there is no availability on the shared sensors yet. #181 is an open request to implement this in a nice way. Until then I suppose you could workaround the issues by looking at the instance sensors (e.g. cluster size of each instance), because those will be marked as unavailable on shutdown.

While multiple applications using the same Bluetooth adapter might cause weird behavior, the locking message you posted is actually a room-assistant internal tool. Essentially room-assistant marks an adapter as "locked" internally whenever it starts active requests on it (e.g. BT Classic scan, companion app discovery), which will cause BLE scanning and advertising to be stopped. This is done because most adapters cannot handle doing those both at the same time. In addition to that a locked adapter will refuse to take on another active command, so the system doesn't launch multiple requests. In your case it could be that the Bluetooth adapter is somehow stuck and doesn't provide responses anymore. Did you already try to reboot the NUC completely?

Since we're now discussing tangential stuff I'll go ahead and close this issue in favor of the other one I linked above to improve the override behavior even further.

@mKeRix mKeRix closed this as completed Mar 18, 2021
@SeLLeRoNe
Copy link
Author

Sure, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants