mKeRix / room-assistant

Presence tracking and more for automation on the room-level
https://www.room-assistant.io
MIT License
1.28k stars 122 forks source link

All devices unavailable in Home Assistant #728

Closed martynhr closed 3 years ago

martynhr commented 3 years ago

Updated on Home Assistant

All devices now unavailable: BLE devices are found in log and added via MQTT integration but remain unavailable.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. [23:45:03] INFO: Setting up Home Assistant configuration [23:45:03] INFO: Copying room-assistant configuration from /config/room_assistant [23:45:03] INFO: Starting room-assistant WARNING The program 'node' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/blog/projects/avahi-compat.html WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/blog/projects/avahi-compat.html [Nest] 187 - 05/24/2021, 11:45:04 PM [HealthIndicatorService] Could not load sd-notify: Cannot find module 'sd-notify' Require stack:

mKeRix commented 3 years ago

Have you tried restarting Home Assistant already? The entity configuration changed slightly, possibly HA can't deal with that completely without restarting.

martynhr commented 3 years ago

Yes tried rebooting a few times, I have rolled back to the previous version for now and all came back.

I did notice that everything after

"[Nest] 187 - 05/24/2021, 11:45:04 PM [HealthIndicatorService] Could not load sd-notify: Cannot find module 'sd-notify' Require stack"

in the log (in version 2.18) is in italics if that's any help. FYI, I'm running HA OS on an Intel NUC if that makes any difference. I'm happy to update again if you want to try anything.

adamrutt commented 3 years ago

I am getting the same when upgrading to 2.18.0

fahimi73 commented 3 years ago

I also have same problem after upgrade to 2.18.0

AML225 commented 3 years ago

I am also having this problem after upgrading to 2.18.0

hugalafutro commented 3 years ago

