Play Radio Browser automation through a user web page

Not entirely sure if this can even be done. I have a raspberry pi running in Kiosk mode to my HA. This is mainly for displaying some status screens, and camera feeds. What I would like to do is also have HA be able to send audio through the pi’s speakers. Most notably Radio Browser. Down the road some voice prompts for various triggers.

Is something like this possible? What would I be looking for to be able to play sound out of the Pi’s speakers?

Greg

Try out Browser Mod which adds a Media Player for the local Browser You will need the latest beta which you can select in HACS when downloading. The latest beta has updates for media_player and user interaction requirements. To be able to play audio it is likely you will need to interact with the device browser first, unless you can set it to automatically allow audio, which you can on Chrome Desktop.

Sounds good, what repository in HACS is Brower Mod?

browser_mod

Ah, got it. Put it on a dashboard, everything is showing up. Problem is the entity for the kiosk browser is greyed out.

Any ideas?

There is a beta which has some updates for media player and the need to interact. In any case you will likely need to tap the device once to play audio after a reload.

Just checked, i am running 2.4.0 is that the version i need? if not where do i get the beta version from?

In HACS, you can choose Redownload and then select a different version where you will see 2.4.1-beta.3

You are being awesomely helpful!!! I have got a lot further. I have 2.4.1-beta 3 installed. Not the Pi is showing up on my cast list. I can select it. So far so good…

The Pi is running in Kiosk mode so no one is really around. When I try to cast to it from my other device I get the following error:
failed to perform the action media_player/play_media. Validaion error. Cannot play audio in browser: KitchenPi {Correct name}. Please interact withthe browser first.

I am assuming this is the browser on the Pi. Will I have to do this every time, or is there still something to set up on the Kiosk?

Greg

P.S.
This is odd, I am getting this for all my cast devices now. This is stuff being played through the Radio Browser.
Even my automation for my talking clock is not saying anything. yaml for context:

alias: Say Time
description: ""
triggers:
  - trigger: time_pattern
    hours: "*"
    minutes: /15
    seconds: "0"
conditions:
  - condition: device
    type: is_on
    device_id: ad6a4f91bbb47df19ae20d7c8943536a
    entity_id: 1a05f6c763aa41761c95b18e6f3b9ced
    domain: switch
actions:
  - action: tts.picotts_say
    metadata: {}
    data:
      cache: true
      entity_id: media_player.kitchen_speaker_2
      message: It is {{  now().strftime("%H:%M") }}
mode: single

Error from talking clock: Error: BaseMediaPlayer.play_media() got an unexpected keyword argument ‘media_content_id’

Yes, but should only be once after the Browser ever is reloaded/refreshed. You should see the Browser Mod interaction icon which looks a bit like :point_up_2:, which will dissapear once you have interacted. You can always remotely check if iteraction is required by checking the state attribute of the Browser media player. e.g. in a template {{ state_attr('media_player.my_broswer', 'audio_interaction_required' }} which will be true if interaction is required or false otherwise.

Are these Browser Mod players? If not then Browser Mod should have no impact on success. After trying a TTS action, check the media player attributes in developer tools to see what source: attribute is, which is the URL sent to the media player. Make sure the URL is one your media player would be able to access. The URL base is based upon your Home Assistant URL in network settings.

EDIT: Missed this before. Check out this thread where it seems to be a new issue.

Hi there, Browser Mod is working great! My Google Nest speakers are still out, but that is a different issue.

I found out the problem I was having yesterday. Kind of a combo issue, the google nest stuff, and I lost all internet access on my network for 4 hours yesterday. Make it more confusing I usually use this forum on my Cellular tablet. When then LAN internet went down this switched to cellular so I did not even notice internet was down.

Greg

P.S. Yes your browser_mod is working perfectly now!

1 Like