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

Problems running room-assistant on Raspberry Pi Zero #351

Closed
swissmaster1 opened this issue Nov 19, 2020 · 62 comments
Closed

Problems running room-assistant on Raspberry Pi Zero #351

swissmaster1 opened this issue Nov 19, 2020 · 62 comments

Comments

@swissmaster1
Copy link

Describe the bug
I run room-assistant on two Raspberry Pi Zero. After every reboot everything is running like a charm. But after some random time room-assistant doesn't report as normaly. When I check the status of the service it tells me on both devices that room-assistant is still running. In the logs I can't see nothing special. When I then reboot both devices everthing is working again for some time. I tried everthing on a 3rd Raspberry Pi Zero with a complete new installation and room-assistant with same result.
Yesterday things stopped working on 22:10 in the evening. When I check the status of room-assistant it says me that room-assistant is still running but after that time there is no output when I do this command 'journalctl -u room-assistant.service'

Whats wrong? Is it only a problem of me or is it a bug? What means this error - ClusterService: getaddrinfo -3008 and what can I do against that?
Once I got the error: BluetoothClassicService: Failed to retrive RSSI for xyz Trying to lock adapter 0 even though it is already locked. Could this have something to do with that?

When I check home assistant entities I can see the entity of my iphone which I configured in room assistant. It has normaly the state of the room I am. But anyway room-assistant log tells me that:
HomeAssistantService: Device tracker requires manual setup in Home Assistant with topic: room-assistant/device_tracker/bluetooth-classic-c0-9a-d0-f1-8e-c1-tracker/state
Do I really have to configure something else? If yes what do I have to setup in home assistant?

My DNS server is configured to use *.local domain.

Relevant logs
This is what the log says.

