issues icon indicating copy to clipboard operation
issues copied to clipboard

dfplayer automatically raises volume

Open 5in4 opened this issue 8 months ago • 1 comments

The problem

The audio volume is raised to max after starting playback. Changing volume works, after it ist reset to max about 1 second after.

There are no automations connected to this entity running in home assistant.

Which version of ESPHome has the issue?

2024.6.1

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

2024.6.3

What platform are you using?

ESP32

Board

esp32dev

Component causing the issue

dfplayer

Example YAML snippet

substitutions:
  name: esphome-web-a52754
  friendly_name: esphome-web-a52754

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'
  on_boot: 
    then:
      - dfplayer.play_mp3: 1
      - dfplayer.set_volume: 6

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Allow Over-The-Air updates
ota:
  - platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  #ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
#captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
#esp32_improv:
#  authorizer: none

## To have a "next url" for improv serial
web_server:

uart:
  tx_pin: GPIO26
  rx_pin: GPIO27
  baud_rate: 9600

button:
  - platform: template
    name: "Play Audio"
    id: play
    icon: "mdi:play"
    on_press:
      - dfplayer.play_mp3:
          file: 1
  - platform: template
    name: "Stop Audio"
    id: stop
    icon: "mdi:stop"
    on_press:
      - dfplayer.stop

number:
  - platform: template
    name: "Volume"
    id: "volumeSlider"
    step: 1
    min_value: 0
    max_value: 30
    mode: slider
    icon: "mdi:volume-high"
    optimistic: true
    restore_value: true
    on_value:
      then:
        - dfplayer.set_volume: !lambda 'return x;'

dfplayer:

api:

Anything in the logs that might be useful for us?

[12:16:56][D][number:054]: 'Volume' - Setting number value
[12:16:56][D][number:113]:   New number value: 9.000000
[12:16:56][D][number:012]: 'Volume': Sending state 9.000000
[12:16:56][D][dfplayer:032]: Send Command 0x6 arg 0x09
[12:16:58][D][number:054]: 'Volume' - Setting number value
[12:16:58][D][number:113]:   New number value: 0.000000
[12:16:58][D][number:012]: 'Volume': Sending state 0.000000
[12:16:58][D][dfplayer:032]: Send Command 0x6 arg 0000

Additional information

This issue is not new with this version. It seems to have worked with the 2024.04 release, but I cannot pin it down to a specific version.

The console output above is after setting the volume to 0, the actual volume is at max.

5in4 avatar Jun 20 '24 10:06 5in4