Error trying to use media_player.select_source

I have an Onkyo receiver integrated with my HA installation. Just recently, I got a notification that I should remove this from my config file and that it had been automatically added to the UI (or some such phrase).

After this change though, I get an error every time run a script (which has been working fine for months until this change) that executes a media_player.selelct_source action.

This is the error I’m seeing:

Error: cannot access local variable 'source_lib_single' where it is not associated with a value

Investigating further, I found that I am now also getting similar results when I try to do the same thing from the Developer tool → Actions section:

image

However - if I go to the device itself (see screenshot below) and change source from there, it works fine.

This started happening after the Onkyo integration change occurred. Any ideas?

I fixed it by remapping the options on the onkyo integration page. It seems to be case sensitive, when targetet from lovelace.

I don’t really understand what you’re suggesting I should do, but interestingly my config page has just these two sources:

image

I don’t remember why, but this is how I had it configured before the change:

# media_player:
#   - platform: onkyo
#     host: 192.168.59.236
#     name: Bedroom
#     receiver_max_volume: 200
#     sources:
#       dvd: "Shield"
#       cd: "PiCorePlayer"

Wild Guess: On the popup from your screenshot try to set the last entry to “CD”

You set your input source to CD (which probably worked before) in the action call.

In the integration option it tries to map “CD — TC/CD*” to PiCorePlayer and therefore the script target is not found. Set the “PiCorePlayer” to CD in the options and you are probably fine

1 Like

Yup - that fixed it. Thanks for the help!

Great. Switching to my custom names like Sonos, XBox and so on does fix it.