Ask Alexa Rooms/Groups

The Unofficial SmartThings Blog
Jump to: navigation, search

The Rooms/Groups is an extension to Ask Alexa, the popular SmartThings community developed add in. You must be running Ask Alexa to use the Rooms/Groups. More information about Ask Alexa can be found here: Ask Alexa

Similar to the native groups within the Amazon Echo web site or mobile app, with the Rooms/Groups extension you can take groups of devices and place them together into one overall group. For example, if you have four lights within your living room area and you wish to control all of them at once, you would set up a room/group, putting all four devices into the 'room'. When you address the room to turn on, off, or toggle, the lights in that entire room will respond. In addition, you are not limited to just single types of devices. A room or group can have all kinds of switches, doors and locks in it. You simply address the function you want and the app will operate the correct devices. You can also query the room/group and get the current status of the devices you have chosen. This could potentially save you from having to create a voice report for the same function.

Summary

Room.png

Category: Ask Alexa Extension - Requires Ask Alexa

Author:Michael Struck --MichaelStruck (talk) 00:01, 1 January 2016 (EST)

ST Community handle: https://community.smartthings.com/users/michaels/activity

Latest Version

The latest version this extension (as of 5/11/18)
Ask Alexa Extensions Area Used Version Location
Message Queue Code SmartThings IDE 1.0.4b https://github.com/MichaelStruck/SmartThingsPublic/blob/master/smartapps/michaelstruck/ask-alexa-rooms-groups.src/ask-alexa-rooms-groups.groovy

Ask Alexa Extension Code Installation

To install the extension use the code located here:

   https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/smartapps/michaelstruck/ask-alexa-rooms-groups.src/ask-alexa-rooms-groups.groovy

The steps for installation of the extensions are almost exactly the same as Ask_Alexa#Ask_Alexa_Code_Installation:

  • Copy the raw code from the GitHub link above
  • Go to the SmartThings IDE page and log in
  • Click the My SmartApps link
  • Click the +New SmartApp link
  • Click the From Code tab
  • Paste the GitHub code in the open area
  • Click Create from the bottom left corner
  • Save the code using the button in the upper right-hand corner of the page
  • There is no need to do any OAuth settings on extension code.
   Please Note:
   You DO NOT need to publish the extension code; however, there is no harm in doing so. 
   Simply be aware that if you publish it the extension will show up in the 
   SmartThings Marketplace. However, you should NOT install it from there...
   Ask Alexa will utilize this child code from the main (parent) application.

Room/Group Setup

To create a new room/group, find the green button labeled <<Create A New Room/Group...>> within the <<Ask Alexa Extensions>><<Rooms/Groups Reports>> area.

AaRoom1.png

Start off like any other extension or macro: first, name the room/group. Please note you can create aliases for your rooms/groups as well. This might be useful for rooms that can be addressed in multiple ways, such as bedrooms (i.e. Master bedroom might have an alias of just 'bedroom')

Room Controls

AaRoom2.png

After you name the room or group, you can then choose the items within the group. The most common use will be to control the lighting of a room with one command. Unlike the Ask Alexa main menu, switches have only one input area for not only on/off switches but dimmers, colored lights and Kelvin (temperature) lights. The controls for these different types of devices is context-based. In other words, if you turn on or off (or toggle) the lights, they will all do that activity; however, if you set the color of the lights, only those lights that can accept color changes will be affected. If you have Kelvin (temperature) white lights, you will need to select the <<Utilize Kelvin Temperature Settings>> so that when you use 'soft white' or 'cool white' that the proper temperature settings are sent to the light.

In addition to the Kelvin light options, you also have different options for the default dimmer value or the default color when simply turning on the devices. In addition, if you want different lights to respond to the 'ON' commands than the 'OFF', you can set up an option for that as well under the <<Lighting Options>>. In the example below, if the "ON" command is given, all lights in the list will come on except the items listed; however, if an "OFF" command is given, the "Kitchen Sink" light will not react.

AaRoom2-5.png

