How to: Run Wyoming Satellite and OpenWakeWord on Android

This looks very interesting, I will look into it more but Termux currently supports local wake word and while streaming isn’t a bad thing, seems like it would eat up battery life. Then again even when doing local, it has to constantly be listening so it may equal out because both methods require the mic to always be listening and Termux has to run as a background service just like any other android app that runs in the background like if you have a persistent connection to home assistant in the companion app settings.

Also size of the install. While not a ton for a phone Termux comes in at around 1.5GB with everything I stalled. I got this working on my Sony Android TV which has a microphone in the TV. The issue is it has only 2GB of storage. Originally I was trying to get it to work with the remote microphone but that was a no go… I did get it working with the TV microphone though although I about gave up until I remember it had a physical switch for the mic that I turned off years ago. Flipped the switch and works but can’t control the voice assistant sound output level which this APK can.

I wrote a simple automation for muting the TV bit the APK does it automatically which is nice. I don’t even mind streaming but when something is setup and working it just feels like asking for trouble switching. I also noticed were they said on Android

12 or above the app wouldn’t start at startup. I had this same issue. I just created a simple script using ADB commands but there are also apks that will auto launch apps at boot if you don’t want to mess with ADB

This is actually a script for rebooting the TV as it loses audio output sometimes. Seems to be an issue with that APK so may be related. I also run audio from USB to a DAC but audio output tends to go out after the TV has been off for an hour or more.

alias: Sony reboot TV
sequence:
  - target:
      device_id: 898aa2b7043fd419813bbfcff53e3fd1
    data:
      command: reboot
    action: androidtv.adb_command
  - delay:
      hours: 0
      minutes: 0
      seconds: 45
      milliseconds: 0
  - action: script.sony_terminal
    metadata: {}
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - action: homeassistant.update_entity
    metadata: {}
    data:
      entity_id:
        - assist_satellite.tv
mode: single

Script run

data:
  command: am start -n com.termux/.HomeActivity
target:
  entity_id: media_player.sony_android_tv
action: androidtv.adb_command

Obviously for the APK referenced above the app id would need to be changed to accomplish the same results.

Worked like a charm! I was able to get my custom wake word installed as well. Its pretty cool to be able to carry my phone in my pocket and walk around the house issuing commands and getting replies.

The install script worked like a charm, I just had to run it twice.

I installed Termux Boot to ensure the programs restart after rebooting.

The only issue I ran into was that the microphone was not being picked up after a reboot.

I found that this was not an issue if I opened Termux manually after rebooting. My device is on Android 11, and I didn’t have the option to “Always allow” microphone access to Termux. I belive this is what was causing the problem.

To fix this, I used Termux Boot to automatically open Termux on boot using the following command: am start -n com.termux/com.termux.app.TermuxActivity

Just wanted to add this here in case anyone else runs into the same issue.

2 Likes

cant load the modules, getting stuck on this.

Anyone run into this error? Not sure how to address this.

Anyone try this with a 1st gen echo 5 or 8 that recently got the ability to load LineageOS onto it? Just wondering if the stock microphones are better than all the sattelite spearkers I’ve used previously. Debating if I want to attempt to remove Alexa functionality on mine.

2 Likes

I would like to know this too.

I’m excited about the possibility of replacing Amazon OS with Lineage OS, but I don’t want to lose the AI conversation agent. I would prefer a local solution, but it is not a hill that I am going to die on.

1 Like

Ive tried it on an Amazon Echo 5 but openwakeword fails due to a 64bit vs 32bit mismatch related to tensorflowlite. Looks like LineageOS is working in a 32bit user space but Tensorflowlite needs 64bit. I’ve looked to rebuild tensorflowlite for 32bit ARM but haven’t managed it. Spent a number of hours trying different work arounds but am taking a break from it before I go mad.

2 Likes

