Everything is working... except...

emeeder
Posts: 26
Joined: Fri May 29, 2026 6:24 pm

Everything is working... except...

Post by emeeder »

I have everything working individually... HUDiy boots up and runs when I have my new ai-brain.service disabled.

When HUDiy is turned off my ai-brain.service runs perfectly.

However, when I have my new python script (ai-brain.service) enabled at boot HUDiy will just sit there constantly saying "Hudiy is launching..." and not run. BUT the moment I stop the service the HUDiy then does startup and runs fine.

They just don't seem to want to "play together" at all.

Ideas? Theories? What do I need to change in my script 😝 or in the HUDiy settings to allow both to play in the same playground?

(I have a Raspberry Pi 5 with the HUDiy setup and my script uses PyAudio, OpenWakeWord and Flask and several other things...)
hudiy
Site Admin
Posts: 590
Joined: Mon Jul 14, 2025 7:42 pm

Re: Everything is working... except...

Post by hudiy »

'Hudiy is launching...' indicates that you are using console mode. Does your script utilize GPU resources in any way (e.g., UI)? EGLFS used in console mode only allows for displaying one application window at a time.

Another thing that might be blocking Hudiy from starting is PipeWire. The startup script waits for PipeWire to launch and detect audio devices. It is possible that PyAudio is using ALSA, thereby blocking the audio device and preventing PipeWire from starting.
Hudiy Team
emeeder
Posts: 26
Joined: Fri May 29, 2026 6:24 pm

Re: Everything is working... except...

Post by emeeder »

Well, supposedly the audio was configured to be able to share the audio no problem. I do use PyAudio to play responses from the A.I. and of course record my commands.

Does HUDiy try to completely lock the default input/output devices, but maybe since my script was launching in the services it grabbed it first?

Is HUDiy configurable to not necessarily try to grab the entire audio, or is it all or nothing? (I don't do anything graphical and all error and standard output are filtered into files.)

I suppose that I could try to create a dummy system audio default output that HUDiy could grab and my script could grab a 2nd virtual output and they could both be piped into the real output? How about input... does HUDiy try to grab that too for use on AA with "Hey Google"?
hudiy
Site Admin
Posts: 590
Joined: Mon Jul 14, 2025 7:42 pm

Re: Everything is working... except...

Post by hudiy »

Hudiy does not use or communicate directly with audio devices. Instead, it utilizes PipeWire, which is a standard component of Raspberry Pi OS for audio handling. PipeWire is simply an audio server that allows multiple applications to play and record audio at the same time.
ALSA does not allow an audio device to be used by more than one application at a time. If your script uses ALSA, it blocks PipeWire's access to the audio device. The cleanest solution would be to use PipeWire for audio handling in your script.
Hudiy Team
emeeder
Posts: 26
Joined: Fri May 29, 2026 6:24 pm

Re: Everything is working... except...

Post by emeeder »

I changed out my code to just use the PipeWire default input/output device, and yet because my script launches in services first it's causing the HUDiy application to hang and keep showing that "Hudiy is launching..."

There must be something else that HUDiy wants that my script has ahold of, cause my script does not talk to the terminal AT ALL, and is running completely from services and only accesses the input/output devices (now through PipeWire), a served webpage, and back-and-forth communication with Telegram (as well as the Gemini API model)

I'm not sure what other things you're trying to grab, but if I can just get a little bit of a list or maybe a time when we can hop on a session together to figure this out I'd appreciate it (cause I'm SO close!!!)
hudiy
Site Admin
Posts: 590
Joined: Mon Jul 14, 2025 7:42 pm

Re: Everything is working... except...

Post by hudiy »

What is the output of pactl list sinks and pactl info commands when your script is running?

Please also post output of the systemctl --user status hudiy.service command.
Hudiy Team
emeeder
Posts: 26
Joined: Fri May 29, 2026 6:24 pm

Re: Everything is working... except...

Post by emeeder »

Here is my file with everything in it that you asked for... I sure hope that you can tell me what's going on!

I'll send it via private message cause it's large...
hudiy
Site Admin
Posts: 590
Joined: Mon Jul 14, 2025 7:42 pm

Re: Everything is working... except...

Post by hudiy »

According to the output, it looks like your script blocks access to either the input devices (accessible via evdev) or KMS resources for rendering. Try configuring your script's .service file to launch after hudiy.service by adding After=hudiy.service in the [Unit] section.

To check exactly what is blocked, you can run systemctl --user stop hudiy.service and then run hudiy manually via $HOME/.hudiy/share/hudiy_run.sh and post the output.
Hudiy Team
emeeder
Posts: 26
Joined: Fri May 29, 2026 6:24 pm

Re: Everything is working... except...

Post by emeeder »

I sent that output via private again...

I did see one part in my code that might have been messing with ALSA so I removed that in order to just get the default PipeWire info.
hudiy
Site Admin
Posts: 590
Joined: Mon Jul 14, 2025 7:42 pm

Re: Everything is working... except...

Post by hudiy »

Do you create any socket in your script? In the output there is a bind error which means that port is already in use. By default Hudiy binds 44405 and 44406 ports for API endpoints.
Hudiy Team
Post Reply