In addition to lights, you can also choose to control window shades, locks and doors. Again, the commands are context-based...even though you say unlock a room, only the locks will respond.

For each of the device types, you have the option of including the selected devices when you ask for the status of the group.

Switches On, Off, Toggle ex. <"Alexa, ask SmartThings to toggle the {Room/Group Name}">
Dimmers On, Off, Toggle and Level settings ex. <"Alexa, ask SmartThings to set {Room/Group Name} to 50%">
Colored Lights On, Off, Toggle, Level settings and Color <"Alexa, ask SmartThings to set {Room/Group Name} to blue and 50%">
Thermostats* Cooling/Heating Setpoints <"Alexa, ask SmartThings to set cooling of {Room/Group Name} to 67 degrees>
Window Shades** Open, Close <"Alexa, ask SmartThings to open the {Room/Group Name}">
Temperature (Kelvin) Lights On, Off, Toggle, Level settings and Color Temperature <"Alexa, ask SmartThings to set {Room/Group Name} to Cool White">
Locks Lock, Unlock <"Alexa, ask SmartThings to lock the {Room/Group Name}">
Doors Open, Close <"Alexa, ask SmartThings to open the {Room/Group Name}">
Passwords, if enabled in the parent app under <<Settings>>, can be enabled on a per-category basis (open/close for doors, lock/unlock for locks)

*Please note: If you have thermostats and dimmers (or colored lights) in the same room, you will be given the option to choose which is the default action when set a value (level or temperature). If you choose dimmers as the default, you must put 'cooling' or 'heating' in the command to ensure you change thermostat. Future versions will expand on the capability to open or close specific items within a room.

**Also note: If you have doors and window shades in the same room, you will be given the option to choose which is the default action when open or close are issued. You may also choose to have both react to the action. Future versions will expand on the capability to open or close specific items within a room.

   Additional Thermostat Notes
   Currently, only changing the temperature of the rooms (when the proper commands are given),
   is supported in the Rooms/Groups extension. Changing the thermostat mode or any device
   specific commands (such as Nest, Ecobee or StelPro) are NOT supported. This will require
   additional directives and commands to be implemented. This activity IS on the road map,
   but as of version 1.0.0, you may only change the thermostat setpoint or get the status
   of the temperature or setpoint in the status request.

Room Status

AaRoom3.png

You can invoke the status report by simply saying:

   <"Alexa, ask SmartThings about {Room Name}">. 

For items you can control (switches, locks, etc) you can specify whether they are included in the status report. If any sensors appear in the sensor area, they will be included automatically, unless you limit the output to only certain conditions (i.e. Locks unlocked, water sensors sensing moisture, etc).

Temperature If more than one sensor is selected the output will be the average temperature reading of all of the devices
Humidity If more than one sensor is selected the output will be the average humidity reading of all of the devices
Motion Sensors You can have all sensors report, or only when movement is sensed
Occupancy Sensors You can have all sensors report, or only when the sensor is reading 'occupied'
Open/Close You can have all sensors report, or only when a sensor reads an 'open' condition
Water You can have all sensors report, or only when moisture is sensed

Command Options

AaRoom4.png

Room "IN HERE" Commanding

In version 2.3.9+ of Ask Alexa (1.0.4+ of the Rooms/Groups extension) you have the ability to recognize which Echo (Alexa) device you are speaking to. With this new feature, you also have the ability to associate the speakers with a room or group, allowing for even more natural commands for the room/group.

Assigning An Echo To A Room

To assign an Echo device to a room, you must first have a room/group created with Ask Alexa. For this example, let's use the Room/Group "Office" in which you have an open close sensor on the window, and a single light (a dimmer). We will also assume your invocation name is "smart things".

To assign the Echo device to the office simply say: <"Alexa, tell smart things to associate this echo with the office">. A simpler, more robotic way of saying this is <"Alexa, tell smart things associate office">.

   Please Note
   An Echo device can only be associated with one room. Dual associations 
   are not permitted. 

