rhasspy / wyoming-satellite

Remote voice satellite using Wyoming protocol
MIT License
722 stars 106 forks source link

Installer with timer option ? #198

Open faduchesne opened 4 months ago

faduchesne commented 4 months ago

Is it possible to have a version of the installer with the option for timers soon? I have tried several times to modify the service file, but it doesn't work. For regular users, it remains very complicated... Thank you very much.

tannisroot commented 4 months ago

The project already added it quite a long time ago. You need to update the local repository with git pull and a restart

tannisroot commented 4 months ago

Oh and you need to add these

tannisroot commented 4 months ago
    --timer-finished-wav 'sounds/timer_finished.wav' \
    --timer-finished-wav-repeat 3 3 \
tannisroot commented 4 months ago

You may need to change 3 3 to your preference, one is delay and the other is how many times the sound is repeated

synesthesiam commented 4 months ago

Thank you @tannisroot

mkcologne commented 4 months ago
    --timer-finished-wav 'sounds/timer_finished.wav' \
    --timer-finished-wav-repeat 3 3 \

Hi! I've added those lines and get an error while the service ist starting:

Jul 18 11:21:44 sat1 run[907]: main.py: error: ambiguous option: --timer could match --timer-started-command, --timer-updated-command, --> Jul 18 11:21:44 sat1 run[903]: Traceback (most recent call last): Jul 18 11:21:44 sat1 run[903]: File "/home/pi/wyoming-satellite/script/run", line 12, in Jul 18 11:21:44 sat1 run[903]: subprocess.check_call([context.env_exe, "-m", "wyoming_satellite"] + sys.argv[1:]) Jul 18 11:21:44 sat1 run[903]: File "/usr/lib/python3.9/subprocess.py", line 373, in check_call Jul 18 11:21:44 sat1 run[903]: raise CalledProcessError(retcode, cmd) Jul 18 11:21:44 sat1 run[903]: subprocess.CalledProcessError: Command '['/home/pi/wyoming-satellite/.venv/bin/python3', '-m', 'wyoming_satell> Jul 18 11:21:44 sat1 systemd[1]: wyoming-satellite.service: Main process exited, code=exited, status=1/FAILURE

tannisroot commented 4 months ago

Can you copy and paste your entire config here, as well as share path to your wyoming-satellite folder

mkcologne commented 4 months ago

For sure:

[Unit]
Description=Wyoming Satellite
Wants=network-online.target
After=network-online.target
Requires=wyoming-openwakeword.service
Requires=2mic_leds.service

[Service]
Type=simple
ExecStart=/home/pi/wyoming-satellite/script/run \
--name 'kHome Sat 1' \
--uri 'tcp://0.0.0.0:10700' \
--mic-command 'arecord -D plughw:CARD=seeed2micvoicec,DEV=0 -r 16000 -c 1 -f S16_LE -t raw' \
--snd-command 'aplay -D plughw:CARD=seeed2micvoicec,DEV=0 -r 44100 -c 1 -f S16_LE -t raw' \
--snd-command-rate 44100 \
--mic-auto-gain 5 \
--mic-noise-suppression 2 \
--wake-uri 'tcp://127.0.0.1:10400' \
--wake-word-name 'hey_jarvis' \
--event-uri 'tcp://127.0.0.1:10500' \
--awake-wav sounds/awake.wav \
##--timer-finished-wav 'sounds/timer_finished.wav' \
##--timer finished-wav-repeat 5 1 \ 

WorkingDirectory=/home/pi/wyoming-satellite
Restart=always
RestartSec=1

[Install]
WantedBy=default.target

Timers are commented out for reasons.

M.

tannisroot commented 4 months ago

You need to remove the last \ from the timer option.

mkcologne commented 4 months ago

Thanks!

For my understanding: Why is the trailing ' \ ' by --awake-wav not a problem but by --timer … it is?

tannisroot commented 4 months ago

Thanks!

For my understanding: Why is the trailing ' \ ' by --awake-wav not a problem but by --timer … it is?

In bash, \ + newline character (invisible but dictates when a new line is created) is interpreted as line continuation. Your --timer finished-wav-repeat 5 1 option is last so it needs to be the end of the line without anything continuing after that. In my config, those 2 options are in the middle of the list of the configs so it works.

zwolfinger commented 3 months ago

I'm running into the same problem I think.

  1. I'm running the latest version of HA (2024.8.0)
  2. I'm running the latest version of wyoming-satellite on my Pi zero 2w (wyoming-satellite/wyoming-satellite/VERSION shows 1.3.0)
  3. I'm running the latest version of wyoming (1.5.4)

