Help cinema mode (sequence)

Hello everyone. I need you to help me finish this automation that I don’t know how to solve. The first problem I have is that I would like to activate the cinema_mode automation with a voice command that can be from a google-mini or an echo-dot. The other problem I have is with a home theater not responding to the first go command. I try to send a go command every second until the home theater (bdv_n9200w) is on. I hope someone can help me finish this automation and I thank you as always for the help of this forum.

automation:
  - alias: modo_cine
    trigger:
      - platform: state
        entity_id: ?? (voice command)
    action:    
      - service: light.turn_off
        target:
          entity_id: 
            - light.comedor
            - light.led_strip
      - service: media_player.turn_on
        target: 
          entity_id: media_player.samsung_tv
      - call-service: 
        service: script.home_theatre
script:
  home_theatre:
    - wait_template: "{{ is_state('media_player.bdv_n9200w', 'on') }}"
      timeout: 10
      continue_on_timeout: false  
    - sequence:
      - service: remote.send_command
        target:
          entity_id: remote.broadlink_m3_comedor
        data:
          command: b64:JgDsAE4VJBYVEyYVERUnFRMUExQSFBI+ERYmFhEXJRUSAALFThsgFRIWJxMVFCUhCRESFxEXEBQTFxAZIxURFSQYEgACxk8UJhUTFCgTEhYnExIWEhQTFREWDxgTFCYVEhohFxAAAs9MGiMTFBYnFBEWJRcRFhEVEhUTFxAUEhUnFQ8XJxURAALPTxUmFBMUJhUSGSMVExQSFhMdCRURFxAYIhgSFCYWEgACzU8VJRwKGCIYEBglFRIXEBUTFBMWEBYSFyMVExUmGA8AAs9PFCYVEhQlGw8TJRcTFhEUFBMTFRIVExYkFxEUJhURAA0FAAAAAAAAAAAAAAAA
      - wait_for_trigger:
          - platform: state
            entity_id: media_player.bdv_n9200w
            to: "on"
            for: 3
        timeout: "{{ wait.remaining }}"
        continue_on_timeout: false

With regards a google voice trigger, easiest way is to make a button helper in home assistant. Then expose this button to google home.

In google home make a routine triggered by a voice command of your choice and choose the action to be the button. I think the button can be found under “adjust home devices” from memory.

Then adjust your automation to be triggered by the button press.

I understand everything. I still can’t get it to appear in the helper button in google home or in echo dot. I exposed it in google assistant in nabu casa and it does not appear in google home app.
It doesn’t actually show up on either google or echo dot. I have many entities that were discovered but this button does not appear. Echo dot promptly tells me that a new device was discovered. But this button did nothing.

OK, so you have made a button helper in home assistant and exposed this to google via nabu casa, correct?

Yes. But normally when I create an entity it is automatically discovered. But this was not discovered.

OK, if you are expecting it to show up in the main google home app it wont, you will need to make a google routine as stated and select “adjust home devices” and it should be listed under there!

Take a look and report back

I went to Google Home.

  1. Add a routine with a name.
  2. I chose action by.voice and put a text
  3. I chose what the routine does (turn something on)
  4. Choose device for the action and all the devices I have appear there but the button does not? The button creates it as an assistant in Home Assistant

If you check the button entity in nabu case exposed entities you will notice it shows up as a scene.

There for you need to select adjust scenes in the google home action not turn something on. It’s a scene because it’s a button so does not have an actual on / off state.

I exposed the scene but in google home it still does not appear.
I even added it to an area to find it easier and it doesn’t appear.

Sin título

What’s listed under “Adjust Environment” ?

Why use routines? Just create a input_boolean and expose the input_boolean. Call the input_boolean “input_boolean.cinema_mode” and have the automation trigger off the switch and then "Hey Google Turn on cinema mode. The automation can then also flip the switch back to off when its done.

If you stay away from ‘google centric’ mixing of routines and such, you’ll have a far easier experience.

If there are mutiple modes (theatre, tv, etc) you can also use a input_select instead. and then you can say "Hey Google Set the Cinema mode to ‘theatre’ or whatever is in the input_select.

After you create the input_boolean, your automation will be like this:

automation:
  - alias: modo_cine
    trigger:
      - platform: state
        entity_id: input_boolean.xxxx
        to: 'on'
    action:    
      - service: light.turn_off
        target:
          entity_id: 
            - light.comedor
            - light.led_strip
      - service: media_player.turn_on
        target: 
          entity_id: media_player.samsung_tv
      - call-service: 
        service: script.home_theatre
      - service: homeassistant.turn_off
        data: {}
        target:
          entity_id: input_boolean.xxxx

Hello friends. @rossk thank you very much for the help.
Thanks to the help you are giving me, I managed to get it working halfway. The home theater sometimes does not turn on. So try to make it send a go command every few seconds.
@calisro I misunderstood the issue of input_select. If I expose an input_select entity do I get several voice commands? I don’t quite understand what you explained to me. Sorry but I do not speak English.
So far what I’ve done is create a routine in google home and that triggers the input_boolean.

automation:
  - alias: modo_cine
    trigger:
      - platform: state
        entity_id: input_boolean.google_modo_cine
        to: 'on'
    action:    
      - service: light.turn_off
        target:
          entity_id: 
            - light.comedor
            - light.led_strip
      - service: script.modo_cine
script:
  modo_cine:
    sequence:
      - alias: "Encender home theater"
        if:
          - condition: state
            entity_id: media_player.bdv_n9200w
            state: "off"
        then:
          - service: script.bdv_n9200w_on_off
      - alias: "Encender tv samsung"
        if:
          - condition: state
            entity_id: media_player.samsung_tv
            state: "off"
        then:
          - service: script.samsung_tv_on_off

  bdv_n9200w_on_off:
    sequence:
      - repeat:
          count: 3
          sequence:
            - service: remote.send_command
              target:
                entity_id: remote.broadlink_rm3_comedor
              data:
                command: b64:JgDsAE4VJBYVEyYVERUnFRMUExQSFBI+ERYmFhEXJRUSAALFThsgFRIWJxMVFCUhCRESFxEXEBQTFxAZIxURFSQYEgACxk8UJhUTFCgTEhYnExIWEhQTFREWDxgTFCYVEhohFxAAAs9MGiMTFBYnFBEWJRcRFhEVEhUTFxAUEhUnFQ8XJxURAALPTxUmFBMUJhUSGSMVExQSFhMdCRURFxAYIhgSFCYWEgACzU8VJRwKGCIYEBglFRIXEBUTFBMWEBYSFyMVExUmGA8AAs9PFCYVEhQlGw8TJRcTFhEUFBMTFRIVExYkFxEUJhURAA0FAAAAAAAAAAAAAAAA
            - delay:
                seconds: 1

  samsung_tv_on_off:
    sequence:
      - service: remote.send_command
        target:
          entity_id: remote.broadlink_rm3_comedor              
        data:
          command: b64:JgDSAJSUEzcTNxM2ExITEhITExITEhM3EzcTNhMSExITEhMSExITEhM2ExITEhITEhMSExMSEzcSExM2EjgTNxM3EzYUNhMABgWTlRM3EjcTNxMSExMSEhITExITNhM3EjgTEhITExITEhMSEhITNxMSExISExMSExISExM2EhMTNxM3EzcTNBU3EjgTAAYElZMTNxM3EjgTEhMRExISExMSEjgTNxM2ExISExITExISExITEzcSEhMSExISExMSEhMTNxMSEzYTNxM3EzcSOBM2EwANBQAAAAAAAA==

I’m saying, you don’t need a routine at all. Simply create a input_boolean.cinema_mode helper. Expose that to google_assistant. And then you can simply say 'Hey Google Turn on Cinema Mode". No routine required.

your automation then would have a trigger for input_boolean.cinema_mode when it turns on to run your automation like my example above.

automation:
  - alias: modo_cine
    trigger:
      - platform: state
        entity_id: input_boolean.cinema_mode
        to: 'on'
    action:    
      - service: light.turn_off
        target:
          entity_id: 
            - light.comedor
            - light.led_strip
      - service: media_player.turn_on
        target: 
          entity_id: media_player.samsung_tv
      - call-service: 
        service: script.home_theatre
      - service: homeassistant.turn_off
        data: {}
        target:
          entity_id: input_boolean.cinema_mode

Ah perfect. Understood. It’s working fine but the home theater doesn’t always turn on. Is the script I made ok? It can improve? I’d like you to try until it’s on.