Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #####################################
- ## Online Radio Now Playing - REST ##
- #####################################
- ## NOTES:
- ## Due to some station does not support JSON, sensor.radio_now_playing will only display station name.
- ## Otherwise, it will include the now playing value from the REST sensors
- sensor:
- - platform: template
- sensors:
- radio_now_playing:
- friendly_name: "Radio Now Playing Title"
- icon_template: mdi:radio
- value_template: >-
- {% if is_state("input_select.radio_station", "Please Select") %} No station selected
- {% elif is_state("input_select.radio_station", "Mix FM") %} Mix FM - {{states.sensor.radio_mix_fm_now_playing.state}}
- {% elif is_state("input_select.radio_station", "Hitz FM") %} Hitz FM - {{states.sensor.radio_hitz_fm_now_playing.state}}
- {% elif is_state("input_select.radio_station", "Era FM") %} Era FM - {{states.sensor.radio_era_fm_now_playing.state}}
- {% elif is_state("input_select.radio_station", "Sinar FM") %} Sinar FM - {{states.sensor.radio_sinar_fm_now_playing.state}}
- {% else %} {{states.input_select.radio_station.state}}
- {% endif %}
- - platform: rest
- name: Radio Mix FM Now Playing
- resource: https://scraper2.onlineradiobox.com/my.mix
- value_template: '{{ value_json.title }}'
- scan_interval: 15 # adjust accordingly to avoid your IP being blocked if interval is too short.
- - platform: rest
- name: Radio Hitz FM Now Playing
- resource: https://scraper2.onlineradiobox.com/my.hitzfm
- value_template: '{{ value_json.title }}'
- scan_interval: 15 # adjust accordingly to avoid your IP being blocked if interval is too short.
- - platform: rest
- name: Radio Sinar FM Now Playing
- resource: https://scraper2.onlineradiobox.com/my.sinar
- value_template: '{{ value_json.title }}'
- scan_interval: 15 # adjust accordingly to avoid your IP being blocked if interval is too short.
- - platform: rest
- name: Radio Era FM Now Playing
- resource: https://scraper2.onlineradiobox.com/my.era
- value_template: '{{ value_json.title }}'
- scan_interval: 15 # adjust accordingly to avoid your IP being blocked if interval is too short.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement