Skip to content

Commit

Permalink
add wyoming-satellite
Browse files Browse the repository at this point in the history
  • Loading branch information
danielk117 committed Jan 27, 2024
1 parent 3ad8b5f commit 705f577
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/play_button
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ toggle_play_songs() {
fi

if command_exists mpc; then
mpc toggle
if mpc status | grep playing >/dev/nul
then
mpc stop
else
mpc play
fi
fi
}

Expand Down
16 changes: 16 additions & 0 deletions packages/satellite/config/launcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

echo 'START' > /tmp/satellite.log

amixer sset 'pdm dclk' 'pdm dclk 3.072m, support 8k/16k/32k/48k' & amixer sset 'HCIC shift gain from coeff' 'shift with -0x4' >> /tmp/satellite.log
amixer set notifyvol 60% >> /tmp/satellite.log
python3 -m venv .venv >> /tmp/satellite.log

script/run --name $HOSTNAME --uri 'tcp://0.0.0.0:10700' --no-zeroconf \
--mic-command '/data/satellite/recorder' \
--snd-command 'aplay -D notify -r 22050 -c 1 -f S16_LE -t raw' \
--awake-wav sounds/sound1.wav --done-wav sounds/sound7.wav \
--startup-command '/bin/show_led 10' --detect-command '/bin/show_led 0' \
--detection-command '/bin/show_led 1' --stt-stop-command '/bin/show_led 2' --transcript-command '/bin/show_led 0' \
--error-command '/bin/show_led 7; sleep 1; /bin/show_led 0' \
--debug >> /tmp/satellite.log 2>&1
62 changes: 62 additions & 0 deletions packages/satellite/config/satellite.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh /etc/rc.common

START=98
USE_PROCD=1

EXTRA_COMMANDS="status toggle"
PIDFILE=/var/run/satellite.pid

start_service() {
/bin/shut_led 7 &

procd_open_instance
procd_set_param command /data/satellite/launcher
procd_set_param respawn 3600 5 0
procd_set_param pidfile ${PIDFILE}
procd_close_instance
}

stop_service() {
/bin/show_led 7 &

kill_child_processes 1 `cat ${PIDFILE}`
}

reload_service() {
stop
sleep 1
start
}

toggle() {
if [ -f "${PIDFILE}" ] && [ -e /proc/`cat ${PIDFILE}`/status ]; then
stop
else
start
fi
}

status() {
if [ -f "${PIDFILE}" ] && [ -e /proc/`cat ${PIDFILE}`/status ]; then
echo "satellite is running."
return 0
else
echo "satellite is stopped."
return 1
fi
}

kill_child_processes() {
isTopmost=$1
curPid=$2
childPids=`pgrep -P ${curPid}`

for childPid in $childPids
do
kill_child_processes 0 $childPid
done

if [ $isTopmost -eq 0 ]; then
kill -9 $curPid 2> /dev/null
fi
}
1 change: 1 addition & 0 deletions packages/satellite/config/triggerhappy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
KEY_HOME 1 /etc/init.d/listener toggle
19 changes: 19 additions & 0 deletions packages/satellite/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PACKAGE_NAME="satellite"
PACKAGE_VERSION="1.1.0"
PACKAGE_SRC="https://github.com/rhasspy/wyoming-satellite/archive/v${PACKAGE_VERSION}.tar.gz"
PACAKGE_DEPENDS="python3 aec-cmdline"

make_package() {
# TODO
}

install_package() {

cp -v ${PACKAGE_DIR}/config/satellite.init ${STAGING_DIR}/etc/init.d/listener
ln -sf ../init.d/listener ${STAGING_DIR}/etc/rc.d/S98listener

TRIGGERHAPPY_FOLDER="${STAGING_DIR}/etc/triggerhappy/triggers.d"
mkdir -p ${TRIGGERHAPPY_FOLDER}

cp -v ${PACKAGE_DIR}/config/triggerhappy.conf ${TRIGGERHAPPY_FOLDER}/listener.conf
}

0 comments on commit 705f577

Please sign in to comment.