Running docker on rpi3 and pi zero, last version that works for me is mkerix/room-assistant:2.17.0. :latest (2.18 atm) seems to work ok from r-a logs, but the entities in home-assistant are unavailable. Some restarting of the r-a container can get the cluster size/leader entities up, but the presence/tracker sensors remain unavailable. (I restarted the ha container too, it didn't help) Rebuilding with 2.17 instantly brings the entities up.

draiko commented 3 years ago

Same problem. Everything unavailable in HA after upgrade to 2.18. Problem persists after reboot. Haven't checked my log files yet.

Correction: I set a different cluster leader and everything blipped up. I have to version check what I'll have on the leader later

wklink commented 3 years ago

Rolling back to 2.17.0 resolved the issue in Home Assistant for me.

mew0717 commented 3 years ago

I just installed yesterday for the first time to 2.18 using a raspberry pi 0 quickstart guide.. How do you roll it back a version?

martynhr commented 3 years ago

I just installed yesterday for the first time to 2.18 using a raspberry pi 0 quickstart guide.. How do you roll it back a version?

I used a snapshot but only ticked Room assistant.

rybackisback commented 3 years ago

I rolled back to 2.17.0 on my pi and it entities in HA appear to be working.

rrosson commented 3 years ago

Saw this after I went to 2.18 on all my nodes. HA is running natively on a NUC and I have pi-zeros (5) spread around the property.

mKeRix commented 3 years ago

I would appreciate it if one of you with the issues could provide some debug info from MQTT for me:

If you don't have a separate MQTT client you can also query this from the Integrations page in Home Assistant, simply click Configure on the MQTT integration and use the "Listen to topic" feature toward the bottom of that page.

I've been running this version on my own 5-node cluster for around a week now without issues, I also upgraded from v2.17.0 - so I'm not sure how to reproduce your issues yet.

rybackisback commented 3 years ago

I would appreciate it if one of you with the issues could provide some debug info from MQTT for me:

  • what do your entity configs (esp. the availability property) look like in homeassistant/+/room-assistant/+/config?
  • what do the topics that are mentioned in the config have as values? (should be one topic that looks like room-assistant/status/<instancename> and another like room-assistant/sensor/<entityname>/status)

If you don't have a separate MQTT client you can also query this from the Integrations page in Home Assistant, simply click Configure on the MQTT integration and use the "Listen to topic" feature toward the bottom of that page.

I've been running this version on my own 5-node cluster for around a week now without issues, I also upgraded from v2.17.0 - so I'm not sure how to reproduce your issues yet.

I have only noticed entities becoming unavailable once I restart home assistant. I have now reloaded v2.18.0 and will monitor mqtt/ha logs. See ha error log after updating to 2.18.0: Logger: homeassistant.util.logging Source: util/logging.py:105 First occurred: 7:03:05 AM (4 occurrences) Last logged: 7:03:14 AM Exception in discovery_callback when dispatching 'mqtt_discoveryupdated('device_tracker', 'room-assistant bluetooth-classic-android-phone-tracker')': ({'availability_mode': 'all', 'name': 'OnePlus8ProBT Tracker', 'device': {'identifiers': 'XXXX', 'name': 'OnePlus8ProBT', 'connections': [{'0': 'mac', '1': 'XXXX'}], 'via_device': 'room-assistant-distributed'}, 'unique_id': 'room-assistant-bluetooth-classic-android-phone-tracker', 'state_topic': 'room-assistant/device_tracker/bluetooth-classic-android-phone-tracker/state', 'json_attributes_topic': 'room-assistant/device_tracker/bluetooth-classic-android-phone-tracker/attributes', 'payload_home': 'home', 'payload_not_home': 'not_home', 'source_type': 'bluetooth', 'availability': [{'topic': 'room-assistant/device_tracker/bluetooth-classic-android-phone-tracker/status', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'room-assistant/status/garage-pi', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 418, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 561, in discovery_update config = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected a list @ data['device']['connections'][0] Exception in discovery_callback when dispatching 'mqtt_discoveryupdated('sensor', 'room-assistant bluetooth-classic-android-phone')': ({'availability_mode': 'all', 'name': 'OnePlus8ProBT Room Presence', 'device': {'identifiers': 'XXXX', 'name': 'OnePlus8ProBT', 'connections': [{'0': 'mac', '1': 'XXXX'}], 'via_device': 'room-assistant-distributed'}, 'unique_id': 'room-assistant-bluetooth-classic-android-phone', 'state_topic': 'room-assistant/sensor/bluetooth-classic-android-phone/state', 'json_attributes_topic': 'room-assistant/sensor/bluetooth-classic-android-phone/attributes', 'icon': 'mdi:bluetooth', 'availability': [{'topic': 'room-assistant/sensor/bluetooth-classic-android-phone/status', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'room-assistant/status/garage-pi', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 418, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 561, in discovery_update config = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected a list @ data['device']['connections'][0] Exception in discovery_callback when dispatching 'mqtt_discoveryupdated('device_tracker', 'room-assistant bluetooth-classic-apple-phone-tracker')': ({'availability_mode': 'all', 'name': 'iPhoneXRBT Tracker', 'device': {'identifiers': 'XXXX', 'name': 'iPhoneXRBT', 'manufacturer': 'Apple, Inc.', 'connections': [{'0': 'mac', '1': 'XXXX'}], 'via_device': 'room-assistant-distributed'}, 'unique_id': 'room-assistant-bluetooth-classic-apple-phone-tracker', 'state_topic': 'room-assistant/device_tracker/bluetooth-classic-apple-phone-tracker/state', 'json_attributes_topic': 'room-assistant/device_tracker/bluetooth-classic-apple-phone-tracker/attributes', 'payload_home': 'home', 'payload_not_home': 'not_home', 'source_type': 'bluetooth', 'availability': [{'topic': 'room-assistant/device_tracker/bluetooth-classic-apple-phone-tracker/status', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'room-assistant/status/garage-pi', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 418, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 561, in discovery_update config = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected a list @ data['device']['connections'][0] Exception in discovery_callback when dispatching 'mqtt_discoveryupdated('sensor', 'room-assistant bluetooth-classic-apple-phone')': ({'availability_mode': 'all', 'name': 'iPhoneXRBT Room Presence', 'device': {'identifiers': 'XXXX', 'name': 'iPhoneXRBT', 'manufacturer': 'Apple, Inc.', 'connections': [{'0': 'mac', '1': 'XXXX'}], 'via_device': 'room-assistant-distributed'}, 'unique_id': 'room-assistant-bluetooth-classic-apple-phone', 'state_topic': 'room-assistant/sensor/bluetooth-classic-apple-phone/state', 'json_attributes_topic': 'room-assistant/sensor/bluetooth-classic-apple-phone/attributes', 'icon': 'mdi:bluetooth', 'availability': [{'topic': 'room-assistant/sensor/bluetooth-classic-apple-phone/status', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'room-assistant/status/garage-pi', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 418, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 561, in discovery_update config = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected a list @ data['device']['connections'][0]

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.18.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

mKeRix commented 3 years ago

@rybackisback Thank you for providing the error message! That allowed me to reproduce and fix this bug.

rybackisback commented 3 years ago

@rybackisback Thank you for providing the error message! That allowed me to reproduce and fix this bug.

Thanks for the quick fix.

hugalafutro commented 3 years ago

Hi, thanks for the fix, I wonder if the entity is supposed to show these though: room-assistant edit: hmm nevermind it's not showing it after some time.

regoras commented 3 years ago

I'm continuing to experience this in 2.18.1 in HA Supervised (on Debian VM) core 2.5.5, supervisor 2021.04.3.

RA API is reporting proper and correct statuses for the entities (one BLE and one BT across 2 nodes, one on HA and one on a Pi Zero). Both the device trackers and the presence sensors report unavailable. The Pi Zero node also reports unavailable, weirdly. The logs for RA all appear normal, with successful MQTT connections, successful leader selection, and successful device discovery.

Reverting to 2.17 immediately fixes the issue. I've tried the upgrade to 2.18.1 a few times now, including with restarts. I've also reinstalled and restarted my MQTT broker, thinking that was the issue. Nothing seems to make 2.18.1 work for me.

mKeRix commented 3 years ago

@hugalafutro I've pushed a fix for this issue just now, will be included in a new patch version sometime this weekend.

@regoras Do you see any error logs regarding the RA MQTT entities in Home Assistant? Can you pull the availability data and entity configs off MQTT for me (see a few posts above)?

regoras commented 3 years ago
availability_mode: all
name: bedroom_area Cluster Leader
device:
  sw_version: 2.18.1
  identifiers: bedroom-area
  name: bedroom_area
  model: Docker Container
  manufacturer: QEMU
unique_id: room-assistant-bedroom-area-status-cluster-leader
state_topic: room-assistant/sensor/bedroom-area-status-cluster-leader/state
json_attributes_topic: room-assistant/sensor/bedroom-area-status-cluster-leader/attributes
icon: 'mdi:account-group'
availability:
  - topic: room-assistant/sensor/bedroom-area-status-cluster-leader/status
    payload_available: online
    payload_not_available: offline
  - topic: room-assistant/status/bedroom_area
    payload_available: online
    payload_not_available: offline
platform: mqtt

Everything else appears to be reporting nominally. Status on the HA instance of RA is reporting online for everything with quorum_reached as true. Let me know if I grabbed the right values or if you need something else. I rolled the Pi Zero back to 2.17.0 so it probably wouldn't be a useful data point.

mKeRix commented 3 years ago

For the availability to work correctly all instances need to be on 2.18.x - in general it is recommended to not run multiple versions of room-assistant within one cluster. The entity config that you posted looks to be as expected for 2.18.x though.

Both of these availability topics need to have "online" as their last message to be considered available by Home Assistant. The status messages should be re-sent every 30 seconds as a "heartbeat". If the instance drops from MQTT a last will message will be sent to "room-assistant/status/bedroom_area" (for your example) with a payload of offline, to show that the entities cannot be updated (since the responsible instance lost connection).

hugalafutro commented 3 years ago

I haven't had time to post previously + I couldn't reliably reproduce, but after some HA restart I was getting random unavailable again and I was running combination of 2.17.0 and 2.18.1 which is not good as per above post. However when I updated all to 2.18.1 all became unavailable again. Decided to test with only 1 node to not have to deal with the versions mimatch.

I brought 2/3 room-assistant containers down, then I brought home-assistant container down. Rebuilt the one running room-assistant instance with :latest image Started home-assistant container It half-works: The bluetooth enquiries switch, cluster size/leader entities report state correctly, however every device tracker reports Unavailable.

logs - from starting the r-a container (ble beacons removed to reduce length):

Pulling room-assistant ... done
Recreating room-assistant_fr24 ... done
Attaching to room-assistant_fr24
room-assistant_fr24 | *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
room-assistant_fr24 | *** WARNING *** Please fix your application to use the native API of Avahi!
room-assistant_fr24 | *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
room-assistant_fr24 | *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
room-assistant_fr24 | *** WARNING *** Please fix your application to use the native API of Avahi!
room-assistant_fr24 | *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
room-assistant_fr24 | 5/30/2021, 12:47:33 PM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-classic, bluetooth-low-energy
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - NestFactory: Starting Nest application...
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: AppModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: ConfigModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: NestEmitterModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: IntegrationsModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: HttpModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: DiscoveryModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: PrometheusModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: EventsModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: ClusterModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: TerminusModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: ScheduleModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: BluetoothModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: EntitiesModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: BluetoothLowEnergyModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: HomeAssistantModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:37 PM - info - InstanceLoader: StatusModule dependencies initialized
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RoutesResolver: EntitiesController {/entities}:
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RouterExplorer: Mapped {/entities, GET} route
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RoutesResolver: StatusController {/status}:
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RouterExplorer: Mapped {/status, GET} route
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RoutesResolver: PrometheusController {/metrics}:
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - RouterExplorer: Mapped {/metrics, GET} route
room-assistant_fr24 | 5/30/2021, 12:47:38 PM - info - HomeAssistantService: Successfully connected to MQTT broker at mqtt://192.168.1.228:1883
room-assistant_fr24 | 5/30/2021, 12:47:39 PM - info - ConfigService: Loading configuration from /usr/local/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/local.yml (Current: /room-assistant)
room-assistant_fr24 | 5/30/2021, 12:47:39 PM - info - ClusterService: Starting mDNS advertisements and discovery
room-assistant_fr24 | 5/30/2021, 12:47:39 PM - info - NestApplication: Nest application successfully started
room-assistant_fr24 | 5/30/2021, 12:47:39 PM - info - HomeAssistantService: Refreshing entity states
room-assistant_fr24 | 5/30/2021, 12:47:39 PM - info - ClusterService: home-bedroom-table has been elected as leader

home-assistant log contains nothing apart from the warnings about using hacs integrations.

ha mqtt info for the r-a mqtt device with 2.18.1:

availability_mode: all
name: home_bedroom_table Bluetooth Inquiries
device:
  sw_version: 2.18.1
  identifiers: home-bedroom-table
  name: home_bedroom_table
  model: Docker Container
  manufacturer: ''
unique_id: room-assistant-home-bedroom-table-bluetooth-classic-inquiries-switch
state_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/state
json_attributes_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/attributes
payload_on: 'on'
payload_off: 'off'
state_on: 'true'
state_off: 'false'
command_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/command
icon: 'mdi:bluetooth-audio'
availability:
  - topic: >-
      room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/status
    payload_available: online
    payload_not_available: offline
  - topic: room-assistant/status/home_bedroom_table
    payload_available: online
    payload_not_available: offline
platform: mqtt

ha mqtt info for the cluster size sensor that is working with 2.18.1:

availability_mode: all
name: home_bedroom_table Cluster Size
device:
  sw_version: 2.18.1
  identifiers: home-bedroom-table
  name: home_bedroom_table
  model: Docker Container
  manufacturer: ''
unique_id: room-assistant-home-bedroom-table-status-cluster-size
state_topic: room-assistant/sensor/home-bedroom-table-status-cluster-size/state
json_attributes_topic: room-assistant/sensor/home-bedroom-table-status-cluster-size/attributes
icon: 'mdi:server'
unit_of_measurement: instances
availability:
  - topic: room-assistant/sensor/home-bedroom-table-status-cluster-size/status
    payload_available: online
    payload_not_available: offline
  - topic: room-assistant/status/home_bedroom_table
    payload_available: online
    payload_not_available: offline
platform: mqtt

ha mqtt info for the unavailable tracker with 2.18.1:

availability_mode: all
name: keys_feasybeacon Tracker
device:
  identifiers: fda50693a4e24ff1afcfc6eb07647825-16065-26349
  name: keys_feasybeacon
  via_device: room-assistant-distributed
unique_id: room-assistant-ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker
state_topic: >-
  room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/state
json_attributes_topic: >-
  room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/attributes
payload_home: home
payload_not_home: not_home
source_type: bluetooth_le
availability:
  - topic: >-
      room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status
    payload_available: online
    payload_not_available: offline
  - topic: room-assistant/status/home-bedroom-table
    payload_available: online
    payload_not_available: offline
platform: mqtt

Just rebuilding the single running r-a container with :2.17.0 image without restarting ha immediately brought the trackers online.

ha mqtt ra device info with 2.17.0:

payload_available: online
payload_not_available: offline
name: home_bedroom_table Bluetooth Inquiries
device:
  sw_version: 2.17.0
  identifiers: home-bedroom-table
  name: home_bedroom_table
  model: Docker Container
  manufacturer: ''
unique_id: room-assistant-home-bedroom-table-bluetooth-classic-inquiries-switch
state_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/state
json_attributes_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/attributes
availability_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/status
payload_on: 'on'
payload_off: 'off'
state_on: 'true'
state_off: 'false'
command_topic: >-
  room-assistant/switch/home-bedroom-table-bluetooth-classic-inquiries-switch/command
icon: 'mdi:bluetooth-audio'
platform: mqtt

ha mqtt info for the tracker sensor that is working with 2.17.0:

payload_available: online
payload_not_available: offline
name: keys_feasybeacon Tracker
device:
  identifiers: fda50693a4e24ff1afcfc6eb07647825-16065-26349
  name: keys_feasybeacon
  via_device: room-assistant-distributed
unique_id: room-assistant-ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker
state_topic: >-
  room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/state
json_attributes_topic: >-
  room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/attributes
availability_topic: >-
  room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status
payload_home: home
payload_not_home: not_home
source_type: bluetooth_le
platform: mqtt

Phew. No idea if any of those are useful, feel free to remove them to declutter. Alternatively let me know if you need more.

mKeRix commented 3 years ago

@hugalafutro Thanks for the detailed report! Given that your local entities (e.g. cluster info sensors) work, but the distributed ones (BT tracker) don't, I wonder if something is off with the handling of distributed devices. In your single instance experiment all entities had room-assistant/status/home-bedroom-table as a status topic, which therefore should contain the right state as some entities successfully were marked as available. The other availability topic of the non-functioning tracker is room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status and likely the cause of the mysteriously unavailable entity.

Since the entity config was already updated in the new format that means the tag must've been discovered and registered while you were running 2.18.1, which would let us rule out Bluetooth issues. Did you receive any messages at all on room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status when running 2.18.1? Leave the subscription running for about a minute to be sure, it should receive a message with online every 30s.

hugalafutro commented 3 years ago

Since i was swapping between :latest and :2.17.0 when recreating the container it pulled the 2.18.2 you updated just now, the behaviour is still the same as 2.18.1 though.

listening to room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status with 2.18.2 running I get:

Message 3 received on room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status at 13:52:
online
QoS: 0 - Retain: false
Message 2 received on room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status at 13:51:
online
QoS: 0 - Retain: false
Message 1 received on room-assistant/device_tracker/ble-fda50693a4e24ff1afcfc6eb07647825-16065-26349-tracker/status at 13:51:
online
QoS: 0 - Retain: false
hugalafutro commented 3 years ago

When I return to 2.17.0 I noticed the room-asistant/status/home_bedroom_table topic goes away, while on 2.18.2 it never receives any messages ra-ha

mKeRix commented 3 years ago

Hm, interesting. The room-asistant/status/home_bedroom_table topic is new in 2.18.x, so It's expected that it wouldn't show in 2.17.0 - but it's definitely not expected that it doesn't receive any messages. The only difference between entity and instance status messages in the code is the QoS that they are sent with - instance messages are sent with QoS 1, entity ones with QoS 0. Unfortunately I still haven't been able to reproduce this locally, but I'll try some more a bit later.

hugalafutro commented 3 years ago

No worries, let me know if you need any more logs/testing.

mKeRix commented 3 years ago

I just looked at it again with a fresh eye and noticed something: your instance is named home_bedroom_table and the two sensors that were working used room-assistant/status/home_bedroom_table for the status topic (matching snake case). The distributed entity however differs from that, using room-assistant/status/home-bedroom-table (kebab case). I suspect that this has to do with the two different sources from which the instance name is fetched - I'm investigating this more deeply now, but wanted to already give an interim update.

mKeRix commented 3 years ago

A fix for this issue is included in 2.18.3 - could you give that a shot once the Docker images have finished building @hugalafutro?

hugalafutro commented 3 years ago

I again brought down 2/3 ra containers and recreated 1 with 2.18.3 and funny thing - now the trackers work, but the cluster entities are unavailable 😄 I'm getting lost in all the logs let me know which ones would be useful for you to narrow this down.

mKeRix commented 3 years ago

Yeah, that's my bad - was so focussed on the broken entities that I forgot checking the entities that were working before. I just triggered another release which should fix the issue with the local entities, the Docker images should be available in about 25min I think.

hugalafutro commented 3 years ago

2.18.4 is golden, I updated all 3 instances to it and everything is good, thanks for your efforts!