iRidi for Yandex Alice
Voice control of equipment through Yandex Alice and iRidi
Documentation updated 01.01.2024
Alice is Yandex's voice assistant, introduced in 2017. Simply install Yandex Browser with Alice:
- on a smartphone,
- on a tablet,
- on a laptop or desktop computer (a microphone is required).
You can also use Alice on a Yandex Station.
Operating systems on which Alice can run:
- iOS,
- Android,
- Windows.
Alice understands only Russian. With the "Иридий" (Iridium) skill, Alice can control a smart home through iRidi Cloud and an iRidi server. Say "Включи свет" (turn on the light), and the lamp will turn on. Say "Выключи свет" (turn off the light), and it will turn off. It's simple!

Building a smart voice control system is straightforward:
- Install Yandex Browser with Alice on a smartphone, tablet, or computer.
- Launch the "Иридий" (Iridium) skill, which enables Alice to communicate with iRidi.
- Connect to a site in iRidi Cloud.
- Create a smart home based on iRidi Server. Specify the devices and commands to include in your project.
Try Alice for free in trial mode!
iRidi has an alternative driver, Yandex Alice Platform, with the following advantages:
Advantages:
- convenient for the client: control uses simple commands such as "Алиса, включи свет" (Alice, turn on the light)
- Alice can speak the required text based on data from automation system sensors
- ready-made voice commands
- a ready-made interface from Yandex
- can be used through an app
- does not require launching a skill.
Creating a new site in iRidi Cloud
- Alice works only through iRidi Cloud, so create a site in our cloud if you have not already done so.
A site represents a real smart home or building in iRidi Cloud.
- Find your site's secret key by following this link. Sign in if necessary using the sign-in button in the upper-right corner, and select the site.
Starting with version 1.3.2, iRidi Server retrieves the secret key automatically, so you do not need to remember it.
-99c8f54689c9dc50c4fb052786aa3fd0.png)
Working in iRidi Studio
Configuring the driver
Alice works only with server projects.
-
Create a server project: iRidi Studio > File > New > New Server Project
-
Add the Yandex Alice driver to the project.

- Configure the parameters:
- Object key : enter the Secret key of the cloud site,
- Answer if success : Alice's default response if the received voice command is found in the feedback list,
- Answer if error : Alice's response in other cases.
Starting with version 1.3.2, iRidi Server retrieves the secret key automatically, so you do not need to remember it.
- Each feedback channel in the Alice driver represents one Russian voice command. Add the required number of feedback channels by entering the voice command text in the Name parameter.

Processing voice commands with routines
Voice commands can be processed in two ways:
- with routines,
- in a script.
Processing commands with routines is easier to understand and is better suited to developers who are unfamiliar with the finer points of programming.
- Open the Routines tab and click "+" to add a new routine.

-
Set the routine name (Name ).
-
Add a When condition by clicking "+". In the Feedback field, select a voice command from the "Yandex Alice" driver. In the Value field, enter 1. The routine will then track the arrival of the voice command (after one second, the voice command tag is automatically reset to 0).

You can add as many different voice commands as you need to the When conditions.
-
Add an action to the routine by clicking "+" in the Then section. Select the action to send a number, specify the channel to control and the value to write to it when the routine runs.
-
Then add another action: select the action to send text, specify the Alice driver's Alice Answer channel, and enter the text you want Alice to say in response to the voice command.
-
If necessary, add a condition in the But only if section.
-
One routine is now ready. You can create many different routines.

Download the demo project:
Processing voice commands in a script
Processing commands in a script is more complex, but has an advantage: scripts let you implement much more flexible logic than routines.
-
Add a voice command processing script to the project by clicking "JS", then "+", then "New script".
-
Insert the script:
var Alice = IR.GetDevice("Yandex Alice"); // имя драйвера Алисы
var device = IR.GetDevice("Modbus TCP"); // имя драйвера
var lamp = 0; // Лампа
var heat = 0; // Нагрев
var temperature = 20; // Уставка температуры отопления
var answer; // Ответ Алисы
IR.AddListener(IR.EVENT_TAG_CHANGE, Alice, function(name, value) {
switch (name) {
case "включить свет":
case "включи свет":
lamp = 1;
answer = "свет включен";
break;
case "выключить свет":
case "выключи свет":
case "отключить свет":
case "отключи свет":
lamp = 0;
answer = "свет выключен";
break;
case "переключить свет":
case "переключи свет":
lamp = !lamp;
answer = "свет переключен";
break;
case "включить отопление":
case "включи отопление":
heat = 1;
answer = "отопление включено";
break;
case "выключить отопление":
case "выключи отопление":
case "отключить отопление":
case "отключи отопление":
heat = 0;
answer = "отопление отключено";
break;
case "выключить все":
case "выключи все":
case "отключить все":
case "отключи все":
lamp = 0;
heat = 0;
answer = "свет и отопление выключены";
break;
case "отопление теплее":
case "теплее":
temperature = temperature + 1;
answer = "я сделала теплее";
break;
case "отопление холоднее":
case "холоднее":
case "прохладнее":
temperature = temperature - 1;
answer = "я сделала прохладнее";
break;
case "отопление 16":
temperature = 16;
answer = "установлено 16 градусов";
break;
case "отопление 18":
temperature = 18;
answer = "установлено 18 градусов";
break;
case "отопление 20":
case "отопление стандарт":
temperature = 20;
answer = "установлено 20 градусов";
break;
case "отопление 22":
case "отопление комфорт":
temperature = 22;
answer = "установлено 22 градуса";
break;
default:
IR.Log("Команда не запрограммирована!");
answer = "я не поняла команду";
}
IR.Log("Получена команда: " + name + ", значение: " + value + ", отправлен ответ: " + answer);
IR.Log("Лампа: " + lamp + ", Отопление: " + heat + ", Температура: " + temperature);
device.Set("Лампа", lamp); // управление устройствами в сети Modbus TCP
device.Set("Нагрев", heat);
device.Set("Температура", temperature);
Alice.Set("Alice Answer", answer); // отправка ответа Алисе
});
Download the demo project:
Processing voice commands in a script (arbitrary commands)
iRidi Server 1.3.2 and later provide a new way to process voice commands in a script. It is similar to the method described in the previous section, but you do not need to list every voice command in the Yandex Alice driver. Instead, keep only one feedback channel named Voice Command .
Voice Command is a feedback channel to which arbitrary voice commands are written as strings. This approach has many advantages:
- You do not create a large number of server tags that you have to pay for.
- You can extract a numeric value from a voice command such as "отопление 17,5" (heating setpoint) in the Voice Command string using the functions split() and parseFloat() and then use that number to control equipment. A code example is provided below.
-
Add a voice command processing script to the project by clicking "JS", then "+", then "New script".
-
Insert the script:
var Alice = IR.GetDevice("Yandex Alice"); // имя драйвера Алисы
var device = IR.GetDevice("Modbus TCP"); // имя драйвера
var lamp = 0; // Лампа
var heat = 0; // Нагрев
var temperature = 20; // Уставка температуры отопления
var answer; // Ответ Алисы
IR.AddListener(IR.EVENT_TAG_CHANGE, Alice, function(name, value) {
if (name == "Voice Command") {
switch (value) {
case "включить свет":
case "включи свет":
lamp = 1;
answer = "свет включен";
break;
case "выключить свет":
case "выключи свет":
case "отключить свет":
case "отключи свет":
lamp = 0;
answer = "свет выключен";
break;
case "переключить свет":
case "переключи свет":
lamp = !lamp;
answer = "свет переключен";
break;
case "включить отопление":
case "включи отопление":
heat = 1;
answer = "отопление включено";
break;
case "выключить отопление":
case "выключи отопление":
case "отключить отопление":
case "отключи отопление":
heat = 0;
answer = "отопление отключено";
break;
case "выключить все":
case "выключи все":
case "отключить все":
case "отключи все":
lamp = 0;
heat = 0;
answer = "свет и отопление выключены";
break;
case "отопление теплее":
case "теплее":
temperature = temperature + 1;
answer = "я сделала теплее";
break;
case "отопление холоднее":
case "холоднее":
case "прохладнее":
temperature = temperature - 1;
answer = "я сделала прохладнее";
break;
case "отопление стандарт":
temperature = 20;
answer = "установлено 20 градусов";
break;
case "отопление комфорт":
temperature = 22;
answer = "установлено 22 градуса";
break;
default:
/*Вы можете извлекать число XX из голосовой команды вида "отопление XX" и
затем использовать следующим образом: */
var command = value.split(" "); // Разбиение команды вида "отопление XX" на части
if (command[0] == "отопление" && command.length == 2) {
var number = parseFloat(command[1].replace(",", ".")); // Извлечение числа XX
if (number >= 16 && number <= 22) {
temperature = number;
answer = "установлено " + number + " градусов";
} else {
answer = "число вне диапазона";
}
} else {
IR.Log("Команда не запрограммирована!");
answer = "я не поняла команду";
}
}
IR.Log("Получена команда: " + name + ", значение: " + value + ", отправлен ответ: " + answer);
IR.Log("Лампа: " + lamp + ", Отопление: " + heat + ", Температура: " + temperature);
device.Set("Лампа", lamp); // управление устройствами в сети Modbus TCP
device.Set("Нагрев", heat);
device.Set("Температура", temperature);
Alice.Set("Alice Answer", answer); // отправка ответа Алисе
}
});
Download the demo project: Yandex Alice (processing arbitrary commands in a script)
Uploading the project to the cloud and the server
-
Sign in on the iRidi website.
-
Upload the .sirpz project file to iRidi Cloud.

