Announcing Dynamic Modes and Toggles

OCT 22, 2019
Posted by Dave Smith, Developer Advocate

Modes and toggles let you define the configurable attributes of your device that may exist outside the standard grammar for device control traits (such as On/Off or Start/Stop). This feature is often used to express device-specific settings, such as the "load size" for a clothes washer or the "cooking mode" for an oven.

When we initially introduced modes and toggles, we supported a whitelisted set of names and synonyms to ensure the most accurate responses and best user experience. Over time, we continued to add support based on the community's requests, but getting these requests approved has been a common pain point for many of you.

Starting today, you no longer have to get the names and synonyms provided in your SYNC response approved. The Google Assistant dynamically determines the necessary grammar for users to invoke these traits. If you're not already familiar with modes and toggles, here is an example using these traits to add support for custom cooking modes to an oven.

{
      availableModes: [{
      name: 'cook',
      name_values: [{
      name_synonym: ['cook setting'],
      lang: 'en'
      }],
      settings: [{
      setting_name: 'pizza',
      setting_values: [{
      setting_synonym: ['pizza'],
      lang: 'en'
      }]
      }, {
      setting_name: 'pasta',
      setting_values: [{
      setting_synonym: ['pasta'],
      lang: 'en'
      }]
      }]
      }],
      }

      

Example modes in SYNC response

Controlling

Controlling a device using modes and toggles

We're excited to see what you build with these improved modes and toggles! For more details on using these features, see the updated guides for the Modes Trait and Toggles Trait. To share your thoughts or questions, join us on Reddit at r/GoogleAssistantDev.

Follow @ActionsOnGoogle on Twitter for more of our team's updates, and tweet using #AoGDevs to share what you’re working on.