Closed therobster121 closed 9 months ago
That's interesting! The last update changed the select source a bit because it now loads the source options from the device instead of hardcoding them.
I'll try recreate the issue and investigate.
First an explanation why the error was thrown:
In the select_source
method, it looks for the given source in the source dictionary. In version 0.3, I changed this so it's created from the Eversolo response. This means that it's now language specific. It looks like this:
{
"XMOS": "Interner Player",
"BT": "Bluetooth-Eingang",
"USB": "USB-C-Eingang",
"SPDIF": "Optischer Eingang",
"RCA": "Koaxialer Eingang"
}
The select_source
method used the next
method to look for the given source value, e.g., 'Interner Player' in german, in the dictionary. If it doesn't find it, it will throw a StopIteration
exception. For some reason it can't find the source that you have given. However, I didn't find any bug in the implementation.
I don't like that a service called from a template stops working with a hardcoded source if you change the language of the Eversolo device. Because of this, I introduced the following changes in Version 0.3.2:
select_source
both accepts the key or the value from the dictionary shown above. This means that in my example you could call it with source XMOS
or Interner Player
.
select_source
now raises a ValueError
instead of a StopIteration
when the source is not found.Looking forward to your feedback! Chris
Thanks Chris
It works now I also realise that I was using “Internal Player” which was working before but it should now be “Internal player” for the EN version so therefore was case sensitive.
I think Eversolo are actually inconsistent in the naming but we can’t do anything about that.
I think you can close the issue.
On Sun, 17 Dec 2023 at 8:11 pm, Christian Horn @.***> wrote:
First an explanation why the error was thrown: In the select_source method, it looks for the given source in the source dictionary. In version 0.3, I changed this so it's created from the Eversolo response. This means that it's now language specific. It looks like this:
{ "XMOS": "Interner Player", "BT": "Bluetooth-Eingang", "USB": "USB-C-Eingang", "SPDIF": "Optischer Eingang", "RCA": "Koaxialer Eingang" }
The select_source method used the next method to look for the given source value in the dictionary. If it doesn't find it, it will throw a StopIteration exception. For some reason it can't find the source that you have given. However, I didn't find any bug in the implementation.
I don't like that a service called from a template stops working with a hardcoded source if you change the language of the Eversolo device. Because of this, I introduced the following changes in Version 0.3.2:
- select_source both accepts the key or the value from the dictionary shown above. This means that in my example you could call it with source XMOS or Interner Player. image.png (view on web) https://github.com/hchris1/Eversolo/assets/34690225/8d0f6346-a44a-4bbe-89a9-f3a3465e5e26 image.png (view on web) https://github.com/hchris1/Eversolo/assets/34690225/7f2c0304-74c1-46f9-aca7-e07723999a24
- select_source now raises a ValueError instead of a StopIteration when the source is not found.
Looking forward to your feedback! Chris
— Reply to this email directly, view it on GitHub https://github.com/hchris1/Eversolo/issues/27#issuecomment-1859081258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMB3GFK4PUXTNCGZ53OECLDYJ2ZMBAVCNFSM6AAAAABAX4KOJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGA4DCMRVHA . You are receiving this because you authored the thread.Message ID: @.***>
Describe the issue
Since last update when I attempt to change source to a specific source via a template I get the following error. "Failed to call service media_player/select_source. coroutine raised StopIteration"
when changing source via the eversolo media player control it works fine.
Reproduction steps
content: Mediaplayer music entity: media_player.eversolo icon: mdi:music icon_color: tap_action: action: call-service data: source: Internal Player service: media_player.select_source target: entity_id: media_player.eversolo type: template