Эта страница является
переводом страницы
Amazon Alexa. Перевод выполнен на 100%.
iRidium Skill for Amazon Alexa
voice control of equipment via Amazon Alexa and iRidium
documentation was last updated on 20.10.2021
Alexa is a voice assistance from Amazon, built in the Amazon Echo smart speaker and other devices, for example,
- Echo Plus,
- Echo Dot,
- Amazon Tap,
- Echo Sub,
- Echo Show,
- Fabriq Chorus and other Alexa-enabled devices by third-party manufacturers.
iRidium skill can understand several languages:
- English (US),
- English (UK),
- English (IN),
- French (France),
- German (Germany),
- Japanese (Japan).
Alexa can control smart home with the help of "iRidium" skill via iRidium cloud and iRidium server. You can say "Turn on light" and the lamp is turned on. You can say "Turn off light" and the lamp is turned off. It's easy!
Supported devices:
- dimmers and switches,
- door locks,
- entertainment devices such as smart TV-sets,
- smart home cameras,
- thermostats and fans,
- micro-wave ovens,
- and many others.
Working in iRidium studio
Adding a Driver and Devices
1 Create a server project.
2 Add Amazon Alexa Network driver to a project.
3 Add smart devices to the project.
4 Give devices those names that you want to say when talking to Alexa.
Feedback channels of devices can't be renamed.
Describing Devices and Feedback Channels
Amazon Alexa devices are not real devices they are just interfaces between real devices and Alexa. You are to realize functions of these devices in iRidium server or provide connection with physical devices via a protocol. iRidium provides interfaces with 4 types of devices:
- Switch
- Dock Station
- Dimmer
- HVAC
But you can work with other devices, as well. For example, you can realize control of a relay using a bunary device of the Switch type.
You do not have to use all feedback channels of devices, use only those that are required.
Switch
Examples of use:
| Feedback |
Description |
Actions |
Examples of voice commands
|
| Power |
On/Off state |
turnOn turnOff |
"Alexa, turn on switch" "Alexa, turn off switch"
|
Dock Station
Examples of use:
- dock-station,
- simple thermostat.
| Feedback |
Description |
Actions |
Examples of voice commands
|
| Level |
Number value |
setPercentage incrementPercentage decrementPercentage |
"Alexa, set dock station to fifty percents" "Alexa, raise dock station by five degrees" "Alexa, lower dock station by two percents"
|
Dimmer
Examples of use:
- 1-channel dimmer,
- electrical floor heater.
| Feedback |
Description |
Actions |
Examples of voice commands
|
| Power |
On/Off state |
turnOn turnOff |
"Alexa, turn on dimmer" "Alexa, turn off dimmer"
|
| Level |
Per cent |
setPercentage incrementPercentage decrementPercentage |
"Alexa, set dimmer to hundred percents" "Alexa, raise dimmer by five percents" "Alexa, lower dimmer by two percents"
|
HVAC
Examples of use:
- thermostat,
- conditioner,
- fan,
- electrical warm floor.
| Feedback |
Description |
Actions |
Examples of voice commands
|
| Power |
On/Off state |
turnOn turnOff |
"Alexa, turn on HVAC" "Alexa, turn off HVAC"
|
| Level |
Set value in per cent |
setPercentage incrementPercentage decrementPercentage |
"Alexa, set HVAC to fifty percent" "Alexa, increase HVAC by five percents" "Alexa, decrease HVAC by two percents"
|
| Target Temperature |
Set temperature in degrees |
setTargetTemperature incrementTargetTemperature decrementTargetTemperature getTargetTemperature |
"Alexa, set HVAC to thirty degrees" "Alexa, increase HVAC by five degrees" "Alexa, reduce HVAC by two degrees" "Alexa, make it warmer in here" "Alexa, make it cooler in here" "Alexa, what is HVAC target temperature?"
|
| Sensor Temperature |
Temperature from a sensor |
getTemperatureReading getTargetTemperature |
"Alexa, what HVAC temperature?"
|
| Cool Target Temperature |
The upper limit of temperature |
getTemperatureReading getTargetTemperature |
"Alexa, what temperature is my HVAC set to?"
|
| Heat Target Temperature |
The lower limit of temperature
|
| Temperature Mode |
Mode of work |
ThermostatMode |
Функция пока не поддерживается
|
TemperatureMode can take the following values:
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_AUTO,
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_COOLING,
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_DRY,
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_FAN,
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_HEATING,
- IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_OFF.
Use these constants to select the mode of work for a thermostat with the help of script.
Creating Script
The script provides accepting voice commands from Alexa and sends them to real devices.
To create a driver, do the following:
1 Create a server project *.sirpz;
2 Add a script, by pressing JS > + > New script.
3 Paste the following template to the script:
//Let's create a driver, four subdevices and log the name of the device from which the feedback came and its value
// Device creation (IR.DEVICE_AMAZON_ALEXA - device type)
var l_pDevice = IR.CreateDevice(IR.DEVICE_AMAZON_ALEXA, "Amazon Alexa");
if(l_pDevice)
{
/**
* SubDevice creation
* Params:
* 1. Name of SubDevice
* 2. Type of SubDevice:
* IR.SUB_DEVICE_TYPE_THROUGH_DIMMER - Dimmer
* IR.SUB_DEVICE_TYPE_THROUGH_RELAY - Switch
* IR.SUB_DEVICE_TYPE_AIR_CONDITIONER - Thermostat (HVAC)
* IR.SUB_DEVICE_TYPE_DOCK_STATION - Dock Station
*/
l_pDevice.AddSubDevice("Dimmer", IR.SUB_DEVICE_TYPE_THROUGH_DIMMER);
l_pDevice.AddSubDevice("Switch", IR.SUB_DEVICE_TYPE_THROUGH_RELAY);
l_pDevice.AddSubDevice("Thermostat", IR.SUB_DEVICE_TYPE_AIR_CONDITIONER);
l_pDevice.AddSubDevice("DockStation", IR.SUB_DEVICE_TYPE_DOCK_STATION);
//Log the name of the device from which the feedback came and its value
IR.AddListener(IR.EVENT_TAG_CHANGE, l_pDevice, function(name, value){
IR.Log("Name: " + name + " Value: " + value);
switch(name)
{
case 'Dimmer:Level':
IR.GetDevice("Modbus TCP").Set("Dimmer Level", value);
break;
case 'Switch:Power':
IR.GetDevice("Modbus TCP").Set("Switch Power", value);
break;
case 'HVAC:Level':
IR.GetDevice("Modbus TCP").Set("HVAC Level", value);
break;
case 'HVAC:Sensor Temperature':
IR.GetDevice("Modbus TCP").Set("HVAC Sensor Temperature", value);
break;
case 'Dock Station:Level':
IR.GetDevice("Modbus TCP").Set("Dock Station Level", value);
break;
}
})
}
4 Change the device names the way you would like to pronounce them when talking to Alexa.
Example of creating devices:
Dimmer "Bathroom light":
l_pDevice.AddSubDevice("Bathroom light", IR.SUB_DEVICE_TYPE_THROUGH_DIMMER);
Dimmer "Garage light":
l_pDevice.AddSubDevice("Garage light", IR.SUB_DEVICE_TYPE_THROUGH_DIMMER);
The rest of the devices are created in the same way as in the example.
5 Set connection of Alexa subdevices with equipment.
When you use feedback channels in Amazon Alexa Network driver, specify the subdevice name, a colon and the feedback channel name. A complete list of subdevices and feedback channels can be found in the "Describing Devices and Feedback Channels" section.
Examples of processing answers from Alexa and sending commands to Modbus driver:
IR.AddListener(IR.EVENT_TAG_CHANGE, l_pDevice, function(name, value){
switch(name)
{
case 'Dimmer:Level':
IR.GetDevice("Modbus TCP").Set("Dimmer Level", value);
break;
case 'Switch:Power':
IR.GetDevice("Modbus TCP").Set("Switch Power", value);
break;
case 'HVAC:Level':
IR.GetDevice("Modbus TCP").Set("HVAC Level", value);
break;
case 'HVAC:Sensor Temperature':
IR.GetDevice("Modbus TCP").Set("HVAC Sensor Temperature", value);
break;
case 'Dock Station:Level':
IR.GetDevice("Modbus TCP").Set("Dock Station Level", value);
break;
}
})
6 Upload a project on the server via iRidium cloud;
7 Synchronize a project with Alexa.
Important:
- Device names in the driver must be unique;
- Use English in subdevice names;
- You can't create and (or) edit feedback channels, each Alexa device has a standard set of feedbacks, which Alexa uses;
- A project must be launched on the server for searching devices in the Alexa App;
- Stable work of native and script driver in one project is not guaranteed.
Uploading a Project to iRidium cloud and on the Server
1 Sign in at iRidium mobile web-site.
2 Upload .sirpz project file to iRidium cloud.
3 In Users and Panels tab add an end-user in the project.
3 Start iRidium server.
4 Enter the server web-interface by entering the following in the browser address line:
<IP-адрес сервера>:8888
If iRidium server is launched on the same PC where it is set, enter the following:
127.0.0.1:8888)
5 Enter the password by default - 2007. Click "LOGIN".
6 Find the Cloud / Projects tab.
7 Download the project from the cloud by clicking the "CLOUD SYNC" button and then clicking the "Download" button next to the name of a required project.
Alexa work only via iRidium cloud, that's why it can't work if a project is uploaded on the server via iRidium transfer.
Setting Alexa
Registering the Smart Speaker
Alexa is set with the help of Alexa App on mobile devices or in the Amazon web-service on a laptop or a PC.
In any case you need Wi-Fi for direct connection with the smart speaker.
1 Register at Amazon web-site, if you do not have an account there.
2 If you work on a mobile device Alexa App is offered for download. If you work on a laptop or a PC you can go on setting on Amazon web-site.
Operation systems where Alexa App can work:
- Fire OS 3.0 or later,
- iOS 9.0 or later,
- Android 5.0 or later,
- Windows 10 of 17134.0 version or later.
Make sure that Alexa App is availble for download from Google Play or App Store in your region.
3 Register the smart speaker step by step following the instructions on the screen.
Installing the Skill
The skill is installed only in Alexa App.
1 Launch the app. Click the menu button in the top left corner.
2 Go to the Smart Home tab.
3 Click YOUR SMART HOME SKILLS to see all installed skills of Smart home.
4 Click ENABLE SMART HOME SKILLS button to add a new skill.
5 Enter iridium in the search line to find iRidium skill and click on it.
6 Read about the skill and then press the ENABLE button.
7 You'll get to a registration form on iRidium mobile website. Enter the login and password of the end-user's account and press Login.
8 Select the object which Alexa will work with in the drop down menu. Press Grant Access.
9 Alexa is successfully connected to iRidium object.
Downloading devices from iRidium cloud
1 Press DISCOVER DEVICES.
2 The process takes about 20 seconds.
3 Devices from iRidium server project are automatically uploaded to Alexa App.
Devices are uploaded only if iRidium server is launched and a project with Alexa is uploaded in it.
4 If you make changes in a project, remember to upload it in iRidium cloud and then update in on iRidium server. After it press Add Device button in the Smart Home tab in Alexa App.
Testing a project
A server project can be launched on the same PC where you work in iRidium studio using. But a project has to be uploaded only via iRidium cloud.
Say voice commands to Amazon Echo and Alexa sends them to iRidium server and the server executes them according to the script.
4 You can use any emulator of Modbus TCP server, for example, this free one Modbus PLC Simulator to test a project.
Alexa's Secrets
You can register on Amazon Echo speaker in several iRidium objects. Mind it that voice commands are sent to all available (working) iRidium servers, thus control conflicts can happen. Remember to delete non-functional or test projects with Alexa from iRidium cloud.
Measuring units of temperature (Centigrade or Fahrenheit) can be changed in the regional settings of Amazon Alexa.