Voice control

Time to cook: 60min

Difficulty: +++++




The Alexa Integration is covered in one of the basic recipes, if you have not executed that recipe yet, I advise you to do it first.

The openHAB Alexa Smart Home Skill allows you to control lights, thermostats and other connected items on a openHAB 2 system through the myopenHAB.org cloud service.

In this recipe explains how you can set up voice commands.




 

Ingredients


Prerequisites


Tools

 

The Building plan


Item configuration


To be able to use voice commands for a certain device, we have to create an Item list which includes ‘voice’ tags.


Note: Items represent capabilities that can be used by applications, either in user interfaces or in automation logic. Items have a State and they may receive commands. See chapter 2: OpenHab for more information.






Voice Tags follow the HomeKit tagging syntax.


Example:


To turn on/off a kitchen light using a voice command, we can use the “Lightning” tag. This will allow us to turn on/off the light or set the % (dim) .


The item file cloud look like:


Switch Kitchen_Light "Kitchen Light" ["Lighting"]


Example of voice commands that can be used in this case:

  • "Alexa, turn on the Kitchen Light"

  • "Alexa, turn off the Kitchen Light"

  • "Alexa, dim the Kitchen Lights to 30 percent"


Adding ‘voice tags’ to Items must be done manually (PaperUI does not support adding voice tags yet) by creating an Items file under /etc/openhab2/items.


Creating an items file


  • Start an SSH session to your Raspberry PI

  • cd /etc/openhab2/items

  • create a file called alexa.items

  • sudo nano alexa.items

  • copy/paste the following config in the file

  • Switch Kitchen_Light "Kitchen Light" ["Lighting"]

  • Save the file (ctrl-X)


Adding Items to the device channels


After you have created the items, we need to add the items to the corresponding channels of the Things. We can either define the channel in the items file


example:


Switch Kitchen_Light "Kitchen Light" <light> (gKitchen) ["Lighting"] {channel="..."}


or add the item to a channel in PaperUI.


  • Open PaperUI

  • In the Left menu, select Configuration/Things

  • Select the Thing representing your kitchen light

  • Select the Channel which turns on/off the kitchen light

  • Click on the ‘+’ sign under linked items

  • A window opens called ‘Link Channel’



  • Select the item to link (eg. Kitchen light)

  • Now you have successfully added the Item to the channel of your device.




Discover Items


Next we need to import the items in Alexa. This can be done by run the discover function within our Alexa account.


  • Login to your alexa account (alexa.amazon;com)

  • Select Smart Home from the menu on the left

  • Select Devices

  • Click Discover



Now Alexa is going to run a discover function, you will see the following screen:





When done, the item should be added to the discovery list within your Alexa account.




Testing the Voice Control


Now it’s time to test the set up.

When you say the magic words, "Alexa, turn on the Kitchen Light", the lights should turn on. "Alexa, turn off the Kitchen Light" will turn off the lights again.

You can now repeat the same for other devices in your home you want to control using your voice.

Besides sending commands to control your devices, you can query the status of a certain asset on a device. For example, if you have a device measuring the ambient temperature of a room, you can ask Alexa for the temperature value.

For example, a Daikin unit has the following assets:





To ask Alexa to report on the Indoor Temperature, add the following Item in an items list






1 view0 comments