mKeRix / room-assistant

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

Problems running room-assistant on Raspberry Pi Zero #351

Closed swissmaster1 closed 3 years ago

swissmaster1 commented 3 years ago

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

Additional context Add any other context about the problem here.

mKeRix commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

As previously stated, i bought Ethernet hats for my 5 pi zeros W and shut off wifi.

Currently working perfectly, with no problems at all for over 2 months now. Never had any need to reboot or ssh in since. Room assistant just works!!

Think its the way forward with the zeros.

Hope that helps.

From: username-ibis @.*** Sent: 25 June 2021 06:49 To: mKeRix/room-assistant Cc: neil2802; Comment Subject: Re: [mKeRix/room-assistant] Problems running room-assistant on Raspberry Pi Zero (#351)

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mKeRix/room-assistant/issues/351#issuecomment-868222311 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AM7CWCLMZOU2FUMZLD7G2HDTUQKF5ANCNFSM4T3E6LEA . https://github.com/notifications/beacon/AM7CWCOBJ2MJ6BSUK47AS6TTUQKF5A5CNFSM4T3E6LEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGPAAKZY.gif

hmlmartins commented 3 years ago

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 commented 2 years ago

@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 commented 2 years ago

Hi.I bought these "ethernet hats" for my pi zeros.https://thepihut.com/collections/raspberry-pi-hats/products/ethernet-and-usb-hub-hat-for-raspberry-piThese are "assemble and play" with no software necessary. They have made the zeros and room assistant work flawlessly for a year.There are now Poe hats available, but these are quite expensiveI did turn off the Wi-Fi on the zeros after installing the above. I can talk you through this if you don't know how to do itHope this helps. RegardsNeil Hamilton Sent from Samsung tablet. -------- Original message --------From: iron-LAN @.> Date: 29/12/2021 23:51 (GMT+00:00) To: mKeRix/room-assistant @.> Cc: neil2802 @.>, Mention @.> Subject: Re: [mKeRix/room-assistant] Problems running room-assistant on Raspberry Pi Zero (#351) @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?

—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/mKeRix/room-assistant/issues/351#issuecomment-1002816495", "url": "https://github.com/mKeRix/room-assistant/issues/351#issuecomment-1002816495", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

davidrustingha commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

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