Hi,
I’ve got ESP32 with DFPlayer connected. It is working correctly only if I’ve got enabled logs via WiFi (opened window in HA). If the log window is not displayed, there is no sound.
ESPHome code:
esphome:
name: gospodarcze
platform: ESP32
board: esp32doit-devkit-v1
captive_portal:
logger:
uart:
tx_pin: 16
rx_pin: 17
baud_rate: 9600
dfplayer:
api:
services:
- service: dfplayer_next
then:
- dfplayer.play_next:
- service: dfplayer_previous
then:
- dfplayer.play_previous:
- service: dfplayer_play
variables:
file: int
then:
- dfplayer.play: !lambda 'return file;'
- service: dfplayer_play_loop
variables:
file: int
loop_: bool
then:
- dfplayer.play:
file: !lambda 'return file;'
loop: !lambda 'return loop_;'
- service: dfplayer_play_folder
variables:
folder: int
file: int
then:
- dfplayer.play_folder:
folder: !lambda 'return folder;'
file: !lambda 'return file;'
- service: dfplayer_play_loop_folder
variables:
folder: int
then:
- dfplayer.play_folder:
folder: !lambda 'return folder;'
loop: true
- service: dfplayer_set_device_tf
then:
- dfplayer.set_device: TF_CARD
- service: dfplayer_set_device_usb
then:
- dfplayer.set_device: USB
- service: dfplayer_set_volume
variables:
volume: int
then:
- dfplayer.set_volume: !lambda 'return volume;'
- service: dfplayer_set_eq
variables:
preset: int
then:
- dfplayer.set_eq: !lambda 'return static_cast<dfplayer::EqPreset>(preset);'
- service: dfplayer_sleep
then:
- dfplayer.sleep
- service: dfplayer_reset
then:
- dfplayer.reset
- service: dfplayer_start
then:
- dfplayer.start
- service: dfplayer_pause
then:
- dfplayer.pause
- service: dfplayer_stop
then:
- dfplayer.stop
- service: dfplayer_random
then:
- dfplayer.random
- service: dfplayer_volume_up
then:
- dfplayer.volume_up
- service: dfplayer_volume_down
then:
- dfplayer.volume_down
Logs:
[17:52:55][C][api:143]: Using noise encryption: NO
[17:52:56][D][dfplayer:032]: Send Command 0x9 arg 0x02
[17:52:56][D][dfplayer:032]: Send Command 0x3 arg 0x05
Sequence in HA:
1)
service: esphome.gospodarcze_dfplayer_set_device_tf
data: {}
service: esphome.gospodarcze_dfplayer_play
data:
file: 5
Version:
[17:52:54][I][app:102]: ESPHome version 2022.6.2 compiled on Sep 16 2022, 17:44:12
Do you have any idea what could be wrong?