Custom component - AirMusic radio

Status updates with version 1.3:

  • Drop down menu is gone again.
  • :previous_track_button: works to set sleep timer in 15 minutes incremental.
  • Sleep timer is displayed in instance correctly.
  • Turning off the radio on instance does not reset the timer displayed in the instance that resumes counting on a non set sleeper timer.

Happy Debugging! :slight_smile:

Reload the integration to see if drop down menu is back, I did not change anything with the code there so it should and is working on my radios.

I have not thought about turning off the radio and resetting timer :upside_down_face: should be easy to do and in the next release.

v1.4 is out - the timer is reset when radio is turned off and added an:
EXPERIMENTAL feature, media browser is available, had no luck with local media or tts playback but some radio stations from radio browser work!

Yes the drop down menu is back after integration reload.

Status update with version 1.6:

  • timer does reset on power-off (as expected does not happen if you power-off directly on the radio, but if power-on aguin by the end of the timer the radio does turn off)
  • When on media browser mode for music’s stored on HA media Radio tries to access HA without credentials making and notice error:
Login attempt or request with invalid authentication from 192.#radio's IP (192.#radio's IP). See the log for details.

The Log:
Logger: homeassistant.components.http.ban
Source: components/http/ban.py:135
integration: HTTP (documentation, issues)
First occurred: 5:40:45 PM (1 occurrences)
Last logged: 5:40:45 PM
Login attempt or request with invalid authentication from 192.#radio's IP(192.#radio's IP). Requested URL: '/media/local/Teste.mp3?authSig=w3lIXJzBJig91pcIvWI0VzYDI1ViXVGcVyvni5VmEINGZOBGiAiIkONOGGAhMiGIzGjOhUJZispcieRab6lISICVbzhvTnUIUjRb.WM9dh#fakestingJjwOjcGWDONZOYwIykedsYu'. (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322-Magic))

Happy Debugging! :slight_smile:

  • when using radios timer to turn off the radio it would not update correctly the state in HA, that is why when using the timer from the integration it will turn off the radio from the integration. You have to remember to use on or the other, they don’t mix and match.

  • the authentication part may be a problem, but I did not have this error. Do you have something in your configuration.yaml referring to http? This said I am pretty sure the local file play will not work with or without authentication.

  • does radio browser work for you?

  1. sure I was aware just wanted to confirm.
  2. no mentions to http? on my configuration.yaml
  3. I do not have Radio browser installed on my HA server, will install and feedback.

I’ve menaged to play local files from my NAS on the radio via Home Assistant, it works without the this integration :crazy_face:

First set up DLNA Media Server (if your NAS supports it), then setup DLNA Media Renderer find your airmusic radio. Then when set up hit configure and check show incompatible media when browsing. Now via the media browser you can play local songs via DLNA to your radio. The radio will have a seperate entity name, and while playback is active I can’t find any info about playback from the radio, so I won’t be able to add this to my integration.

I can confirm that Radio browser also works for me. and in the past I have already used my NAS to stream to radio though DLNA but the Radio interface for that is very inconvenient. I think I remember a radio URL with this playback info but I’m not sure. I’ll look into it.

I’ve tried using DLNA and proxy in my integration to get local files to play, both are dead end. DLNA is super unstable with this radio and maybe one file can start play but then nothing works. Proxy would not get any file to play.

I am out of ideas right now.

UPnP was the answer! Version 1.7 is out!

  • play from NAS files via DLNA server should work, the radios should also work in Music Assistant. This is an experimental feature and not everything may work.

If the mp3 file has name and artwork it will show up in HA:
Przechwytywanie

Also some tts services work!

Add new favourite station:

https://github.com/DominikWrobel/airmusic/tree/main/remote

With this script, helpers and shell_command you can add a new favourite station directly to your radio form Home Assistant!

First add three helpers:

  • input_select named Radio IP and add your radio IPs to select (you can skip this if you have only one Airmusic radio)
  • imput_text named Station Name
  • input_text named Station URL

Add a new shell_command to your configuration.yaml:

shell_command:
  add_radio_station: >
    curl -H 'Authorization: Basic c3UzZzRnbzZzazc6amkzOTQ1NHh1L14=' 
    'http://{{ states("input_select.radio_ip") }}/AddRadioStation?name={{ states("input_text.station_name") | urlencode }}&url={{ states("input_text.station_url") | urlencode }}'

If you have only one Airmusic radio change {{ states(“input_select.radio_ip”) }} to your radio IP.

Creat a new script and paste this:

alias: Add new station
sequence:
  - service: shell_command.add_radio_station
    data: {}
  - service: persistent_notification.create
    data:
      title: Radio Station Added
      message: >
        Added station "{{ states("input_text.station_name") }}"  with URL "{{
        states("input_text.station_url") }}"  to radio at {{
        states("input_select.radio_ip") }}
description: ""
icon: mdi:radio

Restart Home Assistant. Then add in any dashboard you want an entities card with this code, with one radio station skip the input_select part:

type: entities
entities:
  - entity: input_select.radio_ip
  - entity: input_text.station_name
  - entity: input_text.station_url
  - entity: script.add_new_station

nowa

Fill out all the fields and hit run, you will get a notification that new station has been added. Remember to reload the Airmusic integration to see the new station in your media_player card!

Are you able to play mp3 from HA Media Sources?

In v1.7 you can play mp3 from any DLNA server (like my NAS), you need to install DLNA media server integration and set it up. Then in local media sources you have this:

From DLNA servers mp3 files play without any problem, from My media with the same NAS set up files will not play. Files from My media have encryption key sent with them and the radio can’t handle it.

If you can’t set up DLNA server maybe try Music Assistant add on, I’ve tried it and it did work, but I did not run any longterm tests.

I can confirm DLNA Media Server integration does solve the issue.

1 Like

Thx! Also working with Albrecht DR450 (DAB radio).

1 Like