Merge pull request #66 from arendst/development

Update from Tasmota
This commit is contained in:
Adrian Scillato 2018-04-21 14:31:10 -03:00 committed by GitHub
commit 39e8614bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 68 deletions

View File

@ -372,6 +372,8 @@
/********************************************************************************************/
#define D_ASTERIX "********"
#ifndef MY_LANGUAGE
#include "language/en-GB.h"
#else
@ -435,11 +437,13 @@ const char S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE[] PROGMEM = "{\"%s\":\"%d (" D
const char S_JSON_COMMAND_NVALUE[] PROGMEM = "{\"%s\":%d}";
const char S_JSON_COMMAND_LVALUE[] PROGMEM = "{\"%s\":%lu}";
const char S_JSON_COMMAND_SVALUE[] PROGMEM = "{\"%s\":\"%s\"}";
const char S_JSON_COMMAND_ASTERIX[] PROGMEM = "{\"%s\":\"" D_ASTERIX "\"}";
const char S_JSON_COMMAND_XVALUE[] PROGMEM = "{\"%s\":%s}"; // %s must provide quotes on non-number
const char S_JSON_COMMAND_INDEX_NVALUE[] PROGMEM = "{\"%s%d\":%d}";
const char S_JSON_COMMAND_INDEX_LVALUE[] PROGMEM = "{\"%s%d\":%lu}";
const char S_JSON_COMMAND_INDEX_SVALUE[] PROGMEM = "{\"%s%d\":\"%s\"}";
const char S_JSON_COMMAND_INDEX_ASTERIX[] PROGMEM = "{\"%s%d\":\"" D_ASTERIX "\"}";
const char S_JSON_COMMAND_INDEX_SVALUE_SVALUE[] PROGMEM = "{\"%s%d\":\"%s%s\"}";
const char S_JSON_COMMAND_INDEX_NVALUE_ACTIVE_NVALUE[] PROGMEM = "{\"%s%d\":\"%d (" D_JSON_ACTIVE " %d)\"}";

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v5.12.0l
* Updated until v5.12.0m
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -193,7 +193,7 @@
#define D_SYSLOG_HOST_NOT_FOUND "Хостът на системния лог не е намерен"
// settings.ino
#define D_SAVED_TO_FLASH_AT "Запазено в флаш паметта на"
#define D_SAVED_TO_FLASH_AT "Запазено във флаш паметта на"
#define D_LOADED_FROM_FLASH_AT "Заредено от флаш паметта от"
#define D_USE_DEFAULTS "Използване на параметри по подразбиране"
#define D_ERASED_SECTOR "Изтрит сектор"
@ -224,12 +224,12 @@
#define D_CONFIGURE_MQTT "Конфигурация на MQTT"
#define D_CONFIGURE_DOMOTICZ "Конфигурация на Domoticz"
#define D_CONFIGURE_LOGGING "Конфигурация на логинга"
#define D_CONFIGURE_OTHER "Конфигурация на други"
#define D_CONFIRM_RESET_CONFIGURATION "Потвърдете ресетирането"
#define D_RESET_CONFIGURATION "Ресетиране на конфигурацията"
#define D_CONFIGURE_OTHER "Драги конфигурации"
#define D_CONFIRM_RESET_CONFIGURATION "Потвърдете изчистването"
#define D_RESET_CONFIGURATION "Изчистване на конфигурацията"
#define D_BACKUP_CONFIGURATION "Запазване на конфигурацията"
#define D_RESTORE_CONFIGURATION "Възстановяване на конфигурацията"
#define D_MAIN_MENU "Основно Меню"
#define D_MAIN_MENU "Основно меню"
#define D_MODULE_PARAMETERS "Параметри на модула"
#define D_MODULE_TYPE "Тип на модула"
@ -237,10 +237,10 @@
#define D_SERIAL_IN "Сериен вход"
#define D_SERIAL_OUT "Сериен изход"
#define D_WIFI_PARAMETERS "Параметры на Wifi"
#define D_SCAN_FOR_WIFI_NETWORKS "Сканиране за безжични мрежи Wifi"
#define D_SCAN_DONE "Сканированието е завършено"
#define D_NO_NETWORKS_FOUND "Не са намерени мрежи"
#define D_WIFI_PARAMETERS "Wifi параметри"
#define D_SCAN_FOR_WIFI_NETWORKS "Сканиране за безжични мрежи"
#define D_SCAN_DONE "Сканирането приключи"
#define D_NO_NETWORKS_FOUND "Не бяха открити мрежи"
#define D_REFRESH_TO_SCAN_AGAIN "Обновяване за повторно сканиране"
#define D_DUPLICATE_ACCESSPOINT "Дублиране на точката за достъп (AP)"
#define D_SKIPPING_LOW_QUALITY "Пропускане поради лошо качество"
@ -280,9 +280,9 @@
#define D_CONFIGURATION_RESET "Конфигурацията е изчистена"
#define D_PROGRAM_VERSION "Версия на програмата"
#define D_BUILD_DATE_AND_TIME "Дата & Час на компилацията"
#define D_BUILD_DATE_AND_TIME "Дата и час на компилацията"
#define D_CORE_AND_SDK_VERSION "Версия на Core/SDK"
#define D_FLASH_WRITE_COUNT "Брой на записите във Flash"
#define D_FLASH_WRITE_COUNT "Брой на записите във флаш паметта"
#define D_MAC_ADDRESS "MAC адрес"
#define D_MQTT_HOST "MQTT хост"
#define D_MQTT_PORT "MQTT порт"
@ -369,31 +369,31 @@
#define D_CONFIGURE_TIMER "Конфигуриране на таймер"
#define D_TIMER_PARAMETERS "Параметри на таймера"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_ACTION "Action"
#define D_TIMER_TIME "Време"
#define D_TIMER_DAYS "Дни"
#define D_TIMER_REPEAT "Повтори"
#define D_TIMER_OUTPUT "Изход"
#define D_TIMER_ACTION "Действие"
// xdrv_10_knx.ino
#define D_CONFIGURE_KNX "Configure KNX"
#define D_KNX_PARAMETERS "KNX Parameters"
#define D_KNX_GENERAL_CONFIG "General"
#define D_KNX_PHYSICAL_ADDRESS "Physical Address"
#define D_KNX_PHYSICAL_ADDRESS_NOTE "( Must be unique on the KNX network )"
#define D_KNX_ENABLE "Enable KNX"
#define D_KNX_GROUP_ADDRESS_TO_WRITE "Data to Send to Group Addresses"
#define D_ADD "Add"
#define D_DELETE "Delete"
#define D_REPLY "Reply"
#define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from"
#define D_CONFIGURE_KNX "Конфигуриране на KNX"
#define D_KNX_PARAMETERS "KNX параметри"
#define D_KNX_GENERAL_CONFIG "Основни"
#define D_KNX_PHYSICAL_ADDRESS "Физически адрес"
#define D_KNX_PHYSICAL_ADDRESS_NOTE "( Трябва да е уникален в KNX мрежата )"
#define D_KNX_ENABLE "Активиране на KNX"
#define D_KNX_GROUP_ADDRESS_TO_WRITE "Групови адреси за изпращане на данни"
#define D_ADD "Добаване"
#define D_DELETE "Изтриване"
#define D_REPLY "Отговор"
#define D_KNX_GROUP_ADDRESS_TO_READ "Групови адреси за получаване на данни"
#define D_LOG_KNX "KNX: "
#define D_RECEIVED_FROM "Received from"
#define D_KNX_COMMAND_WRITE "Write"
#define D_KNX_COMMAND_READ "Read"
#define D_KNX_COMMAND_OTHER "Other"
#define D_SENT_TO "sent to"
#define D_KNX_WARNING "The group address ( 0 / 0 / 0 ) is reserved and can not be used."
#define D_RECEIVED_FROM "Получен от"
#define D_KNX_COMMAND_WRITE "Писане"
#define D_KNX_COMMAND_READ "Четене"
#define D_KNX_COMMAND_OTHER "Друго"
#define D_SENT_TO "изпратен до"
#define D_KNX_WARNING "Груповият адрес ( 0 / 0 / 0 ) е резервиран и не може да бъде използван."
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Използвана енергия днес"
@ -446,7 +446,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Подсветка"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1 "SDS0X1"
#define D_SENSOR_SBR_RX "SerBr Rx"
@ -456,26 +456,26 @@
// Units
#define D_UNIT_AMPERE "А"
#define D_UNIT_CENTIMETER "cm"
#define D_UNIT_HOUR "Ч"
#define D_UNIT_CENTIMETER "см"
#define D_UNIT_HOUR "ч"
#define D_UNIT_KILOOHM "кОм"
#define D_UNIT_KILOWATTHOUR "кВт"
#define D_UNIT_KILOWATTHOUR "кВт/ч"
#define D_UNIT_LUX "лукс"
#define D_UNIT_MICROGRAM_PER_CUBIC_METER "микрограм/м3"
#define D_UNIT_MICROMETER "микрметър"
#define D_UNIT_MICROSECOND "микросек."
#define D_UNIT_MICROMETER "микрометър"
#define D_UNIT_MICROSECOND "микросек"
#define D_UNIT_MILLIAMPERE "мА"
#define D_UNIT_MILLISECOND "милисек."
#define D_UNIT_MINUTE "мин."
#define D_UNIT_MILLISECOND "мсек"
#define D_UNIT_MINUTE "мин"
#define D_UNIT_PARTS_PER_BILLION "ppb"
#define D_UNIT_PARTS_PER_DECILITER "ppd"
#define D_UNIT_PARTS_PER_MILLION "ppm"
#define D_UNIT_PRESSURE "Хектопаскал"
#define D_UNIT_SECOND "сек."
#define D_UNIT_PRESSURE "хПа"
#define D_UNIT_SECOND "сек"
#define D_UNIT_SECTORS "сектори"
#define D_UNIT_VOLT "В"
#define D_UNIT_WATT "Вт"
#define D_UNIT_WATTHOUR "Вт/Час"
#define D_UNIT_WATTHOUR "Вт/ч"
// Log message prefix
#define D_LOG_APPLICATION "APP: " // Application

View File

@ -922,8 +922,10 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
strlcpy(Settings.sta_pwd[index -1], (1 == payload) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(Settings.sta_pwd[0]));
Settings.sta_active = index -1;
restart_flag = 2;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]);
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_ASTERIX, command, index);
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]);
}
else if ((CMND_HOSTNAME == command_code) && !grpflg) {
if ((data_len > 0) && (data_len < sizeof(Settings.hostname))) {
@ -978,8 +980,10 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
else if (CMND_WEBPASSWORD == command_code) {
if ((data_len > 0) && (data_len < sizeof(Settings.web_password))) {
strlcpy(Settings.web_password, (!strcmp(dataBuf,"0")) ? "" : (1 == payload) ? WEB_PASSWORD : dataBuf, sizeof(Settings.web_password));
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.web_password);
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_ASTERIX, command);
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.web_password);
}
else if (CMND_WEBLOG == command_code) {
if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) Settings.weblog_level = payload;

View File

@ -79,6 +79,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#endif
// #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow
#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
#endif // USE_ALL_SENSORS =====================
#if defined(USE_DS18x20) || defined(USE_DS18x20_LEGACY)
@ -99,6 +100,9 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#ifdef USE_HOME_ASSISTANT
#undef USE_HOME_ASSISTANT // Disable Home Assistant
#endif
#ifdef USE_KNX
#undef USE_KNX // Disable KNX IP Protocol Support
#endif
//#ifdef USE_WEBSERVER
//#undef USE_WEBSERVER // Disable Webserver
//#endif
@ -111,30 +115,24 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#ifdef USE_SUNRISE
#undef USE_SUNRISE // Disable support for Sunrise and sunset tools
#endif
#ifdef USE_KNX
#undef USE_KNX // Disable KNX IP Protocol Support
#ifdef USE_RULES
#undef USE_RULES // Disable support for rules
#endif
#ifdef USE_PZEM004T
#undef USE_PZEM004T // Disable PZEM004T energy sensor
#ifdef USE_DHT
#undef USE_DHT // Disable internal DHT sensor
#endif
#ifdef USE_DS18x20
#undef USE_DS18x20 // Disable DS18x20 sensor
#endif
#ifdef USE_DS18B20
#undef USE_DS18B20 // Disable internal DS18B20 sensor
#endif
#ifdef USE_I2C
#undef USE_I2C // Disable all I2C sensors and devices
#endif
#ifdef USE_SPI
#undef USE_SPI // Disable all SPI devices
#endif
#ifdef USE_WS2812
#undef USE_WS2812 // Disable WS2812 Led string
#endif
#ifdef USE_DS18B20
#undef USE_DS18B20 // Disable internal DS18B20 sensor
#endif
#ifdef USE_DHT
#undef USE_DHT // Disable internal DHT sensor
#endif
#ifdef USE_DISPLAY
#undef USE_DISPLAY // Disable Display support
#endif
@ -144,12 +142,30 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#ifdef USE_SENSEAIR
#undef USE_SENSEAIR // Disable support for SenseAir K30, K70 and S8 CO2 sensor
#endif
#ifdef USE_PMS5003
#undef USE_PMS5003 // Disable support for PMS5003 and PMS7003 particle concentration sensor
#endif
#ifdef USE_NOVA_SDS
#undef USE_NOVA_SDS // Disable support for SDS011 and SDS021 particle concentration sensor
#endif
#ifdef USE_PZEM004T
#undef USE_PZEM004T // Disable PZEM004T energy sensor
#endif
#ifdef USE_SERIAL_BRIDGE
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
#endif
#ifdef USE_IR_REMOTE
#undef USE_IR_REMOTE // Disable IR driver
#endif
#ifdef USE_WS2812
#undef USE_WS2812 // Disable WS2812 Led string
#endif
#ifdef USE_ARILUX_RF
#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller
#endif
#ifdef USE_SR04
#undef USE_SR04 // Disable support for for HC-SR04 ultrasonic devices
#endif
#ifdef DEBUG_THEO
#undef DEBUG_THEO // Disable debug code
#endif

View File

@ -740,7 +740,7 @@ void WifiCheck(uint8_t param)
strlcpy(Settings.sta_pwd[0], WiFi.psk().c_str(), sizeof(Settings.sta_pwd[0]));
}
Settings.sta_active = 0;
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s, " D_CMND_PASSWORD "1 %s"), Settings.sta_ssid[0], Settings.sta_pwd[0]);
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s"), Settings.sta_ssid[0]);
AddLog(LOG_LEVEL_INFO);
}
}

View File

@ -227,9 +227,9 @@ const char HTTP_FORM_WIFI[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_WIFI_PARAMETERS "&nbsp;</b></legend><form method='get' action='sv'>"
"<input id='w' name='w' value='1,1' hidden>"
"<br/><b>" D_AP1_SSID "</b> (" STA_SSID1 ")<br/><input id='s1' name='s1' placeholder='" STA_SSID1 "' value='{s1'><br/>"
"<br/><b>" D_AP1_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_AP1_PASSWORD "' value='********'><br/>"
"<br/><b>" D_AP1_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_AP1_PASSWORD "' value='" D_ASTERIX "'><br/>"
"<br/><b>" D_AP2_SSID "</b> (" STA_SSID2 ")<br/><input id='s2' name='s2' placeholder='" STA_SSID2 "' value='{s2'><br/>"
"<br/><b>" D_AP2_PASSWORD "</b><br/><input id='p2' name='p2' type='password' placeholder='" D_AP2_PASSWORD "' value='********'><br/>"
"<br/><b>" D_AP2_PASSWORD "</b><br/><input id='p2' name='p2' type='password' placeholder='" D_AP2_PASSWORD "' value='" D_ASTERIX "'><br/>"
"<br/><b>" D_HOSTNAME "</b> (" WIFI_HOSTNAME ")<br/><input id='h' name='h' placeholder='" WIFI_HOSTNAME" ' value='{h1'><br/>";
const char HTTP_FORM_MQTT[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_MQTT_PARAMETERS "&nbsp;</b></legend><form method='get' action='sv'>"
@ -259,7 +259,7 @@ const char HTTP_FORM_LOG3[] PROGMEM =
const char HTTP_FORM_OTHER[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_OTHER_PARAMETERS "&nbsp;</b></legend><form method='get' action='sv'>"
"<input id='w' name='w' value='5,1' hidden>"
"<br/><b>" D_WEB_ADMIN_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_WEB_ADMIN_PASSWORD "' value='********'><br/>"
"<br/><b>" D_WEB_ADMIN_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_WEB_ADMIN_PASSWORD "' value='" D_ASTERIX "'><br/>"
"<br/><input style='width:10%;' id='b1' name='b1' type='checkbox'{r1><b>" D_MQTT_ENABLE "</b><br/>";
const char HTTP_FORM_OTHER2[] PROGMEM =
"<br/><b>" D_FRIENDLY_NAME " {1</b> ({2)<br/><input id='a{1' name='a{1' placeholder='{2' value='{3'><br/>";
@ -1011,8 +1011,8 @@ void HandleSaveSettings()
strlcpy(Settings.sta_pwd[0], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[0] : tmp, sizeof(Settings.sta_pwd[0]));
WebGetArg("p2", tmp, sizeof(tmp));
strlcpy(Settings.sta_pwd[1], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[1] : tmp, sizeof(Settings.sta_pwd[1]));
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_PASSWORD "1 %s, " D_CMND_SSID "2 %s, " D_CMND_PASSWORD "2 %s"),
Settings.hostname, Settings.sta_ssid[0], Settings.sta_pwd[0], Settings.sta_ssid[1], Settings.sta_pwd[1]);
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s"),
Settings.hostname, Settings.sta_ssid[0], Settings.sta_ssid[1]);
AddLog(LOG_LEVEL_INFO);
result += F("<br/>" D_TRYING_TO_CONNECT "<br/>");
break;

View File

@ -594,9 +594,11 @@ bool MqttCommand()
else if (CMND_MQTTPASSWORD == command_code) {
if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_pwd))) {
strlcpy(Settings.mqtt_pwd, (!strcmp(dataBuf,"0")) ? "" : (1 == payload) ? MQTT_PASS : dataBuf, sizeof(Settings.mqtt_pwd));
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_pwd);
restart_flag = 2;
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_ASTERIX, command);
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_pwd);
}
else if (CMND_FULLTOPIC == command_code) {
if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_fulltopic))) {

View File

@ -345,7 +345,7 @@ boolean TimerCommand()
}
} else {
if (devices_present) {
StaticJsonBuffer<128> jsonBuffer;
StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(dataBufUc);
if (!root.success()) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_TIMER "%d\":\"" D_JSON_INVALID_JSON "\"}"), index); // JSON decode failed