You can find the associations that each room has by checking your smart app under the individual Room/Group under <<Room/Group Aliases>>. To verbally check if a speaker is associated with a room, simple say <"Alexa, ask smart things about this echo device">

AARoomEchoList.png

Referencing An Associated Room

For the most part, controlling a room when you have an Echo associated with it is similar to a room without an association. However, the syntax is a bit more natural, and less commands are required. Using the example from about where you have an office with a dimmable light and an open close sensor, you can use the following commands, substituting 'in here' or 'this room' for "Office"

Command Used Result
<"Alexa, tell smart things to turn off the lights in here"> The lights will go off
<"Alexa, tell smart things to turn off in here"> Same as above. The lights will go off
<"Alexa, ask smart thing about this room"> The rooms will give a status report based on how you set up the status reporting.
<"Alexa, tell smart things to set the dimmers to 20% in here"> The lights will go to 20%
<"Alexa, tell smart things to set it blue in here"> Nothing will occur...there are no colored lights in this room
   Please note:
   Some of the wording for the rooms is still in beta. For example, in the syntax
   <"Alexa, tell smart things to turn off the lights in here"> the 'lights' 
   piece of this syntax is actually ignored. These are currently included in
   the utterance to allow for flexible commands; however, saying ANY noun (i.e 
   switches, locks, lights, etc) is ignored. In the future, this will be changed
   so you can say give a number command and a 'noun group' to differentiate
   the types of devices you are addressing. For example <'set the temperature to 55'>
   will be treated differently than <'set the lights to 55'>>. Currently, you have to 
   choose which devices a numeric command will affect.

Assigning Permissions Based On Echo

Outside of the benefits of using 'In here' as a shortcut to commanding a room, you can also set restrictions based on the Echo device you are speaking to. To do this, first associate at least one Echo with a room/group. Then go to <<Main Menu>><<Settings>><<Personalization>><<Playback Options/Restrictions>>. There you will find options for muting and even disabling commands globally in Ask Alexa. You can do this by time of day, day of the week, or even the Echo you are speaking to.

AHResitrictions.png

This is convenient for those that want to limit access to the controls in a room (i.e. A child's room) or have the commands execute but give no feedback (Like in a baby's room). For more information about these restrictions, see Ask_Alexa#Playback_Options.2FRestrictions

You can also restrict PINs based on a variety of restrictions including which Echo device is being addressed.

   Echo device ID Limitation
   The ID associated with each of the Echo devices is based on the skill used.
   Therefore, if you change/rebuilf your skill, or use a 'room skill' (coming soon), you  
   will find that a single Echo device might have different Echo IDs. Therefore,
   you may have to reset a room or add multiple Echo devices to a single room for all
   of your skills to operate correctly.

Removing An Echo From A Room

If you inadvertently add an Echo device to a room that you didn't intend to, or simply want to remove an association, you can do that from the individual room/group. Going into the <<Room/Group Aliases>> you will find all of the speakers associated with that particular room/group. You can NOT (at this time) delete individual associations; however, you can delete all of the Echo devices associated with that room. Once you delete them, tap the area to take you back to the main Rooms/Groups menu and then tap <<Save>> at the top of the screen.

AARoomEchoList.png

   Please Note:
   Because of limitations of the SmartThings interface, if you delete an association of 
   an Echo Device to a room, and that room was used in a restriction in other parts of
   Ask Alexa, you will have issues with those restrictions as you have effectively 'orphan'
   the device. It is very important that you remove the restrictions from other areas of
   Ask Alexa before you remove the association. While the interface will assist you in 
   identifying Echo devices that have been orphaned, it is good practice to ensure you
   remove the devices from restrictions BEFORE you remove the room association.

Reminder About Amazon Developer Slots

Please remember ANY changes or additions you make to your Ask Alexa environment should immediately be followed up with running <<Settings>> <<Setup Variables>> in the main Ask Alexa SmartApp. This will allow newly created macros to be reflected in the Amazon developer site. See Ask_Alexa#Setup_Variables for more information.