esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

Why does make_call for #5103

Closed alpauna closed 10 months ago

alpauna commented 10 months ago

The problem

Trying to get url out of media_player but even getting current volume level is not working here is my code:

i2s_audio:
  i2s_lrclk_pin: GPIO27
  i2s_bclk_pin: GPIO25 

media_player:
  - platform: i2s_audio
    name: Office Media Player
    id: office_media_player
    dac_type: external
    i2s_dout_pin: GPIO26
    mode: stereo
    on_state:
      - logger.log:
          format: "The volume is %.1f"
          args: [ 'id(office_media_player).make_call().get_volume()']

With this code I get strange results like this

[14:17:13][D][media_player:059]: 'Office Media Player' - Setting
[14:17:13][D][media_player:063]:   Command: PAUSE
[14:17:13][D][main:201]: The volume is 0.0
[14:17:14][D][media_player:059]: 'Office Media Player' - Setting
[14:17:14][D][media_player:063]:   Command: PLAY
[14:17:14][D][main:201]: The volume is 1.8
[14:17:14][D][media_player:059]: 'Office Media Player' - Setting
[14:17:14][D][media_player:063]:   Command: PAUSE
[14:17:14][D][main:201]: The volume is 6.4
[14:17:15][D][media_player:059]: 'Office Media Player' - Setting
[14:17:15][D][media_player:063]:   Command: PLAY
[14:17:15][D][main:201]: The volume is 1.8
[14:17:16][D][media_player:059]: 'Office Media Player' - Setting
[14:17:16][D][media_player:063]:   Command: PAUSE
[14:17:16][D][main:201]: The volume is 1.8
[14:17:17][D][media_player:059]: 'Office Media Player' - Setting
[14:17:17][D][media_player:063]:   Command: PLAY
[14:17:17][D][main:201]: The volume is 1.8

Not sure what I am doing wrong here...

Which version of ESPHome has the issue?

2023.10.6

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.11.2

What platform are you using?

ESP32

Board

ESP WROOM 32

Component causing the issue

media_player

Example YAML snippet

Write current volume and url to logger. Currently junk is output which tells me I am missing a pointer somewhere! New to this platform and probably doing something stupid.

Anything in the logs that might be useful for us?

[14:17:13][D][media_player:059]: 'Office Media Player' - Setting
[14:17:13][D][media_player:063]:   Command: PAUSE
[14:17:13][D][main:201]: The volume is 0.0
[14:17:14][D][media_player:059]: 'Office Media Player' - Setting
[14:17:14][D][media_player:063]:   Command: PLAY
[14:17:14][D][main:201]: The volume is 1.8
[14:17:14][D][media_player:059]: 'Office Media Player' - Setting
[14:17:14][D][media_player:063]:   Command: PAUSE
[14:17:14][D][main:201]: The volume is 6.4
[14:17:15][D][media_player:059]: 'Office Media Player' - Setting
[14:17:15][D][media_player:063]:   Command: PLAY
[14:17:15][D][main:201]: The volume is 1.8
[14:17:16][D][media_player:059]: 'Office Media Player' - Setting
[14:17:16][D][media_player:063]:   Command: PAUSE
[14:17:16][D][main:201]: The volume is 1.8
[14:17:17][D][media_player:059]: 'Office Media Player' - Setting
[14:17:17][D][media_player:063]:   Command: PLAY
[14:17:17][D][main:201]: The volume is 1.8

Additional information

Wondering about getting song info, but for now I would be happy just to return the current url.

ssieb commented 10 months ago

make_call() is for controlling the media player, not getting information. You can't get the current url.