Here is my service file: `[Unit] Description=Wyoming Satellite Wants=network-online.target After=network-online.target Requires=wyoming-openwakeword.service Requires=2mic_leds.service

[Service] Type=simple WorkingDirectory=/home/pi/wyoming-satellite ExecStart=/home/pi/wyoming-satellite/script/run \ --name 'wyoming-den' \ --uri 'tcp://0.0.0.0:10700' \ --mic-command 'arecord -D plughw:CARD=seeed2micvoicec,DEV=0 -r 16000 -c 1 -f S16_LE -t raw' \ --snd-command 'aplay -D plughw:CARD=seeed2micvoicec,DEV=0 -r 22050 -c 1 -f S16_LE -t raw' \ --mic-auto-gain 5 \ --mic-noise-suppression 2 \ --wake-uri 'tcp://127.0.0.1:10400' \ --wake-word-name 'hey_jarvis' \ --event-uri 'tcp://127.0.0.1:10500' \ --timer-finished-wav '/home/pi/wyoming-satellite/sounds/timer_finished.wav' \ --timer-finished-wav-repeat 3 3

Restart=always RestartSec=1

[Install] WantedBy=default.target `

I get audio confirmation that the timer has started, but I never get anything when the timer finishes.

I've also tried replacing the --timer-finished-wav and --timer-finished-wav-repeat with '--timer-finished-command /home/pi/wyoming-satellite/end_timer.sh' containing #!/bin/bash aplay -D plughw:CARD=seeed2micvoicec,DEV=0 /home/zwolfinger/wyoming-satellite/sounds/end_timer.wav and set to executable (chmod +x end_timer.wav). The script works fine when I call it from the command line.

It feels like wyoming-satellite isn't getting told that the timer has finished so it never plays the file or runs the command. Is there something else on the HA side I need to do? Any other ideas?

tannisroot commented 3 months ago

I'm running into the same problem I think.

1. I'm running the latest version of HA (2024.8.0)

2. I'm running the latest version of wyoming-satellite on my Pi zero 2w (wyoming-satellite/wyoming-satellite/VERSION shows 1.3.0)

3. I'm running the latest version of wyoming (1.5.4)

Here is my service file: `[Unit] Description=Wyoming Satellite Wants=network-online.target After=network-online.target Requires=wyoming-openwakeword.service Requires=2mic_leds.service

[Service] Type=simple WorkingDirectory=/home/pi/wyoming-satellite ExecStart=/home/pi/wyoming-satellite/script/run --name 'wyoming-den' --uri 'tcp://0.0.0.0:10700' --mic-command 'arecord -D plughw:CARD=seeed2micvoicec,DEV=0 -r 16000 -c 1 -f S16_LE -t raw' --snd-command 'aplay -D plughw:CARD=seeed2micvoicec,DEV=0 -r 22050 -c 1 -f S16_LE -t raw' --mic-auto-gain 5 --mic-noise-suppression 2 --wake-uri 'tcp://127.0.0.1:10400' --wake-word-name 'hey_jarvis' --event-uri 'tcp://127.0.0.1:10500' --timer-finished-wav '/home/pi/wyoming-satellite/sounds/timer_finished.wav' --timer-finished-wav-repeat 3 3

Restart=always RestartSec=1

[Install] WantedBy=default.target `

I get audio confirmation that the timer has started, but I never get anything when the timer finishes.

I've also tried replacing the --timer-finished-wav and --timer-finished-wav-repeat with '--timer-finished-command /home/pi/wyoming-satellite/end_timer.sh' containing #!/bin/bash aplay -D plughw:CARD=seeed2micvoicec,DEV=0 /home/zwolfinger/wyoming-satellite/sounds/end_timer.wav and set to executable (chmod +x end_timer.wav). The script works fine when I call it from the command line.

It feels like wyoming-satellite isn't getting told that the timer has finished so it never plays the file or runs the command. Is there something else on the HA side I need to do? Any other ideas?

In the config, the path contains /home/pi, pi being the user, but from the snippet you've shared, your user is zwolfinger. The guide assumes you leave the user name at default.

zwolfinger commented 3 months ago

Actually I tried to anonymize my code for the comment and missed one. It IS all /home/zwolfinger in the real files.

Still no joy.

tannisroot commented 2 months ago

Actually I tried to anonymize my code for the comment and missed one. It IS all /home/zwolfinger in the real files.

Still no joy.

Please provide journalctl -u wyoming-satellite.service