Monday, 4 February 2019

Home Automation with Google Home Routines

The Google Home is a great concept, and if you want to do something simple, it is great.  If you want to be a little more clever, however, there are several gotchas.

Setup

Broadlink Mini 3 IR Sender

tv - Television Device (Panasonic TV, from the library)
hifi - Custom Device (Denon Hifi, Manually configured)
tv on - Scene to turn on TV using a Discrete ON sequence (learned from a raspberry Pi, rather than the remote, which doesn't have discrete on/off codes), turns on the hifi, mutes the TV, and switches the hifi to use the TV output.
tv off - Scene to turn off the TV and Hifi using Discrete OFF sequences

Philips Hue

5 Light bulbs around the house
tv lights - Scene to set the lights in the living room for TV watching

Google Home

Routine: "tv on, turn on the tv, turn the tv on"
Activate Scenes: "tv on", "tv lights"
Say: "OK, Television is On"

Actions and Responses

1. OK Google, TV On
This turns on the TV, Hifi, and routes the audio as needed, and says "OK, Television is On"

2. OK Google, Turn the TV On
This turns the TV on, but just the TV

3. OK Google, Turn the TV On
This turns the TV off

4. OK Google, Turn on the TV
This responds with "OK, Executing 3 scenes", and promptly executes "tv on", "tv off" and "tv lights"

Analysis

The Google Home is trying to be clever, and looks for devices or sequences which have the matching device type, or contain the name.

1: works because the keyword "turn on", or "activate" etc. is not used.
2: finds a device of type 'TV' (the name in this case is irrelevant), and sends the programmed 'on/off' sequence.
3: As 2, but because the TV was already on, and the device has an 'on/off' control button on the remote, actually turns the device off, rather than on.
4: This searches for matching scenes, rather than devices, and finds 3 scenes with the name TV in them.

Changes Stage 1

First thing to change is to remove the tv device from the Broadlink Mini, and re-install it as a custom device, so that the underlying system does not know that it is a TV.  Also, give it a different name.

Broadlink Mini 3 IR Sender

pana - Custom Device (Panasonic TV, Manually configured)
hifi - Custom Device (Denon Hifi, Manually configured)
tv on - Scene to turn on TV using a Discrete ON sequence (learned from a raspberry Pi, rather than the remote, which doesn't have discrete on/off codes), turns on the hifi, mutes the TV, and switches the hifi to use the TV output.
tv off - Scene to turn off the TV and Hifi using Discrete OFF sequences

Philips Hue

5 Light bulbs around the house
tv lights - Scene to set the lights in the living room for TV watching

Google Home

Routine: "tv on, turn on the tv, turn the tv on"
Activate Scenes: "tv on", "tv lights"
Say: "OK, Television is On"

Changes Stage 1, Actions and Responses

5. OK Google, Turn on the Television
This turns on the TV, Hifi, and routes the audio as needed, and says "OK, Television is On"

Analysis Stage 1

5: This now turns on the TV as expected, because there is no longer a device of type 'TV' and there are no scenes containing the name "television".

Changes Stage 2

The next set of changes is to remove the name 'tv' from any device name or sequence.

Broadlink Mini 3 IR Sender

p99 - Custom Device (Panasonic TV, Manually configured)
d99 - Custom Device (Denon Hifi, Manually configured)
p99on - Scene to turn on TV using a Discrete ON sequence (learned from a raspberry Pi, rather than the remote, which doesn't have discrete on/off codes), turns on the hifi, mutes the TV, and switches the hifi to use the TV output.
p99off - Scene to turn off the TV and Hifi using Discrete OFF sequences

Philips Hue

5 Light bulbs around the house
h99lights - Scene to set the lights in the living room for TV watching

Google Home

Routine: "tv on, television on, turn on the tv, turn the tv on"
Activate Scenes: "p99on", "h99lights"
Say: "OK, Television is On"

Stage 2, Actions and Responses

6. Say "OK Google, TV On"
6. Say "OK Google, Television On"
6. Say "OK Google, Turn on the TV"
6. Say "OK Google, Turn the TV On"
This turns on the TV, Hifi, and routes the audio as needed, and says "OK, Television is On"

Stage 2, Analysis

6: This now works, because there are no matching devices, names or scenes.

Conclusion

The google home has a pecking order in which it processes requests, and it looks like:

1. Is there a matching device, and if so, does it have the required controls needed (e.g. on/off)
2. Are there any matching scenes
3. Is there a matching routine

For the first option, any inadequacies in the device itself (e.g. toggling power, rather than discrete on/off) show themselves.  This also means that other activities within the routine cannot be executed (e.g. a routine which would both turn on a hifi, set the volume and input to a chromecast audio, and stream a specific radio channel).

For the second step, if the exact scene is not named, all matching scenes are executed. It is possible to turn off the TV by saying "OK Google, turn on tv off" if there is a scene called "tv off", but it isn't very intuitive.

The last step is the most flexible, but it is essential that the possibility of matches at previous steps is eliminated.

Recommendations

1. Don't use a specific device type where possible (e.g. don't select a TV device, select a generic one)
2. Don't use names of the devices for the devices or any scenes associated with the device
3. Add all possible commands to the routines

Request from Google that routines can be set to a higher priority in the pecking order.




No comments:

Post a comment