Fixed Raspiaudio for ESPHome 2023.4.x.

This commit is contained in:
Marcus Scholz 2023-05-01 20:57:16 +02:00
parent 0b8d524602
commit e0e888870f
2 changed files with 125 additions and 17 deletions

View File

@ -82,12 +82,12 @@
message: Gute Nacht! message: Gute Nacht!
- service: media_player.play_media - service: media_player.play_media
target: target:
entity_id: media_player.raspiaudio_muse_luxe entity_id: media_player.raspiaudio_muse_luxe_player
data: data:
media_content_id: media-source://tts/picotts_remote?message=Gute+Nacht%21+Schlaf+gut. media_content_id: media-source://tts/picotts_remote?message=Gute+Nacht%2C+schlaf+gut.
media_content_type: provider media_content_type: provider
metadata: metadata:
title: Gute Nacht! Schlaf gut. title: Gute Nacht, schlaf gut.
thumbnail: https://brands.home-assistant.io/_/picotts_remote/logo.png thumbnail: https://brands.home-assistant.io/_/picotts_remote/logo.png
media_class: app media_class: app
children_media_class: children_media_class:
@ -96,7 +96,7 @@
- media_content_type: app - media_content_type: app
media_content_id: media-source://tts media_content_id: media-source://tts
- media_content_type: provider - media_content_type: provider
media_content_id: media-source://tts/picotts_remote?message=Gute+Nacht%21+Schlaf+gut. media_content_id: media-source://tts/picotts_remote?message=Gute+Nacht%2C+schlaf+gut.
- service: media_player.turn_off - service: media_player.turn_off
target: target:
area_id: area_id:
@ -159,6 +159,12 @@
- service: light.turn_on - service: light.turn_on
target: target:
device_id: 68868390eda35e969ec60a13020f2407 device_id: 68868390eda35e969ec60a13020f2407
data: {}
- service: tts.picotts_remote_say
data:
cache: true
entity_id: media_player.raspiaudio_muse_luxe
message: Ab ins Bett! Schlafenszeit!
mode: single mode: single
- id: '1623954512941' - id: '1623954512941'
alias: Licht im Schlafzimmer zum Aufwachen einschalten alias: Licht im Schlafzimmer zum Aufwachen einschalten
@ -450,14 +456,22 @@
- condition: state - condition: state
entity_id: person.marcus_scholz entity_id: person.marcus_scholz
state: home state: home
- condition: or
conditions:
- condition: state
entity_id: input_text.sleep_as_android
state: sleep_tracking_stopped
- condition: state
entity_id: input_text.sleep_as_android
state: alarm_alert_dismiss
action: action:
- service: tts.picotts_remote_say - service: tts.picotts_remote_say
data: data:
cache: true cache: true
entity_id: media_player.raspiaudio_muse_luxe entity_id: media_player.raspiaudio_muse_luxe_player
message: '{% set t = now().hour %} {% set m = ''Morgen'' if t < 12 else ''Nachmittag'' message: '{% set t = now().hour %} {% set m = ''Morgen'' if t < 12 else ''Nachmittag''
if t < 18 else ''Abend'' %} Guten {{m}} Marcus. Es ist gerade {{states.weather.zuhause.state}} if t < 18 else ''Abend'' %} Guten {{m}} Marcus. Draußen sind es {{states.sensor.temperatur_aussen.state}}
in Münster am {{states.sensor.date.state}} um {{states.sensor.time.state}} Grad Celsius und es ist {{states.sensor.time.state}}
' '
mode: single mode: single

View File

@ -1,10 +1,30 @@
substitutions: substitutions:
name: "raspiaudio-muse-luxe" name: "raspiaudio-muse-luxe"
packages: friendly_name: "RaspiAudio Muse Luxe"
raspiaudio.muse-luxe: github://esphome/media-players/raspiaudio-muse-luxe.yaml@main
esphome: esphome:
name: ${name} name: "${name}"
name_add_mac_suffix: false name_add_mac_suffix: False
project:
name: raspiaudio.muse-luxe
version: "1.0"
esp32:
board: esp-wrover-kit
framework:
type: arduino
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret apikey
ota:
password: !secret ota
i2c:
sda: GPIO18
scl: GPIO23
wifi: wifi:
ssid: Voltage-legacy ssid: Voltage-legacy
@ -17,16 +37,90 @@ wifi:
ssid: "Raspiaudio Fallback Hotspot" ssid: "Raspiaudio Fallback Hotspot"
password: !secret fallback_psk password: !secret fallback_psk
# Enable Home Assistant API captive_portal:
api:
encryption:
key: !secret apikey
ota: improv_serial:
password: !secret ota
external_components:
- source: github://pr#3552
components: [es8388]
refresh: 0s
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO5
media_player:
- platform: i2s_audio
name: ${friendly_name} Player
dac_type: external
i2s_dout_pin: GPIO26
mode: stereo
mute_pin:
number: GPIO21
inverted: true
es8388:
sensor: sensor:
- platform: adc
pin: GPIO33
name: ${name} Battery
icon: "mdi:battery-outline"
device_class: voltage
state_class: measurement
unit_of_measurement: V
update_interval: 15s
accuracy_decimals: 3
attenuation: 11db
raw: true
filters:
- multiply: 0.00173913 # 2300 -> 4, for attenuation 11db, based on Olivier's code
- exponential_moving_average:
alpha: 0.2
send_every: 2
- delta: 0.002
# WiFi signal strength # WiFi signal strength
- platform: wifi_signal - platform: wifi_signal
name: "WiFi Signalstärke" name: "WiFi Signalstärke"
update_interval: 60s update_interval: 60s
binary_sensor:
- platform: gpio
pin:
number: GPIO19
inverted: true
mode:
input: true
pullup: true
name: ${friendly_name} Volume Up
on_click:
- media_player.volume_up:
- platform: gpio
pin:
number: GPIO32
inverted: true
mode:
input: true
pullup: true
name: ${friendly_name} Volume Down
on_click:
- media_player.volume_down:
- platform: gpio
pin:
number: GPIO12
inverted: true
mode:
input: true
pullup: true
name: ${friendly_name} Play Button
on_click:
- media_player.toggle:
light:
- platform: fastled_clockless
name: ${friendly_name} LED
pin: GPIO22
chipset: SK6812
num_leds: 1
rgb_order: grb