-
Start iRidi Server.
-
Open the server's web interface by entering the server IP address followed by :8888 in the browser's address bar (if iRidi Server runs on the same computer on which it is being configured, enter 127.0.0.1:8888).
-
Enter the default access password, 2007. Click "LOGIN".
-
Open CLOUD / Projects .
-
Download the project from the cloud to the server by clicking "CLOUD SYNC", then "Download" next to the required project.

Alice works only through iRidi Cloud, so it will not work if the project is uploaded to the server using iRidi Transfer.
Configuring Alice
Alice is configured once when you create the smart voice control system. You can use any smartphone, tablet, or computer to do this.
-
Install the Yandex Browser app from the App Store or Play Market, or install the version for a computer.
-
Launch the "Иридий" (Iridium) skill in Alice. To do this, say "Запусти навык Иридий" (launch the Iridium skill), or type that text in Alice's chat.
-49330f43f76e97daaec59475ead00b63.png)
- Follow the link to the iRidi mobile website. Sign in if necessary. Select the site that Alice will control, then click "Add Yandex Alice device".
-8b89f640fe8adb508bfe7f36805e106a.png)
- Click "Сгенерировать автоматически" (generate automatically), or enter your own activation phrase and click "Применить" (apply).
- Check the activation phrase. A 300-second countdown will start.
-072f1fb30a8778dcae851aeebe588cd3.png)
- Say "Активация по коду 8894" (activate using the code) to Alice within the 300-second countdown, where 8894 is your generated code.
You must say or type the complete phrase "Активация по коду ****" (activate using code ****). Sending only the code to the skill will not activate it.
-806cbdc73d1ac4333f9b4bb9635c7948.png)
- Say the number according to Russian pronunciation rules: "восемь тысяч восемьсот девяносто четыре" (eight thousand eight hundred ninety-four). In the chat, you can type the code as digits.
- A project containing the Yandex Alice driver with the secret key must be uploaded to iRidi Cloud.
-
Alice will connect to iRidi Cloud.
-
Add as many additional devices with Alice to the iRidi site as needed by repeating steps 3-7.
Testing voice control
The end user:
- launches Yandex Browser with Alice,
- launches the "Иридий" (Iridium) skill,
- speaks smart home control commands.
Alice tips
Working with iRidi
-
You can register one Yandex Alice device at several iRidi sites. Note that voice commands from that device will be sent to every available (running) iRidi server, which can cause control conflicts. Remember to delete inactive or test projects with Alice from iRidi Cloud.
-
Alice reliably stores its connection to iRidi Cloud in memory. If the device running Alice restarts, the connection is restored automatically.
-
To disconnect Alice from an iRidi site, say or type "отключиться от объекта" (disconnect from the site) in Alice's chat.
-
To exit the "Иридий" (Iridium) skill, say or type "прекрати" (stop) or "хватит" (enough).
Voice commands
- To quickly enter the "Иридий" (Iridium) skill and issue a smart home control command, say: "Алиса, попроси Иридий включить свет." (Alice, ask Iridium to turn on the light.)
This single command launches the skill and immediately turns on the light!
-
Voice commands allow only lowercase Cyrillic characters, spaces, digits, a minus sign, and a comma as the decimal separator.
-
Alice converts spoken numbers to digits. For example, the voice commands "минус шестнадцать с половиной" (minus sixteen and a half) and "минус шестнадцать целых пять десятых" (minus sixteen point five) are converted to the string "-16,5".
-
Alice sends all spoken words containing "ё" to iRidi with that letter replaced by "е". However, you can type "ё" in Alice's chat, and Alice will send it unchanged.
-
You can also use lowercase Latin characters, but Alice cannot recognize the Latin alphabet through voice control. You can enter Latin letters in Alice's chat.
-
A long pause while speaking a command is interpreted as the end of the command.
Speech synthesis
-
Alice can speak only in response to a voice command; it cannot start speaking spontaneously at any time. It waits for a response for 1,5 seconds after the voice command. If no response arrives, Alice exits the "Иридий" (Iridium) skill.
-
If the script or routine does not send a response to Alice, after approximately 0,5 seconds the server automatically sends one of the default responses: Answer if success or Answer if error (see the driver parameters). Remember to send a response to every voice command so that the default responses are not used.
-
Alice can speak almost any text with any punctuation. It handles intonation quite well and knows the correct stress in many words. You can, however, send Alice a response in this format: Текст как пишется [текст как слышится] (text as written, followed by text as pronounced in brackets), for example, Команда неизвестна[команда неизвесна] ("command unknown" with a pronunciation hint).
"Текст как пишется" (text as written) applies only to devices with Alice that display the conversation on a screen.
-
The text in square brackets is also called Text-To-Speech, or TTS. Use Yandex's documentation to understand how to write TTS text.
-
Use Yandex SpeechKit speech synthesizer to quickly check pronunciation.
-
The maximum number of characters for written and spoken text is 1024 each (2048 characters in total).
Context-based control
You can configure context-based control to make it easier to control devices with the same name in different rooms. For example, when you ask Alice to turn on the light, you may want the light to turn on in only one particular room. To do this:
- Create these tags in the Yandex Alice driver:
- "Я в кухне" (I am in the kitchen),
- "Я в спальне" (I am in the bedroom),
- "Я в гостиной" (I am in the living room),
- etc.
- Create virtual channels and tags with matching names: cont_kitchen, cont_bedroom, cont_livingroom, etc.

- Configure data routing between the virtual channels and tags:
- create data routing;
- for each virtual channel, enter the name of the function from the script in the Script Modifier property.

- Create rules in the routines section:
-
Rule 1
WHEN Алиса.Тег.Я в кухне == 1 THEN cont_kitchen = 1, cont_bedroom = 0, cont_livingroom = 0 (when the kitchen context tag is active, select the kitchen context and clear the other room contexts)

Create rules for the other rooms in the same way:
-
Rule 2
WHEN Алиса.Тег.Я в спальне == 1 THEN cont_kitchen = 0, cont_bedroom = 1, cont_livingroom = 0 (when the bedroom context tag is active, select the bedroom context and clear the other room contexts)
-
Rule 3
WHEN Алиса.Тег.Я в гостиной == 1 THEN cont_kitchen = 0, cont_bedroom = 0, cont_livingroom = 1 (when the living room context tag is active, select the living room context and clear the other room contexts)
-
Create the "Включи свет" (turn on the light) tag in the Yandex Alice driver.
-
Create rules in the routines section:
-
Rule 4
WHEN Алиса.Тег.Включи свет == 1 THEN Команда.Включи_свет_в_кухне, BUT_ONLY_IF cont_kitchen = 1 (turn on the kitchen light for this voice command only when the kitchen context is active)

Create rules for the other rooms in the same way:
-
Rule 5
WHEN Алиса.Тег.Включи свет == 1 THEN Команда.Включи_свет_в_спальне, BUT_ONLY_IF cont_bedroom = 1 (turn on the bedroom light for this voice command only when the bedroom context is active)
-
Rule 6
WHEN Алиса.Тег.Включи свет == 1 THEN Команда.Включи_свет_в_гостиной, BUT_ONLY_IF cont_livingroom = 1 (turn on the living room light for this voice command only when the living room context is active)
Depending on the context, the server can therefore respond differently to the same voice commands. For example, in the "Я в кухне" (I am in the kitchen) context, the server turns on the kitchen light when it receives "включи свет" (turn on the light). In the "Я в гостиной" (I am in the living room) context, the same command turns on the living room light.
Simply add a context check to the script or routine (in the But only if condition).
The context itself can change through the corresponding voice commands or automatically, based on signals from motion sensors or the GPS tracker on the mobile device running Alice. Context-based control should be carefully planned. Note that several devices with Alice may control the same site.