question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cluster nodes unreliable and stop reporting presence

See original GitHub issue

Describe the bug I am having difficulty getting reliable presence reports from my nodes.

I am running 4 nodes, each on Raspberry Pis:

  1. Raspberry Pi 4 - Ethernet, Home Assistant plugin
  2. Raspberry Pi 3 - Ethernet, NodeJS
  3. Raspberry Pi Zero W - Wifi, NodeJS
  4. Raspberry Pi Zero W - Wifi, NodeJS

Only the Raspberry Pi 4 reliably reports presence. The remaining will inevitably stop reporting presence to Home Assistant after a few hours. It’s not clear to me what is causing this, but a reset of the pi will temporarily resolve it.

I reinstall the whole system about a week ago (with a fresh Home Assistant install) and followed the quick start guide.

To reproduce Start configuration, wait.

Relevant logs

● room-assistant.service - room-assistant service
   Loaded: loaded (/etc/systemd/system/room-assistant.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-10-26 18:24:05 AEDT; 11min ago
 Main PID: 5626 (node)
   CGroup: /system.slice/room-assistant.service
           ├─5626 node /opt/nodejs/bin/room-assistant
           ├─5857 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5861 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5865 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5869 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5873 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5877 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5881 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           ├─5885 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX
           └─5925 hcitool -i hci0 cc XX:XX:XX:XX:XX:XX

Oct 26 18:24:30 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:24:30 PM - info - NestApplication: Nest application successfully started
Oct 26 18:24:32 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:24:32 PM - info - HomeAssistantService: Device tracker requires manual setup in Home Assistant with topic: room-assistant/device_tracker/bluetooth-classic-xx
Oct 26 18:28:54 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:28:54 PM - info - ClusterService: bedroom has been elected as leader
Oct 26 18:33:11 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:11 PM - info - ClusterService: Removed 192.168.1.207:6425 from the cluster with id bedroom
Oct 26 18:33:12 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:12 PM - info - ClusterService: Removed 192.168.1.207:6425 from the cluster with id bedroom
Oct 26 18:33:12 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:12 PM - info - ClusterService: Removed 192.168.1.207:6425 from the cluster with id bedroom
Oct 26 18:33:18 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:18 PM - info - ClusterService: Added 192.168.1.207:6425 to the cluster with id bedroom
Oct 26 18:33:18 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:18 PM - info - ClusterService: bedroom has been elected as leader
Oct 26 18:33:19 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:19 PM - info - ClusterService: kitchen has been elected as leader
Oct 26 18:33:44 RoomAssistantKids room-assistant[5626]: 10/26/2020, 6:33:44 PM - info - HomeAssistantService: Device tracker requires manual setup in Home Assistant with topic: room-assistant/device_tracker/bluetooth-classic-xx

Relevant configuration Paste the relevant parts of your configuration below.

global:
  instanceName: Kitchen
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://xxx:xxx:xxx:xxx:1883'
  mqttOptions:
    username: homeassistant
    password: xxx
bluetoothClassic:
  addresses:
    - 'XX:XX:XX:XX:XX:XX'
    - 'XX:XX:XX:XX:XX:XX'
cluster:
  networkInterface: eth0
  quorum: 3
  port: 6425
  peerAddresses:
    - 'xxx:xxx:xxx:xxx:6425'
    - 'xxx:xxx:xxx:xxx:6425'
    - 'xxx:xxx:xxx:xxx:6425'
  weight: 5

Environment

  • room-assistant version: 2.11.0
  • installation type: NodeJS, Hass.io
  • hardware: Raspberry Pi 4, Raspberry Pi 3, Raspberry Pi Zero W
  • OS: Linux, Mac

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
mKeRixcommented, Nov 4, 2020

The Bluetooth Classic detection has this workflow:

  • leader instance does a 1:1 mapping of available room-assistant instances and tracked devices (based on local config)
  • leader instance sends out requests for RSSI inquiry to these mapped instances
  • each instance performs its inquiry task and broadcasts findings to all nodes it is connected to
    • the inquiry is forced to run at max scanTimeLimit long
  • instances received inquired values and save them into a local cache along with the current timestamp
    • each node has its own cache and is capable of making a state decision on its own
    • this decision may be different (depending on the state of the cache), but will at most times be the same on all nodes
  • state updates determine the current value by checking who is closest, not out of range (minRssi) and within the timeframe of timeoutCycles
    • state update is performed on each received measurement and every second (e.g. for when a device is not in reach, as then there wouldn’t be any reported RSSIs)
    • only a leader instance reports its state to MQTT/Home Assistant
  • this flow is repeated every interval seconds

Does that answer your questions?

1reaction
Larsaeaeaecommented, Nov 22, 2020

This was definitely my problem, now its working like should, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.2. Cluster Options - ClusterLabs
Option Default Description symmetric‑cluster TRUE Can all resources run on any node by default? stop‑all‑resources FALSE Should the cluster stop all resources? stop‑orphan‑resources TRUE Should deleted...
Read more >
Cluster fault detection | Elasticsearch Guide [8.5] | Elastic
Cluster fault detectionedit ... The elected master periodically checks each of the nodes in the cluster to ensure that they are still connected...
Read more >
Clustering and Network Partitions - RabbitMQ
Stop all nodes in the other partitions, then start them all up again. When they rejoin the cluster they will restore state from...
Read more >
Cluster nodes in a Dependency Views map
Dependency Views maps can display cluster group nodes alongside individual CI nodes, and the child nodes of these cluster groups.
Read more >
Automatic Remediation of Kubernetes Nodes
Unhappy Nodes · Cordon off the affected node to prevent new workloads from scheduling on it. · Collect any diagnostic information for later ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found