Hey all, just so you are aware, you dont need Termuc, you can yae the android app called VACA, View Assist Companio App, it can also be used like Fully Kiosk Browser to display your dashboard,

2 Likes

I think I distractedly looked at View Assist a year ago or so, but with VACA it’s a gamechanger.
I have an assist satellite with display in my office, and all I had to do was install an APK on an old phone. VACA rocks!

2 Likes

I’m using it on multiple devices but the best one is an Android Tablet (Jeazans and URAO A10 Pro) that sits on a magnetic dock and bluetooths to the dock as it is the speaker. The tablet is a bit slow but very usable and the speakers aren’t Harmon Kardon but they are bloody good for the bedrooms , kitchen and my office, more than enough.

These are not affiliate links LOL, just examples, i’m not searching for the best prices for you :slight_smile:
You can get them on AliExpress and Amazon

Getting this Error. Any Idea?

ERROR:asyncio:Unhandled exception in client_connected_cb
transport: <_SelectorSocketTransport fd=7 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/wyoming-openwakeword/.venv/lib/python3.12/site-packages/wyoming/server.py", line 96, in _handler_callback
    handler = handler_factory(reader, writer)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/wyoming-openwakeword/wyoming_openwakeword/handler.py", line 52, in __init__
    self.oww_features = OpenWakeWordFeatures.from_builtin()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/openwakeword.py", line 361, in from_builtin
    return OpenWakeWordFeatures(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/openwakeword.py", line 205, in __init__
    TfLiteWakeWord.__init__(self, libtensorflowlite_c_path)
  File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/wakeword.py", line 36, in __init__
    self.lib = C.CDLL(str(self.libtensorflowlite_c_path), mode=os.RTLD_GLOBAL)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/ctypes/__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen failed: "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/lib/libtensorflowlite_c.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)
Exception ignored in: <function OpenWakeWordFeatures.__del__ at 0x7b9bf8c040>
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/openwakeword.py", line 386, in __del__
DEBUG:root:Connected to mic service
DEBUG:root:Connected to wake service
    self.close()
  File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/pyopen_wakeword/openwakeword.py", line 369, in close
    if self.mel_interpreter:
       ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OpenWakeWordFeatures' object has no attribute 'mel_interpreter'
ERROR:root:Unexpected error in wake read task
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/wyoming-satellite/wyoming_satellite/satellite.py", line 783, in _wake_task_proc
    event = from_client_task.result()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/wyoming-satellite/.venv/lib/python3.12/site-packages/wyoming/client.py", line 25, in read_event
    return await async_read_event(self._reader)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/home/wyoming-satellite/.venv/lib/python3.12/site-packages/wyoming/event.py", line 79, in async_read_event
    json_line = await reader.readline()
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/asyncio/streams.py", line 568, in readline
    line = await self.readuntil(sep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.12/asyncio/streams.py", line 660, in readuntil
    await self._wait_for_data('readuntil')
  File "/data/data/com.termux/files/usr/lib/python3.12/asyncio/streams.py", line 545, in _wait_for_data
    await self._waiter
  File "/data/data/com.termux/files/usr/lib/python3.12/asyncio/selector_events.py", line 1013, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
DEBUG:root:Server set: 79722482280950
INFO:root:Connected to server
INFO:root:Waiting for wake word
WARNING:root:Failed to get info from wake service
DEBUG:root:Ping enabled
DEBUG:root:Connected to wake service
multiple
lines

Hey folks, I am running into an interesting issue just getting wyoming satellite installed.

Here is what I have done.
flashed Lineage 15.1 on my TSV device. Works fine, for the device.

I then install f-droid client and from there install termux, termux:api and termux:boot

These all install fine afaik. I also install openssh since this makes life easier.

Here is where the fun begins. When I pkg install -y git python sox pulseaudio termux-api things start breaking upon installing python3.12
effectively this crashes termux, and then leaves python as an unconfigured package, resulting in the message to run dpkg --configure -a which subsequently crashes termux again.

~ $ pkg install -y python

Checking availability of current mirror:

[*] [https://packages-cf.termux.dev/apt/termux-main: ](https://packages-cf.termux.dev/apt/termux-main:)ok

E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

checking adb logcat to hopefully see what is going on, I get this output,

02-06 14:58:29.705  6727  6727 F libc    : CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/bin/dpkg": can't read file "/data/data/com.termux/files/usr/lib": Is a directory
02-06 14:58:29.705  6727  6727 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6727 (dpkg), pid 6727 (dpkg)
02-06 14:58:29.694  6729  6729 I crash_dump32: type=1400 audit(0.0:558): avc: denied { read write } for path="/dev/pts/0" dev="devpts" ino=3 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:untrusted_app_devpts:s0:c512,c768 tclass=chr_file permissive=1
02-06 14:58:29.709  6729  6729 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.710  6729  6729 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6729 (crash_dump32), pid 6729 (crash_dump32)
02-06 14:58:29.694  6731  6731 I crash_dump32: type=1400 audit(0.0:561): avc: denied { execute_no_trans } for path="/system/bin/crash_dump32" dev="mmcblk0p24" ino=1951 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:crash_dump_exec:s0 tclass=file permissive=1
02-06 14:58:29.714  6731  6731 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.714  6731  6731 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6731 (crash_dump32), pid 6731 (crash_dump32)
02-06 14:58:29.719  6733  6733 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.720  6733  6733 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6733 (crash_dump32), pid 6733 (crash_dump32)
02-06 14:58:29.725  6735  6735 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.725  6735  6735 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6735 (crash_dump32), pid 6735 (crash_dump32)
02-06 14:58:29.731  6737  6737 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.731  6737  6737 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6737 (crash_dump32), pid 6737 (crash_dump32)
02-06 14:58:29.737  6739  6739 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.737  6739  6739 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6739 (crash_dump32), pid 6739 (crash_dump32)
02-06 14:58:29.742  6741  6741 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.742  6741  6741 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6741 (crash_dump32), pid 6741 (crash_dump32)
02-06 14:58:29.747  6743  6743 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.748  6743  6743 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6743 (crash_dump32), pid 6743 (crash_dump32)
02-06 14:58:29.753  6745  6745 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.753  6745  6745 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6745 (crash_dump32), pid 6745 (crash_dump32)
02-06 14:58:29.759  6747  6747 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.759  6747  6747 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6747 (crash_dump32), pid 6747 (crash_dump32)
02-06 14:58:29.764  6749  6749 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.765  6749  6749 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6749 (crash_dump32), pid 6749 (crash_dump32)
02-06 14:58:29.770  6751  6751 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.770  6751  6751 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6751 (crash_dump32), pid 6751 (crash_dump32)
02-06 14:58:29.775  6753  6753 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.775  6753  6753 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6753 (crash_dump32), pid 6753 (crash_dump32)
02-06 14:58:29.779  6755  6755 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.780  6755  6755 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6755 (crash_dump32), pid 6755 (crash_dump32)
02-06 14:58:29.784  6757  6757 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.784  6757  6757 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6757 (crash_dump32), pid 6757 (crash_dump32)
02-06 14:58:29.788  6759  6759 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.788  6759  6759 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6759 (crash_dump32), pid 6759 (crash_dump32)
02-06 14:58:29.792  6761  6761 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.793  6761  6761 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6761 (crash_dump32), pid 6761 (crash_dump32)
02-06 14:58:29.797  6763  6763 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.797  6763  6763 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6763 (crash_dump32), pid 6763 (crash_dump32)
02-06 14:58:29.801  6765  6765 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.801  6765  6765 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6765 (crash_dump32), pid 6765 (crash_dump32)
02-06 14:58:29.805  6767  6767 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.805  6767  6767 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6767 (crash_dump32), pid 6767 (crash_dump32)
02-06 14:58:29.809  6769  6769 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.810  6769  6769 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6769 (crash_dump32), pid 6769 (crash_dump32)
02-06 14:58:29.814  6771  6771 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.814  6771  6771 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6771 (crash_dump32), pid 6771 (crash_dump32)
02-06 14:58:29.818  6773  6773 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.818  6773  6773 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6773 (crash_dump32), pid 6773 (crash_dump32)
02-06 14:58:29.822  6775  6775 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.823  6775  6775 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6775 (crash_dump32), pid 6775 (crash_dump32)
02-06 14:58:29.827  6777  6777 F libc    : CANNOT LINK EXECUTABLE "crash_dump32": can't read file "/system/lib": Is a directory
02-06 14:58:29.827  6777  6777 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 6777 (crash_dump32), pid 6777 (crash_dump32)

Checking out /data/data/com.termux/files/usr/lib it is in fact a directory.

Pinging the termux subreddit, wasn’t super useful. Just wondering if anyone else saw this issue.

Has anyone had any success with this on an Android TV box?

I spent a few hours today and was able to get it installed and recognized in Home Assistant but wasn’t able to see the mics or perform any announces. Tried this on an Onn 4K Pro.

Hey everyone :wave:

I just open-sourced a project I’ve been working on over the past few months and wanted to share it with the community.

It’s a native implementation of the Wyoming Protocol, allowing you to turn everyday devices into Wyoming satellites with a proper native app experience.

You can use:

  • Android phones and tablets
  • iPhones and iPads
  • Windows, Linux, and macOS desktops/laptops
  • Samsung Tizen TVs

The goal is to provide native performance, proper audio handling, and a clean cross-platform architecture.

The project is still under active development, so expect some bugs and rough edges. I haven’t published the binaries to the app stores yet (that’s coming soon), but you can already clone the repo and deploy a development build to your devices.

I’d really appreciate any feedback, suggestions, bug reports, or contributions from the community.

GitHub:

3 Likes

I got it working with Termux for Android on my Sony Android TV but it would only use the mic built into my TV, not the mic in the remote. If you’re on the latest HA version you can sideload the companion app and try the native functionality for Android that was in the March HA update. Termux for Wyoming takes up a bunch of space anyways and my TV has 2GB of storage and with the included apps it barely fit. I think it was over 1GB once everything was installed. I want to try the native functionality but something in my scripts yaml file is having major issues after the update so have to fix that first. Regardless, it’s native now in the the Android companion app and it would take up less battery drain if Google would let them use their API but Google has that locked down apparently. Uses Microwakeword also instead of OpenWakeWord and is baked into the companion app. Was not expecting that in this update not that I’m complaining.

Your phone just became a voice satellite! The Home Assistant Companion app for Android now supports on-device wake word detection, allowing you to open Assist from anywhere; even when your phone is locked.

Inspired from the great work from @brownard in Ava.

This feature uses microWakeWord, the same lightweight wake word engine that powers the Home Assistant Voice Preview Edition. All processing happens locally on your device, no audio is sent to the cloud, and no server-side processing is needed. Your voice stays on your phone.

You can choose between three wake words:

Okay Nabu
Hey Jarvis
Hey Mycroft
To enable wake word detection, open your Android device’s Settings > Companion App > Assist for Android, and enable the Enable wake word detection toggle. Once enabled, simply say your chosen wake word and the Assist pipeline will open, ready to take your command.

Because wake word detection requires continuous microphone access and CPU usage, this feature does have a noticeable impact on battery life. To help manage this, you can use automations to start and stop wake word detection based on your context, for example, only enabling it when you’re connected to your home Wi-Fi or within a specific zone. This way, you get hands-free voice control when it matters most, without draining your battery all day.

Note

Battery usage could be drastically reduced if Google opened their API for hardware hotword detection. Unfortunately, this is hidden behind a system API that only phone manufacturers have access to. Maybe one day they will open it up to improve the experience.