111 lines
2.7 KiB
YAML
111 lines
2.7 KiB
YAML
# ===== Physical Buttons =====
|
|
# Note: esp32_touch is not supported on ESP32-S3 with ESP-IDF.
|
|
# Wire physical momentary buttons to these pins (active LOW with internal pullup).
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: ${btn_vol_up_pin}
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Volume Up"
|
|
on_press:
|
|
- lambda: |-
|
|
float vol = min(1.0f, id(volume_level) + 0.1f);
|
|
id(volume_level) = vol;
|
|
id(spk).set_volume(vol);
|
|
- rtttl.play:
|
|
id: volume_beep
|
|
rtttl: "beep:d=32,o=6,b=180:c"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
brightness: 100%
|
|
effect: "none"
|
|
- delay: 150ms
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Idle Breathe"
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: ${btn_vol_down_pin}
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Volume Down"
|
|
on_press:
|
|
- lambda: |-
|
|
float vol = max(0.0f, id(volume_level) - 0.1f);
|
|
id(volume_level) = vol;
|
|
id(spk).set_volume(vol);
|
|
- rtttl.play:
|
|
id: volume_beep
|
|
rtttl: "beep:d=32,o=5,b=180:c"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
brightness: 30%
|
|
effect: "none"
|
|
- delay: 150ms
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Idle Breathe"
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: ${btn_mute_pin}
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Mic Mute"
|
|
on_press:
|
|
- switch.toggle: mic_mute
|
|
|
|
- platform: gpio
|
|
pin:
|
|
number: ${btn_wake_pin}
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Wake"
|
|
on_press:
|
|
- if:
|
|
condition:
|
|
switch.is_off: mic_mute
|
|
then:
|
|
- voice_assistant.start:
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Listening Pulse"
|
|
else:
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Error Flash"
|
|
- delay: 500ms
|
|
- light.turn_on:
|
|
id: led_bar
|
|
red: 100%
|
|
green: 30%
|
|
blue: 0%
|
|
brightness: 50%
|
|
effect: "none"
|
|
|
|
# ===== Mic Mute Switch =====
|
|
switch:
|
|
- platform: template
|
|
id: mic_mute
|
|
name: "Microphone Mute"
|
|
icon: "mdi:microphone-off"
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_OFF
|
|
on_turn_on:
|
|
- voice_assistant.stop:
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "none"
|
|
- light.turn_on:
|
|
id: led_bar
|
|
red: 100%
|
|
green: 30%
|
|
blue: 0%
|
|
brightness: 50%
|
|
on_turn_off:
|
|
- light.turn_on:
|
|
id: led_bar
|
|
effect: "Idle Breathe"
|
|
- voice_assistant.start: |