Convert your android Phone to Fake Chromecast and convert mediaplayer

Hello guys, after to read GitHub - skalavala/Multi-Room-Audio-Centralized-Audio-for-Home: 🎵 This Github Repository provides details on setting up a centralized audio system for your home using nothing but Raspberry Pi's and Old Speakers. @skalavala
i tried to find a cheaper solution, for create a multiroom áudio.
So i find the app android called “castreceiver” you can download it on playstore.

This is the code i use, many thanks a friend @Bob_NL

I want share that for all the people, who wants multiroom player with some old android phones or tablets.
PS: I use hass.io with modipy player and it Works.

----
Automation.yaml
-------

#VOLUME RADIO
     - alias: Controla o Volume do CastReceiver
    trigger:
      platform: state
      entity_id: input_number.volume_radio
    action:
      service: mqtt.publish
      data_template:
        topic: 'zanzito/rodolfo/notification'
        payload_template: '{{states.input_number.volume_radio.state | int}}'

…………………….
 input_select.yaml
……………………

estacoes_de_radio:
  name: 'Seleciona a estacao de Radio:'
  options:
    - Orbital
    - Oxigenio
    
zona_onde_toca:
  name: 'Seleciona a zona onde toca:'
  options:
    - Sala
    - Hall de entrada
  initial: Sala
  icon: mdi:speaker-wireless


…………………….
 scripts.yaml
……………………

radio:
  alias: Play Radio on Chromecast Audio
  sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.NAME_OF_YOUR_PLAYER
       volume_level: '0.35'
    -  service: media_player.volume_set
       data:
         entity_id: media_player.NAME_OF_YOUR_PLAYER
         volume_level: '0.20'
    -  service: media_player.play_media
       data_template:
         entity_id: >
           {%- if is_state('input_select.zona_onde_toca', 'Hall') -%}
              media_player.NAME_OF_YOUR_PLAYER
           {%- elif is_state('input_select.zona_onde_toca', 'Sala') -%}
              media_player.NAME_OF_YOUR_PLAYER
           {%- endif -%}
         media_content_id: >
            {%- if is_state('input_select.estacoes_de_radio', 'Orbital') -%}
               http://stream.radio.com.pt/ROLI-ENC-401
            {%- elif is_state('input_select.estacoes_de_radio', 'Oxigenio') -%}
               http://stream.radio.com.pt/ROLI-ENC-498
            {%- endif -%}
         media_content_type: 'audio/mp3'

……………………………

customize.yaml
…………………….

script.radio:
  friendly_name: Play
  icon: mdi:play

--------
groups.yaml
……………………

    radio:
  name: Rádio
  entities:
    - input_select.estacoes_de_radio
    - input_select.zona_onde_toca
    - script.radio
    - input_number.volume_radio
   - media_player.NAME_OF_YOUR_PLAYER
4 Likes

Hi, thank you for sharing your project!

I installed this castreceiver and successfully pair it as chromecast on Hass.io and after changing my radio script I can make the streams play!

But I ran into some issues, the radio volume bar doesn’t change the sound and I can not stop the stream/radio from Hass I have to stop it manually on the device, have you experience this issues aswell?

hello friend how are you.
yes… there a issue with castreceiver.
as castreceiver not is a player of home assistant. we need to do a trick,

we need install tasker on the same phone where you installed castreceiver and make this:

first modify your code:

  • alias: Controla o Volume do CastReceiver
    trigger:
    platform: state
    entity_id: input_number.volume_radio
    action:
    service: mqtt.publish
    data_template:
    topic: ‘zanzito/rodolfo/notification’
    payload_template: ‘{{states.input_number.volume_radio.state | int}}’

if you not use ZANZITO notifier, and you use pushbullet, telegrama or other modify for you.
the secret is … you need receiver one notification with the value of input_number.volume
‘{{states.input_number.volume_radio.state | int}}’

after these apps:

tasker :https://drive.google.com/file/d/0Bx5iCI7ZrD0dZ3NTNHd1Tm5uNHM/view?usp=sharing
plugin autonotifier: https://drive.google.com/open?id=0Bx5iCI7ZrD0dcW02cy1VdkQ4MTQ
es explorer: https://play.google.com/store/apps/details?id=com.estrongs.android.pop&hl=pt_PT

after when you installed All.
OPEN es explorer and search the folder “tasker” click it
and follow the way tasker/configs/user/
and past inside folder “user” this: https://drive.google.com/file/d/12dDzFkxbjDJiWRjd180AGwLr1EAX5Bd9/view?usp=sharing

after that close the app es explorer and open
the app tasker

after open app tasker:
click on right top on PREFERENCES
and TAB “ui” BEGINNER MODE" put not check other words DESELECT that.

click back

and click again on righ top
now not click on the PREFERENCE but click on “DATA”
after RESTORE
after USER LOCAL BACKUP

and restore the file “backup”

after go back

and all the configurations are ok

now when you move the slider of volume…
the HA send you one notify…
your phone receive the notify “1” 2 3 or other,
and tasker adjust volume your phone :wink:

2 Likes

Thank you!!

And for stopping the media do you have any workaround?

Is modipy being used for the radio?

for stopping you can use

radio_pause:
alias: Parar o rádio na zona seleccionada
sequence:
- service: media_player.media_pause
data_template:
entity_id: >
{%- if is_state(‘input_select.zona_onde_toca’, ‘Cozinha’) -%}
media_player.Cozinha
{%- elif is_state(‘input_select.zona_onde_toca’, ‘Sala’) -%}
media_player.Sala
{%- endif -%}

Thanks, got it working!

just struggling with the volume since the tablet I am using isn’t compatible with Zanzito, Pushbullet or Telegram -.-

i dont understand.
Can not you install the telegram or other on the tablet?

Hi, everyone

Sice home assistant core at version 2022.8.X the divice is not suported in home assistant. Enyone are use CAST RECEIVER with this version?

Thakns