Nov 17 10:29:29 keller systemd[1]: Started room-assistant service.
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Nov 17 10:29:52 keller node[250]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 17 10:29:52 keller room-assistant[250]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 17 10:29:52 keller node[250]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 17 10:29:52 keller node[250]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 17 10:29:52 keller node[250]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Nov 17 10:29:52 keller node[250]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 17 10:29:52 keller node[250]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 17 10:29:57 keller room-assistant[250]: 11/17/2020, 10:29:57 AM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-classic
Nov 17 10:30:19 keller room-assistant[250]: 11/17/2020, 10:30:19 AM - info - NestFactory: Starting Nest application...
Nov 17 10:30:20 keller room-assistant[250]: 11/17/2020, 10:30:20 AM - info - InstanceLoader: AppModule dependencies initialized
Nov 17 10:30:20 keller room-assistant[250]: 11/17/2020, 10:30:20 AM - info - InstanceLoader: ConfigModule dependencies initialized
Nov 17 10:30:20 keller room-assistant[250]: 11/17/2020, 10:30:20 AM - info - InstanceLoader: NestEmitterModule dependencies initialized
Nov 17 10:30:20 keller room-assistant[250]: 11/17/2020, 10:30:20 AM - info - InstanceLoader: IntegrationsModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: HttpModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: DiscoveryModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: ClusterModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: TerminusModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: BluetoothModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: ScheduleModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: EntitiesModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: HomeAssistantModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
Nov 17 10:30:21 keller room-assistant[250]: 11/17/2020, 10:30:21 AM - info - InstanceLoader: StatusModule dependencies initialized
Nov 17 10:30:24 keller room-assistant[250]: 11/17/2020, 10:30:24 AM - info - RoutesResolver: EntitiesController {/entities}:
Nov 17 10:30:24 keller room-assistant[250]: 11/17/2020, 10:30:24 AM - info - RouterExplorer: Mapped {/entities, GET} route
Nov 17 10:30:24 keller room-assistant[250]: 11/17/2020, 10:30:24 AM - info - RoutesResolver: StatusController {/status}:
Nov 17 10:30:24 keller room-assistant[250]: 11/17/2020, 10:30:24 AM - info - RouterExplorer: Mapped {/status, GET} route
Nov 17 10:30:26 keller room-assistant[250]: 11/17/2020, 10:30:26 AM - info - HomeAssistantService: Successfully connected to MQTT broker at mqtt://192.168.1.30:1883
Nov 17 10:30:26 keller room-assistant[250]: 11/17/2020, 10:30:26 AM - info - ConfigService: Loading configuration from /opt/nodejs/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/local.yml
Nov 17 10:30:27 keller room-assistant[250]: 11/17/2020, 10:30:27 AM - info - ClusterService: Starting mDNS advertisements and discovery
Nov 17 10:30:27 keller room-assistant[250]: 11/17/2020, 10:30:27 AM - info - NestApplication: Nest application successfully started
Nov 17 10:30:27 keller room-assistant[250]: 11/17/2020, 10:30:27 AM - info - HomeAssistantService: Device tracker requires manual setup in Home Assistant with topic: room-assistant/device_tracker/bluetooth-classic-c0-9a-d0-f1-8e-c1-tracker/state
Nov 17 10:30:27 keller room-assistant[250]: 11/17/2020, 10:30:27 AM - error - ClusterService: getaddrinfo -3008
Nov 17 10:30:27 keller room-assistant[250]: 11/17/2020, 10:30:27 AM - error - ClusterService: getaddrinfo -3008
Nov 17 12:08:44 keller room-assistant[250]: 11/17/2020, 12:08:44 PM - error - ClusterService: getaddrinfo -3008
Nov 17 12:08:55 keller room-assistant[250]: 11/17/2020, 12:08:55 PM - error - ClusterService: getaddrinfo -3008
Nov 17 14:22:37 keller room-assistant[250]: 11/17/2020, 2:22:37 PM - error - ClusterService: getaddrinfo -3008
Nov 17 17:08:29 keller room-assistant[250]: 11/17/2020, 5:08:29 PM - info - ClusterService: Removed 192.168.1.60:6425 from the cluster with id schlafzimmer
Nov 17 17:08:29 keller room-assistant[250]: 11/17/2020, 5:08:29 PM - info - ClusterService: keller has been elected as leader
Nov 17 17:08:29 keller room-assistant[250]: 11/17/2020, 5:08:29 PM - info - EntitiesService: Refreshing entity states
Nov 17 17:12:29 keller room-assistant[250]: 11/17/2020, 5:12:29 PM - info - ClusterService: schlafzimmer has been elected as leader
Nov 17 17:12:29 keller room-assistant[250]: 11/17/2020, 5:12:29 PM - info - ClusterService: schlafzimmer has been elected as leader
Nov 17 17:12:29 keller room-assistant[250]: 11/17/2020, 5:12:29 PM - info - ClusterService: schlafzimmer has been elected as leader
Nov 18 02:42:33 keller room-assistant[250]: 11/18/2020, 2:42:33 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:42:33 keller room-assistant[250]: 11/18/2020, 2:42:33 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:42:43 keller room-assistant[250]: 11/18/2020, 2:42:43 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:42:43 keller room-assistant[250]: 11/18/2020, 2:42:43 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:58:35 keller room-assistant[250]: 11/18/2020, 2:58:35 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:58:35 keller room-assistant[250]: 11/18/2020, 2:58:35 AM - error - ClusterService: getaddrinfo -3008
Nov 18 02:58:35 keller room-assistant[250]: 11/18/2020, 2:58:35 AM - error - ClusterService: getaddrinfo -3008
Nov 18 04:23:39 keller room-assistant[250]: 11/18/2020, 4:23:39 AM - error - ClusterService: getaddrinfo -3008
Nov 18 04:23:50 keller room-assistant[250]: 11/18/2020, 4:23:50 AM - error - ClusterService: getaddrinfo -3008
Nov 18 04:24:03 keller room-assistant[250]: 11/18/2020, 4:24:03 AM - info - HomeAssistantService: Re-connected to broker
Nov 18 04:24:03 keller room-assistant[250]: 11/18/2020, 4:24:03 AM - info - EntitiesService: Refreshing entity states
Nov 18 04:34:40 keller room-assistant[250]: 11/18/2020, 4:34:40 AM - error - ClusterService: getaddrinfo -3008
Nov 18 04:34:52 keller room-assistant[250]: 11/18/2020, 4:34:52 AM - error - ClusterService: getaddrinfo -3008
Nov 18 04:37:40 keller room-assistant[250]: 11/18/2020, 4:37:40 AM - error - ClusterService: getaddrinfo -3008
Nov 18 10:59:29 keller room-assistant[250]: 11/18/2020, 10:59:29 AM - info - ClusterService: Removed 192.168.1.60:6425 from the cluster with id schlafzimmer
Nov 18 10:59:29 keller room-assistant[250]: 11/18/2020, 10:59:29 AM - info - ClusterService: keller has been elected as leader
Nov 18 10:59:29 keller room-assistant[250]: 11/18/2020, 10:59:29 AM - info - EntitiesService: Refreshing entity states
Nov 18 11:03:12 keller room-assistant[250]: 11/18/2020, 11:03:12 AM - info - ClusterService: schlafzimmer has been elected as leader
Nov 18 17:02:35 keller room-assistant[250]: 11/18/2020, 5:02:35 PM - info - ClusterService: Removed 192.168.1.60:6425 from the cluster with id schlafzimmer
Nov 18 17:02:36 keller room-assistant[250]: 11/18/2020, 5:02:35 PM - info - ClusterService: keller has been elected as leader
Nov 18 17:02:36 keller room-assistant[250]: 11/18/2020, 5:02:35 PM - info - EntitiesService: Refreshing entity states
Nov 18 17:06:28 keller room-assistant[250]: 11/18/2020, 5:06:28 PM - info - ClusterService: Added 192.168.1.60:6425 to the cluster with id schlafzimmer
Nov 18 17:06:28 keller room-assistant[250]: 11/18/2020, 5:06:28 PM - info - ClusterService: schlafzimmer has been elected as leader

