After inspiration through several posts in the forum, I found the following solution for me.
in configuration.yaml I setup my internet radio:
media_player:
- platform: frontier_silicon
host: 192.168.178.77
name: Homeoffice
then added the following rest commands in configuration.yaml, too:
rest_command:
fs_nav_state_on:
url: "http://{{ ip }}/fsapi/SET/netremote.nav.state?pin=1234&value=1"
fs_nav_state_off:
url: "http://{{ ip }}/fsapi/SET/netremote.nav.state?pin=1234&value=0"
fs_select_preset:
url: "http://{{ ip }}/fsapi/SET/netRemote.nav.action.selectPreset?pin=1234&value={{ preset_no }}"
As next step I created an input_select via the GUI. The first entry is ‘None’ and the following entries are holding the names of my favourite internet stations in the same order as entered as preset in my device (via UNDOK). As name I typed “fs_presets_selector_homeoffice” and got Entity-ID “input_select.fs_presets_selector_homeoffice”. The input_select has to be added to the lovelace-window, then.
Then I added the following in scripts.yaml:
fs_select_preset_homeoffice:
alias: fs_select_preset_homeoffice
sequence:
- service: media_player.turn_on
data:
entity_id: media_player.homeoffice
- service: media_player.select_source
data:
entity_id: media_player.homeoffice
source: "Internet radio"
- service: rest_command.fs_nav_state_on
data:
ip: "192.168.178.77:80"
- service: rest_command.fs_select_preset
data_template:
ip: "192.168.178.77:80"
preset_no: >
{% if is_state("input_select.fs_presets_selector_homeoffice", "ANTENNE BAYERN") %} 0
{% elif is_state("input_select.fs_presets_selector_homeoffice", "Regenbogen Zwei") %} 1
{% elif is_state("input_select.fs_presets_selector_homeoffice", "BAYERN 1 Mainfranken") %} 2
{% endif %}
- service: rest_command.fs_nav_state_off
data:
ip: "192.168.178.77:80"
This script turns on the radio, sets it into navigation mode, sends the number of the station (0, 1, 2) which was selected and finally turns navigation mode off.
The last step was creating two automations. First I tried it via GUI and then edited it in automations.yaml as follows:
- id: '1609346860154'
alias: Auto_select_Preset_Homeoffice
description: ''
trigger:
- platform: state
entity_id: input_select.fs_presets_selector_homeoffice
condition:
condition: not
conditions:
- condition: state
entity_id: input_select.fs_presets_selector_homeoffice
state: 'None'
action:
- service: script.fs_select_preset_homeoffice
data: {}
mode: single
- id: '1609428102356'
alias: 'Auto_select_Preset_Homeoffice_None'
description: ''
trigger:
- platform: state
entity_id: input_select.fs_presets_selector_homeoffice
to: "None"
condition: []
action:
- service: media_player.turn_off
data:
entity_id: media_player.homeoffice
mode: single
The first automation will be executed when a radio station is selected in input_select and then will switch to the choosen station. The second one turns off the radio, when ‘None’ is selected.
Hope it will help someone.
It would be nice to fill the input_select ‘automatically’ with the presets from the device. But this is beyond my capability at the moment.