I have tried both from an automation and from a script. My test script is:
alias: Linkplay volume_set test
sequence:
- service: media_player.volume_set
data:
volume_level: 0.23
mode: single
media_player:
- platform: linkplay
host: 192.168.3.195
name: Linkplay Music
icecast_metadata: 'Off'
sources: {
'https://stream.qmusic.nl/qmusic/aachigh': 'Qmusic',
'https://19993.live.streamtheworld.com/SKYRADIO.mp3': 'Sky Radio',
'https://21253.live.streamtheworld.com/RADIO538.mp3': '538',
'http://19993.live.streamtheworld.com/RADIO10.mp3': 'Radio 10',
'bluetooth': 'Bluetooth',
'line-in': 'Line-in',
}
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 218, in __call__ return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 337, in _exec v = func(v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 215, in _run return self._exec(self._compiled, value, path)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 339, in _exec v = func(path, v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data)
File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 134, in validate raise vol.Invalid("must contain at least one of {}.".format(", ".join(keys)))
TypeError: sequence item 0: expected str instance, Optional found