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

[Feature Request] Make use of the button on Respeaker 2-Mics #149

Open
tannisroot opened this issue Apr 7, 2024 · 5 comments
Open

[Feature Request] Make use of the button on Respeaker 2-Mics #149

tannisroot opened this issue Apr 7, 2024 · 5 comments

Comments

@tannisroot
Copy link
Contributor

I'm running my wyoming satellite on pi zero 2w and a ReSpeaker 2-Mics, which has a physical button.
Can it be possible to assign a feature to it, or at least expose it as an button entity? For example, I would love to assign the mute switch to it - muting is something every smart speaker has, and it's very inconvenient to activate it by going into Home Assistant settings.
Maybe, LED service could even be triggered to light up with red (if it supports that color?) when the button is activated, to indicate the mute functionality was activated.

@tannisroot tannisroot changed the title Make use of the button on Respeaker 2-Mics [Feature Request] Make use of the button on Respeaker 2-Mics Apr 13, 2024
@formatBCE
Copy link

+1 to this. Button is unused, i'd like to put some load on it.

@tonyis49
Copy link

I'm also running a wyoming satellite on a pi zero2w with a Respeaker 2-Mic hat and would like this feature to be added.
In the mean time I installed mosquitto and used a modified Seeedstudio button.py script to publish an mqtt topic when the Button is pushed, then with an automation in HA to mute/unmute the satellite. Works OK
Also modified the 2mic_leds.py to flash the leds when muted.

@LukeBH
Copy link

LukeBH commented Aug 26, 2024

I'm also running a wyoming satellite on a pi zero2w with a Respeaker 2-Mic hat and would like this feature to be added. In the mean time I installed mosquitto and used a modified Seeedstudio button.py script to publish an mqtt topic when the Button is pushed, then with an automation in HA to mute/unmute the satellite. Works OK Also modified the 2mic_leds.py to flash the leds when muted.

I'd love more details on how you achieved this please? Any chance of a write up somewhere perhaps?

@tonyis49
Copy link

I will try

@tonyis49
Copy link

Here is a quick and dirty explanation of what I did to make the mute button work on my Wyoming-satellite.
In HA:

  1. Install the MQTT integration as per the documentation.

  2. Add the following to the configuration.yaml:

sensor:

  • name: "Jarvis3 Mute Switch"
    unique_id: jarvis3_mute
    state_topic: "jarvis3/mute"

n.b. the name, id, and state topic can be anything you want. The state_topic must match
with what you will specify in the python script on the Wyoming-satellite.

  1. Create an automation as follows:

alias: Jarvis3 Mute
description: mute or unmute from hat button
trigger:

  • platform: mqtt
    topic: jarvis3/mute
    payload: "on"
    condition: []
    action:
    • action: switch.toggle
      metadata: {}
      data: {}
      target:
      entity_id: switch.my_satellite_mute
      mode: single

n.b. the name of the entity_id must be the entity name of the mute switch in your Wyoming protocol service for your Wyoming satellite in HA.

On the Wyoming-satellite:

  1. Install the mosquito-clients.
    sudo apt install -y mosquito.clients

  2. Copy the attached python script into your wyoming-satellite\examples folder.

mute_button.py.txt

Edit the 2 subprocess lines to match the topic name you have chosen, change the IP address to that of your HA, and the user name and password you setup in the MQTT integration. Rename to .py

n.b. you can run and test the script by navigating into the wyoming-satellite/examples folder and with the command python3 mute_button.py

  1. If the test is successful then you can make the script into a service so that it runs automatically.

sudo systemctl edit --force --full mute_button.service

Paste the following and change the /home/pi to match your setup:

[Unit]
Description=Mute button

[Service]
Type=simple
ExecStart=/home/pi/wyoming-satellite/examples/.venv/bin/python3 mute_button.py --uri 'tcp://127.0.0.1:10510'
WorkingDirectory=/home/pi/wyoming-satellite/examples
Restart=always
RestartSec=1

[Install]
WantedBy=default.target

  1. save the file and enable the service:
    sudo systemctl enable --now mute_button.service

  2. finally I modified the 2mic_service.py to flash the leds Red when the mute is activated.

2mic_service.py.txt

basically to import the PauseSatellite from wyoming.satellite (line 16) and to flash the leds RED (lines 130-136)

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

4 participants