Add Speaker amplifier switch and removed click sound from substitutions

This commit is contained in:
Edward Firmo
2024-12-26 21:59:31 +01:00
parent f3b84e9d4e
commit 3cf6a11bc7
2 changed files with 35 additions and 16 deletions

View File

@@ -33,6 +33,10 @@ media_player:
i2s_comm_fmt: msb # Experimental - It was 'lsb' until v2024.12.12
dac_type: external
mode: mono
mute_pin:
number: GPIO26
inverted: true
allow_other_uses: true
script:
- id: !extend dump_config
@@ -48,4 +52,16 @@ script:
// Identify itself
ESP_LOGCONFIG("addon_media_player", "Add-on Media Player installed");
switch:
- id: sw_speaker_amplifier
name: Speaker - Amplifier
platform: gpio
pin:
number: GPIO26
inverted: true
allow_other_uses: true
restore_mode: RESTORE_DEFAULT_ON
internal: true
entity_category: config
...

View File

@@ -16,21 +16,6 @@ substitutions:
# d=32 (32nd note), o=5 (octave 5), b=100 (tempo 100)
tone_volume_change: "scale_up:d=32,o=5,b=100:c,c#,d#,e,f#,g#,a#,b" # Use "none" to disable sound
click_sound: |-
[
0x01,0x02,0x04,0x06,0x07,0x08,0x08,0x06,0x01,0xFA,0xF4,0xEF,0xEE,0xF1,0xF7,0xFF,0x07,0x0E,
0x11,0x11,0x10,0x0C,0x06,0xFF,0xF8,0xF1,0xEC,0xEA,0xEC,0xF2,0xF9,0xFF,0x05,0x0A,0x10,0x14,
0x17,0x17,0x14,0x0B,0xFD,0xED,0xE0,0xD9,0xDB,0xE6,0xF7,0x0A,0x19,0x20,0x1E,0x14,0x05,0xF4,
0xE5,0xDF,0xE4,0xF4,0x0C,0x24,0x36,0x3D,0x35,0x20,0xFF,0xDD,0xC0,0xAE,0xA9,0xB0,0xC4,0xE0,
0x03,0x26,0x48,0x62,0x70,0x6D,0x59,0x35,0x08,0xD8,0xAC,0x8D,0x80,0x85,0x9C,0xC1,0xF0,0x21,
0x4E,0x6F,0x7F,0x7A,0x63,0x3D,0x0F,0xE0,0xB7,0x9B,0x90,0x96,0xAC,0xCE,0xF6,0x1D,0x3C,0x50,
0x55,0x4D,0x3A,0x20,0x04,0xEC,0xD8,0xCC,0xC9,0xCD,0xD8,0xE8,0xF9,0x0A,0x17,0x1F,0x20,0x1C,
0x12,0x07,0xFC,0xF2,0xEC,0xEB,0xED,0xF3,0xFA,0x02,0x0A,0x10,0x12,0x12,0x0E,0x07,0xFE,0xF5,
0xED,0xEA,0xEB,0xEF,0xF7,0x00,0x0A,0x10,0x13,0x12,0x0F,0x09,0x02,0xFB,0xF5,0xF3,0xF2,0xF3,
0xF6,0xFB,0xFF,0x03,0x05,0x07,0x08,0x07,0x05,0x03,0x01,0xFF,0xFE,0xFC,0xFB,0xFB,0xFC,0xFC,
0xFD,0xFE,0xFF,0x00,0x01,0x02,0x02,0x01
]
packages:
core_hw_audio: !include TX-Ultimate-Easy-ESPHome_core_hw_audio.yaml
@@ -104,7 +89,25 @@ script:
then:
- speaker.play:
id: speaker_embedded
data: !lambda return std::vector<uint8_t>(${click_sound});
data: [0x01,0x02,0x04,0x06,0x07,0x08,0x08,0x06,0x01,0xFA,0xF4,
0xEF,0xEE,0xF1,0xF7,0xFF,0x07,0x0E,0x11,0x11,0x10,0x0C,
0x06,0xFF,0xF8,0xF1,0xEC,0xEA,0xEC,0xF2,0xF9,0xFF,0x05,
0x0A,0x10,0x14,0x17,0x17,0x14,0x0B,0xFD,0xED,0xE0,0xD9,
0xDB,0xE6,0xF7,0x0A,0x19,0x20,0x1E,0x14,0x05,0xF4,0xE5,
0xDF,0xE4,0xF4,0x0C,0x24,0x36,0x3D,0x35,0x20,0xFF,0xDD,
0xC0,0xAE,0xA9,0xB0,0xC4,0xE0,0x03,0x26,0x48,0x62,0x70,
0x6D,0x59,0x35,0x08,0xD8,0xAC,0x8D,0x80,0x85,0x9C,0xC1,
0xF0,0x21,0x4E,0x6F,0x7F,0x7A,0x63,0x3D,0x0F,0xE0,0xB7,
0x9B,0x90,0x96,0xAC,0xCE,0xF6,0x1D,0x3C,0x50,0x55,0x4D,
0x3A,0x20,0x04,0xEC,0xD8,0xCC,0xC9,0xCD,0xD8,0xE8,0xF9,
0x0A,0x17,0x1F,0x20,0x1C,0x12,0x07,0xFC,0xF2,0xEC,0xEB,
0xED,0xF3,0xFA,0x02,0x0A,0x10,0x12,0x12,0x0E,0x07,0xFE,
0xF5,0xED,0xEA,0xEB,0xEF,0xF7,0x00,0x0A,0x10,0x13,0x12,
0x0F,0x09,0x02,0xFB,0xF5,0xF3,0xF2,0xF3,0xF6,0xFB,0xFF,
0x03,0x05,0x07,0x08,0x07,0x05,0x03,0x01,0xFF,0xFE,0xFC,
0xFB,0xFB,0xFC,0xFC,0xFD,0xFE,0xFF,0x00,0x01,0x02,0x02,
0x01]
- wait_until:
condition:
not: