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'
……………………………
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 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