Relevant configuration
My configuration

global:
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.30:1883'
  mqttOptions:
    username:
    password:
bluetoothClassic:
  addresses:
    - 'xyz'

Environment

  • room-assistant version: current
  • installation type: [e.g. NodeJS, Docker, Hass.io]
  • hardware: Raspberry Pi Zero

Additional context
Add any other context about the problem here.

@oz-glenn
Copy link

I installed Room Assistant today on my Raspberry Pi Zero W. I'm having the same experience - it worked for an hour or two, then stopped reporting. Everything looked normal, and only a restart fixed it.

@swissmaster1
Copy link
Author

Do you have an idea why this happened? Did you see something in the log?

@oz-glenn
Copy link

My config:

global:
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://192.168.30.21:1883'
  mqttOptions:
    username: user
    password: password
bluetoothClassic:
  addresses:
    - private
    - private

Logs:

Nov 20 07:40:38 man-cave-rpi systemd[1]: Started room-assistant service.
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 20 07:40:56 man-cave-rpi room-assistant[281]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** Please fix your application to use the native API of Avahi!
Nov 20 07:40:56 man-cave-rpi node[281]: *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Nov 20 07:41:01 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:01 AM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-classic
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - NestFactory: Starting Nest application...
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: AppModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: ConfigModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: NestEmitterModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: IntegrationsModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: HttpModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: DiscoveryModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: ClusterModule dependencies initialized
Nov 20 07:41:07 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:07 AM - info - InstanceLoader: TerminusModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: BluetoothModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: ScheduleModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: EntitiesModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: HomeAssistantModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
Nov 20 07:41:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:08 AM - info - InstanceLoader: StatusModule dependencies initialized
Nov 20 07:41:29 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:29 AM - info - RoutesResolver: EntitiesController {/entities}:
Nov 20 07:41:29 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:29 AM - info - RouterExplorer: Mapped {/entities, GET} route
Nov 20 07:41:29 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:29 AM - info - RoutesResolver: StatusController {/status}:
Nov 20 07:41:29 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:29 AM - info - RouterExplorer: Mapped {/status, GET} route
Nov 20 07:41:33 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:33 AM - info - HomeAssistantService: Successfully connected to MQTT broker at mqtt://192.168.30.21:1883
Nov 20 07:41:33 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:33 AM - info - ConfigService: Loading configuration from /opt/nodejs/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/local.yml
Nov 20 07:41:34 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:34 AM - info - ClusterService: Starting mDNS advertisements and discovery
Nov 20 07:41:34 man-cave-rpi room-assistant[281]: 11/20/2020, 7:41:34 AM - info - NestApplication: Nest application successfully started
Nov 20 07:44:26 man-cave-rpi room-assistant[281]: 11/20/2020, 7:44:26 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:47:33 man-cave-rpi room-assistant[281]: 11/20/2020, 7:47:33 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:48:16 man-cave-rpi room-assistant[281]: 11/20/2020, 7:48:16 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:48:56 man-cave-rpi room-assistant[281]: 11/20/2020, 7:48:56 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:50:08 man-cave-rpi room-assistant[281]: 11/20/2020, 7:50:08 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:50:35 man-cave-rpi room-assistant[281]: 11/20/2020, 7:50:35 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:52:51 man-cave-rpi room-assistant[281]: 11/20/2020, 7:52:51 AM - error - ClusterService: getaddrinfo -3008
Nov 20 07:53:00 man-cave-rpi room-assistant[281]: 11/20/2020, 7:53:00 AM - error - ClusterService: getaddrinfo -3008

