Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer with timer option ? #198

Open
faduchesne opened this issue Jul 9, 2024 · 15 comments
Open

Installer with timer option ? #198

faduchesne opened this issue Jul 9, 2024 · 15 comments

Comments

@faduchesne
Copy link

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
Copy link
Contributor

tannisroot commented Jul 17, 2024

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

@tannisroot
Copy link
Contributor

Oh and you need to add these

@tannisroot
Copy link
Contributor

    --timer-finished-wav 'sounds/timer_finished.wav' \
    --timer-finished-wav-repeat 3 3 \

@tannisroot
Copy link
Contributor

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
Copy link
Contributor

Thank you @tannisroot

@mkcologne
Copy link

    --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
Copy link
Contributor

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

@mkcologne
Copy link

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
Copy link
Contributor

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

@mkcologne
Copy link

Thanks!

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

@tannisroot
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

tannisroot commented Aug 9, 2024

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
Copy link

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants