Перейти к содержанию

Навигация

Notification module/en: различия между версиями

Нет описания правки
(Новая страница: «400px|thumb|right|notification module configuration The notification module (Alarm) is designed to quickly configure sending SMS and email…»)
Метки: правка с мобильного устройства правка из мобильной версии
 
(не показано 9 промежуточных версий 3 участников)
Строка 6: Строка 6:
At the Linux level, the email utility is used to send emails. [https://linux.die.net/man/8/ssmtp sSMTP]. To start sending mail, you need [[Просмотр файлов контроллера с компьютера/en|to edit]] its configuration file "/etc/ssmtp/ssmtp.conf".
At the Linux level, the email utility is used to send emails. [https://linux.die.net/man/8/ssmtp sSMTP]. To start sending mail, you need [[Просмотр файлов контроллера с компьютера/en|to edit]] its configuration file "/etc/ssmtp/ssmtp.conf".


Электронные письма будут отправляться с одного из ваших почтовых ящиков, от которого потребуются:
Emails will be sent from one of your mailboxes, which will be required:
*логин (например, ''robot@contactless.ru''),
*login (for example, "robot@wirenboard.com"),
*пароль,
*password,
*адрес и порт SMTP сервера (для ящиков на Gmail это ''smtp.gmail.com:587'', для Mail.Ru - ''smtp.mail.ru:465'').
*SMTP server address and port (for Gmail mailboxes, it is "smtp.gmail.com:587", for Mail.Ru - "smtp.mail.EN:465").


Очистите содержимое ''/etc/ssmtp/ssmtp.conf'' и внесите туда такие строки, заменив данные своими:
Clear the contents of "/etc/ssmtp/ssmtp.conf" and fill in such lines, replacing the data with your own:
<syntaxhighlight lang="linux-config">
<syntaxhighlight lang="linux-config">
mailhub=smtp.gmail.com:587
mailhub=smtp.gmail.com:587
AuthUser=robot@contactless.ru
AuthUser=robot@wirenboard.com
AuthPass=qwerty12345
AuthPass=qwerty12345
UseTLS=Yes
UseTLS=Yes
UseSTARTTLS=Yes
UseSTARTTLS=Yes
#обязательно оставьте пустую строку в конце файла
#be sure to leave an empty line at the end of the file
#Для отправки писем через Google Mail необходимо разрешить отправку писем от недоверенных приложений для вашего Google-аккаунта
#To send emails via Google Mail, you must allow sending emails from untrusted apps to your Google account
</syntaxhighlight>
</syntaxhighlight>
Чтобы проверить, что отправка email заработала, выполните в [[Консоль | консоли]] команду:
To verify that sending email is working, run the [[Консоль /en | console]] command:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
echo 'Test message to check sSMTP new configuration' | ssmtp ivanov@gmail.com
echo 'Test message to check sSMTP new configuration' | ssmtp ivanov@gmail.com
# вместо ivanov@gmail.com подставьте адрес другого своего ящика (например того, куда собираетесь получать уведомления с контроллера)
# instead ivanov@gmail.com substitute the address of your other box (for example, where you are going to receive notifications from the controller)
</syntaxhighlight>
</syntaxhighlight>
В случае дополнительных вопросов смотрите [http://askubuntu.com/questions/185070/why-i-get-hostname-name-or-service-not-known-error] и [https://wiki.archlinux.org/index.php/SSMTP].
In case of additional questions, see [http://askubuntu.com/questions/185070/why-i-get-hostname-name-or-service-not-known-error] and [https://wiki.archlinux.org/index.php/SSMTP].


==Предварительная настройка для отправки SMS==
== Pre-setting for sending SMS==
Убедитесь, что вы вставили SIM-карту и подключили GSM антенну.
Make sure you insert the SIM card and connect the GSM antenna.
==Настройка модуля уведомлений==
== Configure the notification module==
#Зайдите на страницу ''Configs - Alarm Configuraion'' веб-интерфейса.
#Go to the "Configs - Alarm Configuraion" page of the web interface.
#Добавьте получателей уведомлений в разделе ''Recipients'':
#Add notification recipients in the "Recipients" section:
#*нажмите кнопку ''+ Recipient'';
#*press "+ Recipient";
#*выберите тип (''E-mail'' или ''SMS'');
#*select the type ("E-mail" or "SMS");
#*введите почтовый адрес или номер телефона. Для email можно также указать тему письма.
#*enter your postal address or phone number. You can also specify the subject of the email.
#Настройте проверяемый параметр и условие в разделе ''Alarms'':
#Configure the parameter and condition to be checked in the "Alarms" section:
#*нажмите кнопку ''+ Item'';
#*press "+ Item";
#*в появившемся разделе в выпадающем списке выберите один из четырёх типов уведомлений:
#*in the section that appears, select one of the four notification types from the drop-down list:
#*#''Expected Value Alarm'' - уведомление, если значение перестанет равняться заданному.
#*# "Expected Value Alarm" - notification, if the value is no longer equal to the specified value.
#*#''Minimum Value Alarm'' - уведомление, если значение станет меньше заданного.
#*#"Minimum Value Alarm" - notification if the value becomes less than the specified value.
#*#''Maximum Value Alarm'' - уведомление, если значение станет больше заданного.
#*#"Maximum Value Alarm" - notification if the value becomes greater than the specified value.
#*#''Minimum&Maximum Value Alarm'' - уведомление, если значение выйдет из заданного диапазона.
#*#"Minimum&Maximum Value Alarm" - notification if the value is out of the specified range.
#*в ''Alarm name'' введите произвольное название для уведомления;
#*in "Alarm name" enter an arbitrary name for the notification;
#*в ''Cell'' введите параметр, за которым нужно следить. Параметр задаётся в виде ''Device/Control'', где названия Device и Control для каждого параметра можно найти на странице ''Settings'' веб-интерфейса в таблице ''MQTT Channels''. Например, для датчика 1-Wire, подключённого к внешнему Modbus сенсору WB-MS, эта строка будет выглядеть как ''wb-ms-thls-v2_101/External Sensor 2'';
#*in "Cell", enter the parameter you want to monitor. The parameter is specified as "Device/Control", where the device and Control names for each parameter can be found on the "Settings" page of the web interface in the "MQTT Channels" table. For example, for a 1-Wire sensor connected to an external Modbus WB-MS sensor, this string would look like "wb-ms-thls-v2_101/External Sensor 2";
#*в ''Alarm activation message'' введите текст сообщения, которое будет отправлено. В него в произвольном месте можно ввести две фигурные скобки ''{}'', вместо которых в сообщение будет подставлено новое значение параметра, за которым производится слежение.
#*in "Alarm activation message" enter the text of the message to be sent. You can enter two curly brackets "{} " in it in any place, instead of which a new parameter value will be substituted in the message, which is monitored.
#*в зависимости от типа уведомления, заполните поля ''Minimum Value'', ''Maximum Value'', ''Expected Value'';
#*depending on the notification type, fill in the fields "Minimum Value", "Maximum Value", "Expected Value";
#*некоторые дополнительные настройки станут доступны, если нажать на кнопку ''Properties'' и отметить их.
#*some additional settings will be available if you click on the "Properties" button and check them.
#Нажмите ''Save'' в самом верху страницы:
#Click "Save" at the top of the page:
#*если вы забыли указать какой-то обязательный параметр, кнопка ''Save'' будет неактивна, а рядом с параметром красным будет написана ошибка, которую нужно исправить;
#*if you forget to specify some required parameter, the "Save" button will be inactive, and an error will be written next to the parameter in red, which should be corrected;
#*если всё в порядке, уведомления начнут работать.
#*if everything is OK, notifications will start working.


==Как настроить уведомления с более сложными условиями==
==How to set up notifications with more complex conditions==
Модуль уведомлений предназначен для быстрой настройки простых уведомлений. Если вам нужны более сложные сценарии уведомлений, их можно запрограммировать через [[Движок правил wb-rules | движок правил]]. Чтобы отправить сообщение, из правила нужно вызвать функцию
The notification module is designed to quickly configure simple notifications. If you need more complex notification scripts, they can be programmed via [[Движок правил wb-rules/en | rules engine]]. To send a message, call the function from the rule
<syntaxhighlight lang="ecmascript">
<syntaxhighlight lang="JavaScript">
Notify.sendEmail(to, subject, text); //отправляет почту указанному адресату (to), с указанной темой (subject) и содержимым (text)
Notify.sendEmail(to, subject, text); //sends mail to the specified recipient (to), with the specified subject and content (text)
</syntaxhighlight>
</syntaxhighlight>
или
or
<syntaxhighlight lang="ecmascript">
<syntaxhighlight lang="JavaScript">
Notify.sendSMS(to, text); //отправляет SMS на указанный номер (to) с указанным содержимым (text)
Notify.sendSMS(to, text); //sends SMS to specified number (to) with specified content (text)
</syntaxhighlight>
</syntaxhighlight>
translator, wb_editors
4268

правок