cancel
Showing results for 
Search instead for 
Did you mean: 

Script Editor: How does device.state.AppSelector work?

V0idmain
Community Member

It looks like AppSelector can be used as a starter (which i find kind of fascinating...) but it doesn't seem to do anything. The docs are not clear to me on how to expect it to work.

The values in this script have been filled in through the auto-complete. When i run the script from the editor it works.

Expected: When opening the appselector specified application on the associated device, the actions will fire.

Actual: Nothing happens when selecting the application on the device.

Note:  If i use `device.state.OnOff` with the same device as the starter, the action does fire.

# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #

metadata:
  name: Youtube TV Light # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
  description: Scripted automation # Write a detailed description that includes everything the automation does, like “At sunset, on weekdays, close blinds, turn on lights to 50%, and play the sunset playlist on certain speakers.”

automations:
  # “starters” and “actions” are required; “conditions” are optional.
  # Use Ctrl + Space to see autocomplete suggestions.

  # ---- STARTERS ---- #
  # Starters describe events that will start the automation.
  # To add more than one starter, duplicate the "- type" section under "starters".
  # If you add multiple starter events, any one of them happening will start the automation
  starters:
    - type: device.state.AppSelector # This function is used for devices which are able to switch inputs. # Enables querying devices that can support complex lighting commands to change state, such as looping through various colors.
      state: currentApplication
      is: YouTube TV # Enables querying devices which are able to switch inputs.
      device: Kitchen TV - Kitchen
  # starters:
  #   - type: device.state.OnOff # This function is used for devices which are able to switch inputs.
  #     state: on
  #     is: true
  #     device: Kitchen TV - Kitchen

  # ---- ACTIONS ---- #
  # Actions will start when a starter event takes place and all conditions are met.
  # Actions will start in the order they appear in the script and with any delay specified.
  # To add more than one action, duplicate the "- type" section under "actions".
  actions:
    - type: device.command.BrightnessAbsolute # Adjust device absolute brightness.
      brightness: 10
      devices: Transamerica Pyramid - Dining Room
    - type: assistant.command.Broadcast
      message: watching youtube tv
      devices: Kitchen display - Kitchen

 

3 REPLIES 3

Yehonatan
Community Member

It doesn't seems to work for me as well.

typolike
Community Member

An App Selector is like a virtual gateway that lets you choose and switch between different applications (apps) on your device. Think of it as a tool that helps you navigate through the various programs or tools available on your smartphone, tablet, or computer.

Read the complete guide about what is Appselector and How does it work?

Thanks for jumping in. But I'm pretty sure your reference here is not relevant.