There's also repeated errors in the syslog:

Nov 20 07:59:36 man-cave-rpi kernel: [ 1148.979913] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
Nov 20 07:59:42 man-cave-rpi kernel: [ 1154.982730] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
Nov 20 07:59:42 man-cave-rpi kernel: [ 1154.982760] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
Nov 20 07:59:48 man-cave-rpi kernel: [ 1160.981742] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
Nov 20 07:59:48 man-cave-rpi kernel: [ 1160.981766] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
Nov 20 07:59:54 man-cave-rpi kernel: [ 1166.979426] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
Nov 20 07:59:54 man-cave-rpi kernel: [ 1166.979455] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
Nov 20 08:00:00 man-cave-rpi kernel: [ 1172.982103] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
Nov 20 08:00:00 man-cave-rpi kernel: [ 1172.982134] debugfs: File 'le_max_key_size' in directory 'hci0' already present!

The problem is that these errors are present when it's working and nothing seems to change when it stops working.

@mKeRix
Copy link
Owner

mKeRix commented Nov 20, 2020

Both of your logs seem completely fine to me at first glance to be honest, so I'm sorry to hear that it stops working. I have two ideas for further actions:

  • run room-assistant with the -v flag (verbose mode) to get more logs to analyze when this happens
  • downgrade room-assistant to 2.10.1 (sudo npm i --global --unsafe-perm room-assistant@2.10.1)

v2.11.0 was the version that changed quite a few things around how Bluetooth is handled in room-assistant to accommodate running BLE and BT Classic on the same adapter. Since both of you don't require this feature at the moment I wonder if the old version may have been more stable in that regard.

@swissmaster1
Copy link
Author

Today after room-assistant stopped working and didnt recognize my mobile phone anymore I tried something else. I stopped the room-assistant service with sudo systemctl stop room-assistant. After that I started it with room-assistant -v. It started without an error but didnt recognize something (my mobile phone). After I rebooted the raspberry it immediately worked again. Very strange.

@swissmaster1
Copy link
Author

Tried that: downgrade room-assistant to 2.10.1
I did a completly new install (incl. raspbian) with v.2.10.1 and it is not working on both raspberry pi. I got no devices reported with that version to my home assistant instance. And it gave me this error: HomeAssistantService: Cannot add property hash, object is not extensible.
I switched now back to v 2.12.0 and it is running now again. But I still have the problem that it stops working after a random time.

@swissmaster1
Copy link
Author

I let room-assistant run now sometime with "room-assistant -v" to get more information. This morning it stoped working again and I saw alway this output, again and again:
11/22/2020, 7:31:37 AM - debug - BluetoothService: Querying for RSSI of C0:xy:xy:xy:xy:xy using hcitool 11/22/2020, 7:31:40 AM - debug - BluetoothService: Query of C0:xy:xy:xy:xy:xy reached scan time limit, resetting hci0
I then hit Ctrl+C to stop room-assistant. The started it again with room-assistant -v. Everything loaded correctly, no errors reported and also connected to mqtt. But bluetoothservice gave the same outputs as before and didn't recognize my device:
11/22/2020, 7:40:37 AM - debug - BluetoothService: Querying for RSSI of C0:xy:xy:xy:xy:xy using hcitool 11/22/2020, 7:40:40 AM - debug - BluetoothService: Query of C0:xy:xy:xy:xy:xy reached scan time limit, resetting hci0
Then I did a reboot and from this point it looks like it didn't scan for any bluetooth devices (no debug outputs of bluetoothservice). I don't know what is going on. I run nothing else on the pi zero and using a standard configuration.

@mKeRix
Copy link
Owner

mKeRix commented Nov 22, 2020

Hm, these messages are not worrisome in itself, as they always happen when the device isn't in reach of the instance for example. It is possible that the adapter hung up on itself. One quickfix workaround might be to increase interval to 10 and scanTimeLimit to 6, as that will be much less aggressive on the adapter and might prevent it from crashing.

