[Solved] Google Assistant gives error, script executes properly

I’m getting the following error from Google Assistant…

…when executing this script:

backyard_activity:
  alias: Backyard Activity
  sequence:
  - service: input_select.select_option
    data:
      entity_id: input_select.activity_modes
      option: "Backyard"

But the script executes as expected.

No special options in configuration.yaml:

google_assistant:
  project_id: homey-automation
  api_key: !secret google_assistant_key

Any suggestions as to what might be wrong would be much appreciated. :slight_smile:

You haven’t shown that that script is exposed to Google Assistant?

Script seem to be exposed by default:

And the script does execute correctly, I just get the error for some reason that I can’t figure out. :sweat:

OK but can you SEE the script in Google Assistant>Home Control?? Is it listed there?

You could try an input_boolean exposed to Google and make that fire an automation to run the script…

I hadn’t thought to look for it there before, but after checking I think I see it. I’m seeing “Backyard Activity” listed so unless my Automations are exposed that would have to be the Script.

I’m actually using the input_select to fire an Automation. Would input_boolean work better?

Maybe… I do use input booleans to fire an automation. And of course the automation can fire the script.

Input booleans show just like regular switches and in the Google Home app, you see them on the opening screen and can trigger them by tapping on them whereas scenes can only be triggered by voice (activate backyard in your case)

Interesting. The whole reason I’m using input_select is to provide a ‘tapping’ option through HA.

I don’t want to lose that functionality but I suppose I could manipulate the input_select from an input_boolean. Do you think input_select is behind the error?

I doubt it. I use an input_select but not via a script…
Google Assistant is pretty good but I have heard many people say that they can’t get scripts to work in GA… although they generally also say that GA is not showing the scripts either.
There is no reason you can’t have an input_boolean, get that to trigger an automation which triggers a script and have an input_select in the lovelace as well.
Just remember if there is no ‘off’ action for the input_boolean, you’ll want to have the automation turn the input_boolean off as well as trigger the script so next time when you want to run the script again, you can use the same turn on command to do that.

Can I expose the input_select directly to GA?
The only reason I’m using a Script is to access the input_select – I don’t have any other use for it.

nope. see here https://www.home-assistant.io/components/google_assistant/#available-domains
input_select isn’t a domain.
You can use an automation to call an input select though.

So expose the Automation through an input_boolean – basically just substituting it for the current Script? …and have the Automation manipulate the input_select?

yes. give that a go

OK, I’ll try that. If I’m following correctly this would give me buttons in GA while still retaining my drop-down list in HA.
Cool! This sounds like a better configuration even if it doesn’t resolve the error. :slight_smile:

Thanks DavidFW1960, I’ll report back…

yes it will definitely do exactly that. Yes - you will def like the option of tapping a button in Google Home if you want to as well as having your input select. (make sure input_boolean is exposed)

Good call – I almost overlooked that. :sweat_smile:

This works beautifully, and the error is gone too! :smiley:


input_boolean:

backyard:
  name: "Backyard"

automation:

- alias: "Backyard Mode On"
  initial_state: true
  trigger:
    platform: state
    entity_id: input_boolean.backyard
    to: "on"
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.activity_modes
        option: "Backyard"

I also added an Automation for input_boolean “off” – effectively making Inside Mode the default – so the buttons presented for the various Modes can be useful (assuming inside is our next destination).

automation:

- alias: "Backyard Mode Off"
  initial_state: true
  trigger:
    # When "Backyard" Input Boolean is turned Off...
    platform: state
    entity_id: input_boolean.backyard
    to: "off"
  action:
    # select "Inside" Activity Mode
    - service: input_select.select_option
      data:
        entity_id: input_select.activity_modes
        option: "Inside"

And within each Automation executed from the input_select I’m turning off every non-selected input_boolean.

automation:

- alias: "Backyard Activity"
  initial_state: true
  trigger:
    platform: state
    entity_id: input_select.activity_modes
    to: "Backyard"
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.driveway, input_boolean.front_yard, input_boolean.inside, input_boolean.party, input_boolean.sleeping, input_boolean.traverse
...

Thanks for all of your help, DavidFW1960. You da man! :sunglasses:

1 Like

Your last automation… you can add that action to your other automation… there can be multiple actions if that suits your purposes.

Input_booleans are so bloody useful and mostly overlooked…

1 Like

I actually have several other actions in that last Automation, I just truncated it to avoid any confusion for other readers.

I haven’t tested it yet but my hope is that the button states in GA will also update whenever I change the input_select in HA…?

it will show if the input_boolean is on or off but in my experience, it will only ’ read’ the state when you open it up - which is like everything else in there.

1 Like

Yep, I just tested it and you’re exactly right (again).

I had to refresh Google Home – which can only be done by swiping down from the top of the home screen (AFAIK). But, that could still be pretty useful, especially with multiple users.

This also made me realize that I need to add input_boolean “on” actions to my input_select Automations.