If you happen to see this again, could you also try if running hciconfig hci0 down && hciconfig hci0 up works to fix the issue? You can do it without turning room-assistant off and then just observe.

@swissmaster1
Copy link
Author

I installed room-assistant the same way on a raspberry pi 3. Its now working since more than a day without problems. I'll try it further but for now it looks like raspberry pi zero isn't a good way to run room-assistant.

@swissmaster1
Copy link
Author

hciconfig hci0 down && hciconfig hci0 up didn't change anything on my pi zero's.
I dont see a way to get them constantly runnig without crash. The logs dont give me information to solve the problem. I cant find the reason. I only know that a raspberry pi 3 works with exactly the same setup/configuration. Maybe there are some hardware limitations or so on pi zero?

@oz-glenn
Copy link

I've been waiting until now for it to happen again. I did have the rpi lock up 2 days ago but I'm not sure that was caused by room assistant. Tonight, I went out there and it didn't detect me, but the rpi hadn't locked up. I tried hciconfig hci0 down && hciconfig hci0 up, but that didn't work. I restarted the service. Didn't work. The logs looked normal with no errors and continuing activity. HTOP showed normal CPU/Memory usage.

I restarted and it started working.

@mKeRix
Copy link
Owner

mKeRix commented Nov 25, 2020

I have been running room-assistant on 5 Pi Zero Ws successfully for quite a while now, so I don't think it is a specific hardware problem that affects all. Unfortunately this also makes this really hard to debug and understand. :(

One thing that has helped people in the past is to make sure all the system software and the firmware is up-to-date. You can do that with sudo apt-get update && sudo apt-get upgrade and sudo rpi-update respectively. Is that something you could try?

@swissmaster1
Copy link
Author

Hi Heiko
Thank you for your support. I tried everything. Installed Raspian Buster on 2 Zero's. Upgraded both. Installed room-assistant again as provided on your page. But still not working. But room-assistant on my Pi 3 is still working since a few days.

@oz-glenn
Copy link

As an update, it was working until it locked up again this morning. It took 2 restarts to get it to work again. I've ordered another Pi Zero W, hoping I can narrow down if it's this particular board or not. Now I think of it, I had troubles with it locking up when I tried to run PiHole on it, too. I'll update with results once that arrives in a week or so.

@swissmaster1
Copy link
Author

Room-Assistant still running on Pi 3 since 1 week without problems. Never had to reboot.

Can you maybe make an ISO of your microSD and share that? So we can try if this would work on our Pi Zeros by only change the config file.

@balonchiks
Copy link

i've experienced exactly the same today on a pi zero w, with everything installed from scrath about 2 month ago.

did a sudo apt-get update && sudo apt-get upgrade and sudo rpi-update and restarted - will keep an eye on it's behaviour

room-assistant is the latest version as per npm

@mKeRix
Copy link
Owner

mKeRix commented Dec 5, 2020

Hm, pulling an ISO from one of my running Pis might be a bit tricky since I would have to figure out a way to wipe any personal settings (WiFi passwords etc) from it completely. I've been thinking about this for a little while and have come to the conclusion that I would like to give buildroot a try to generate a custom Linux image with everything pre-configured and pre-installed. Atm I would like to get the current beta (especially the iPhone stuff) to a stable point first, but after that I could imagine tackling this. Maybe something for the Christmas holidays.

@oz-glenn
Copy link

oz-glenn commented Dec 9, 2020

I received my second RPi Zero W yesterday. It lasted a few hours and then stopped detecting. As before the logs give no hints, and restarting the service has no effect. I solved the problem with a sledgehammer on the first RPi Zero W with a cron job to restart every hour, I'm about to do the same with the second one.

@mKeRix
Copy link
Owner

mKeRix commented Dec 9, 2020

As a side note, I added some more timeouts in the last beta version (v2.13.0-beta.3) that could possibly also help with this issue. Since just restarting room-assistant works for you something it may just be that something gets stuck while performing the inquiries and room-assistant does not handle that properly.

@vivobg
Copy link

vivobg commented Dec 12, 2020

I am having the same issue with 2 Zero Ws, running on 2.12.0, fresh install of everything, as of 2 days ago.
I see the following in the logs
12/12/2020, 8:43:31 PM - debug - BluetoothService: Query of xx:xx:xx:xx:xx:xx reached scan time limit, resetting hci0

Also, when I run hcitool -i hci0 cc "xx:xx:xx:xx:xx:xx"
I get "Can't create connection: Input/output error", when the mobile phone is a meter away in direct line of sight.

I rebooted one of the Zeros, and it started working again, but I am keeping the other one on, to try and debug the issue.

Restarting the room-assistant service did not help. I tried updating to 2.13.0-beta.3, but the non-restarted Zero is still not working.

@balonchiks
Copy link

balonchiks commented Dec 17, 2020

my 2 cents:

i've reinstalled room-assistant on a fresh rpi zero w via docket this time and in couple of days i got the issue again. pi is not detecting any of the devices, the logs are empty. restarting room-assistant container didn't help so i had to do a rpi full restart to bet it back working.

on that day, the only things that were in the log are:

12/16/2020, 10:00:30 AM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.
12/16/2020, 10:06:47 AM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.
12/16/2020, 10:51:55 AM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.
12/16/2020, 2:58:34 PM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.
12/16/2020, 3:34:49 PM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.
12/16/2020, 6:20:31 PM - error - ClusterService: Command failed: dig +short @224.0.0.251 -p 5353 -4 rpi-office.local.

what is interesting is that rpi-office is that particular rpi. is it trying to speak to itself? is that normal?

just in case here's cluster part of my config on this rpi:

  cluster:
    autoDiscovery: false
    port: 6425
    peerAddresses:
      - 10.x.x.31:6425
      - 10.x.x.115:6425
      - 10.x.x.45:6425
      - 10.x.x.30:6425
  instanceName: office

@balonchiks
Copy link

yet another update - tried the latest beta v2.13.0-beta.4 - the result is still the same. rpi stopped reporting in 2 hours with absolutely clear logs.

@patdemko
Copy link

I just started using room assistant about a week ago or so ago and I'm noticing the same pi zero issues. I'm having no problems with it running on two Pi3's and a Pi4, but both of the Pi zeros I've tried eventually lock up after a while like is mentioned. One thing I have noticed through the logs is the just prior to getting into the hung state the wifi interface drops and quickly reconnects. When it reconnects it shows a valid IP is received via dhcp. However, the device is no longer responding to pings or sending packets at this time. I have found that if I catch it early enough and disconnect it manually from my Wifi AP it will reconnect and start passing data again. If it sits too long in that hung state the AP reconnect command won't work and I then need to restart the Pi zero to get it back.

@mKeRix
Copy link
Owner

mKeRix commented Jan 4, 2021

While testing stuff for #309 I have also started noticing these issues now - the adapter becomes unstable or gets stuck, which then leads to nothing working correctly anymore. I am testing out a bunch of different things to stabilize this and recover from such failure states better, however only with medium amounts of success so far. Before bringing the companion app feature to stable I definitely want this issue to be solved.

@swissmaster1
Copy link
Author

Are there any news on this issue?

@mKeRix
Copy link
Owner

mKeRix commented Jan 16, 2021

My local test installation seems to be able to recover from this, although I am testing it with other stuff enabled. I'm not 100% happy with my test results, but I think for this specific issue it might be valuable to at least get another beta release out. I'll try to facilitate that tomorrow.

@mKeRix
Copy link
Owner

mKeRix commented Jan 17, 2021

I just published 2.13.0-beta.5, which includes the stability improvements that I mentioned. Note that for regular BLE tracking the performance will be slightly degraded in the beta, as the companion app discovery process cannot be disabled yet (an option I want to add before making this an actual release). You can easily counteract that by raising the timeout setting though. Could you check if this resolves any of your issues?

@mKeRix
Copy link
Owner

mKeRix commented Jan 18, 2021

I just realized that I forgot to mention something regarding the beta.5 - for it to function fully while running as a non-root user you need to grant an additional permission that would otherwise only be needed for BT Classic:

sudo setcap cap_net_admin+eip $(eval readlink -f `which hciconfig`)

@balonchiks
Copy link

thanks, but that doesn't needed for the docker image, correct?

@mKeRix
Copy link
Owner

mKeRix commented Jan 30, 2021

Thanks for your additional remarks and thoughts on this topic, it did give me another idea of what to try. Do you see the same issues when you make room-assistant a bit less aggressive on the adapter? Something like this:

bluetoothClassic:
  scanTimeLimit: 7
  interval: 15

You can also set it to something even higher as a test.

@oz-glenn
Copy link

oz-glenn commented Feb 2, 2021

So far so good with the suggested changes. It does seem a little slow to recognise me on entry, but it's been running for a couple of days now without drama. Interestingly it has also started detecting my Apple watch, which after initially setting it up was never detected again until this latest config change.

@balonchiks
Copy link

Working good for me too with the changes for the last 3 days!

@mKeRix
Copy link
Owner

mKeRix commented Feb 2, 2021

In that case I'll probably raise the defaults to a secure value in the next version. Still allows anyone that wants to push their hardware to tune it back down, but makes the default experience better for new users.

@magimat
Copy link

magimat commented Feb 3, 2021

I had it going for a few days too with those parameters, but it just crashed again :(

2/3/2021, 12:40:16 AM - error - BluetoothClassicService: Failed to retrieve RSSI for xx:xx:xx:xx:xx:xx:: Command failed: hcitool -i hci0 cmd 0x01 0x0008

I guess at this point I'll just give up on this and get back to gps presence detection, because this is way too glitchy to be useful :(

@mKeRix mKeRix closed this as completed in ce64847 Feb 13, 2021
github-actions bot pushed a commit that referenced this issue Feb 13, 2021
## [2.13.1](v2.13.0...v2.13.1) (2021-02-13)

### Bug Fixes

* **bluetooth-classic:** align device_tracker discovery ([#493](#493)) ([9e1be95](9e1be95))
* **bluetooth-classic:** increase default interval ([ce64847](ce64847)), closes [#351](#351)
* **bluetooth-low-energy:** interpret allowlist as strings ([7a442e1](7a442e1)), closes [#534](#534)
* **bluetooth-low-energy:** retry on immediate disconnects ([37000b8](37000b8)), closes [#508](#508)
* **entities:** do not refresh non-locked entities ([7c031d4](7c031d4)), closes [#532](#532)
@github-actions
Copy link

🎉 This issue has been resolved in version 2.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@neil2802
Copy link

neil2802 commented May 3, 2021

Hi all.
Very new to home assistant and also very inexperienced but am dabbling with room assistant and had the exact same issues on 4 pi zero w's using wifi. I bought some ethernet hats for the zeros, disabled wifi and they are now hard wired via ethernet.
Bang! Total reliability. Up and running for over a month now with no issues at all.
Understand this may not be practicle for all, but might give an insight into why the pi's are hanging. (wifi issues?)
Just need to tweak to get the room presence to update quicker. Always gets it right but can take up to 5 minutes.

@patdemko
Copy link

patdemko commented May 3, 2021

Hi all.
Very new to home assistant and also very inexperienced but am dabbling with room assistant and had the exact same issues on 4 pi zero w's using wifi. I bought some ethernet hats for the zeros, disabled wifi and they are now hard wired via ethernet.
Bang! Total reliability. Up and running for over a month now with no issues at all.
Understand this may not be practicle for all, but might give an insight into why the pi's are hanging. (wifi issues?)
Just need to tweak to get the room presence to update quicker. Always gets it right but can take up to 5 minutes.

Thanks for confirming it's related to the pi zero w's wifi connection with your Ethernet test. While it's gotten better since the changes made in response to this issue (my pi zero's are not locking up requiring a hard reboot anymore), they are disconnected way more than they're connected. I still have no issues with the Pi3 or Pi4's using their wifi connection.

image

@neil2802
Copy link

neil2802 commented May 3, 2021 via email

@gravyflex
Copy link

Hi all.
Very new to home assistant and also very inexperienced but am dabbling with room assistant and had the exact same issues on 4 pi zero w's using wifi. I bought some ethernet hats for the zeros, disabled wifi and they are now hard wired via ethernet.
Bang! Total reliability. Up and running for over a month now with no issues at all.
Understand this may not be practicle for all, but might give an insight into why the pi's are hanging. (wifi issues?)
Just need to tweak to get the room presence to update quicker. Always gets it right but can take up to 5 minutes.

You are on to something... I disabled the onboard Bluetooth on my pizero and added a USB bt dongle. The last few hours look stable. I am going to see how this works out. Thanks for sharing.

@swissmaster1
Copy link
Author

is there any news to this issue? Is room-assistant now working on pi zero???

@oz-glenn
Copy link

is there any news to this issue? Is room-assistant now working on pi zero???

Nope. It lasts anywhere between a day or less and 3 or 4, then it doesn’t detect. I’m tired of trying to SSH in, and it’s not where my computer lives, so when it fails I just pull the power and most of the time that fixes it, although sometimes it takes 2 or 3 resets.

@mKeRix
Copy link
Owner

mKeRix commented Jun 27, 2021

If you are on a version newer than 2.14.0 check out #763 - there is an ongoing stability discussion in there. I also can suggest enabling the systemd watchdog feature, which will auto-restart the service when it detects problems. For that you need to update the service to look like the example in the docs and install an extra system library with sudo apt-get install libsystemd-dev. If you use ansible you can do all of this by pulling the latest version of the mKeRix/ansible-playbooks repository.

@patdemko
Copy link

I think there may be a wireless AP part to this as well. I was having a lot of issues with my pi zeros and room assistant, but then after I upgraded my AP (from a unifi nano to a unifi 6 LR which is a larger unit with a better antenna) I've had no issues. To test this theory I'd suggest putting your pi zeros close to your AP and see if you still have an issue with the stability. BTW, this issue only affected pi zeros with my old AP. My other Raspberry Pi 3's & 4's had no issues at all with the old AP. Just thought I'd mention it.

@neil2802
Copy link

neil2802 commented Jun 28, 2021 via email

@hmlmartins
Copy link

Hey all,

Know this thread has been around for a while, but I faced the exact same issues on Pi 0.

Given the comment from @neil2802, I decided to add a Bluetooth LE compatible dongle to remove pressure from the Pi 0 onboard Wi-Fi / Bluetooth, and no more strange hanging issues for almost a week now.

I suppose the issue is with Pi 0 hardware capacity to run both Wi-Fi and Bluetooth.

The only thing that bugs me at the moment is that after I am absent from the room where I have been testing room-assistant for some time, say 1 hour as "not_home", when I get back it takes about 5 minutes to pick up my iPhone tracking beacon again (companion app).

Thanks @mKeRix for the wonderful piece of software.

@davidrustingha
Copy link

@hmlmartins what dongle did you buy? I've bought 2 versions of an 'official' CSR 4.0 dongle and they all didn't work.
Apparently there are patches for the kernel but I have no idea how to patch those. Did your's work out of the box?

@neil2802
Copy link

neil2802 commented Dec 30, 2021 via email

@davidrustingha
Copy link

@neil2802 Hi Neil, ethernet hats would be the best solution, but I dont have ethernet at all location's I have Pi's so thats not an option.
Im now looking at WiFi dongles since raspberry's (or Linux in general) has a lot of problems with these so called 'unbranded CSR clones'. But A BLE capable dongle that's supported would still be my favorite choise...

@davidrustingha
Copy link

To get back to what I wrote a month ago: I've installed the pi's with a WiFi dongle and disabled the onboard WiFi. Rock sollid ever since.
I do have to say that it takes some tweaking with the debouncing and rolling average to get a steady and accurate result but once you're past that its awesome.

Thanks @mKeRix for this great piece of software!

@townsmcp
Copy link

To get back to what I wrote a month ago: I've installed the pi's with a WiFi dongle and disabled the onboard WiFi. Rock sollid ever since. I do have to say that it takes some tweaking with the debouncing and rolling average to get a steady and accurate result but once you're past that its awesome.

Thanks @mKeRix for this great piece of software!

Can you share a link to the dongle that you have tried please?

@davidrustingha
Copy link

@townsmcp sure, but I live in the Netherlands so I don't know if it's an option for you.
https://www.sossolutions.nl/300-mbps-dongle-rtl8192cu

@oz-glenn
Copy link

oz-glenn commented Feb 14, 2022

An update:
I binned my Pi Zero W and replaced it with a Pi Zero W 2. I'm using BLE with the RoomAssistant app, running RoomAssistant in Docker. I'm happy to report that it's stable now, I haven't had to reboot it since I installed it in December. As an aside a different Zero W 2 runs RTL_433 stably as well, unlike the Zero W which preceded it.

@bananajoe86
Copy link

Does anyone of you have a workaround by using watchdog successfully in operation? My current workaround for the Pi-Zero problem is a crontab with a reboot every hour, which is not a successful workaround for me.
Thx Joe

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

No branches or pull requests