From ee7227254feed210cb47fb0bcbe3924ad0848687 Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Wed, 11 Apr 2018 10:11:20 +0200 Subject: [PATCH 1/3] Minor changes to prep for rules Change German day display to two character (#2403) --- sonoff/language/de-DE.h | 2 +- sonoff/settings.h | 2 +- sonoff/sonoff.h | 5 ++++- sonoff/support.ino | 6 ++++++ sonoff/webserver.ino | 24 ++++++++---------------- sonoff/xdrv_00_mqtt.ino | 4 ++++ sonoff/xsns_01_counter.ino | 2 +- sonoff/xsns_04_snfsc.ino | 10 ++++++---- sonoff/xsns_05_ds18b20.ino | 2 +- sonoff/xsns_05_ds18x20.ino | 2 +- sonoff/xsns_05_ds18x20_legacy.ino | 2 +- sonoff/xsns_06_dht.ino | 2 +- sonoff/xsns_07_sht1x.ino | 2 +- sonoff/xsns_08_htu21.ino | 2 +- sonoff/xsns_09_bmp.ino | 2 +- sonoff/xsns_10_bh1750.ino | 2 +- sonoff/xsns_11_veml6070.ino | 2 +- sonoff/xsns_13_ina219.ino | 6 ++++-- sonoff/xsns_14_sht3x.ino | 2 +- sonoff/xsns_15_mhz19.ino | 2 +- sonoff/xsns_16_tsl2561.ino | 2 +- sonoff/xsns_17_senseair.ino | 2 +- sonoff/xsns_18_pms5003.ino | 8 +++++--- sonoff/xsns_20_novasds.ino | 6 ++++-- sonoff/xsns_21_sgp30.ino | 2 +- 25 files changed, 58 insertions(+), 45 deletions(-) diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index fde844b8b..7a2a169b2 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -42,7 +42,7 @@ #define D_HOUR_MINUTE_SEPARATOR ":" #define D_MINUTE_SECOND_SEPARATOR ":" -#define D_DAY3LIST "SonMonDieMitDonFriSam" +#define D_DAY3LIST "So Mo Di Mi Do Fr Sa " #define D_MONTH3LIST "JanFebMärAprMaiJunJulAugSepOktNovDez" // Non JSON decimal separator diff --git a/sonoff/settings.h b/sonoff/settings.h index d9c53a4bc..e9fe0f296 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -258,7 +258,7 @@ struct SYSCFG { byte free_6b8[72]; // 6B8 - char rules[256]; // 700 + char rules[MAX_RULE_SIZE]; // 700 // 800 - FFF free locations } Settings; diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 0869c6929..279c1652d 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -48,6 +48,7 @@ typedef unsigned long power_t; // Power (Relay) type #define MAX_FRIENDLYNAMES 4 // Max number of Friendly names #define MAX_DOMOTICZ_IDX 4 // Max number of Domoticz device, key and switch indices #define MAX_DOMOTICZ_SNS_IDX 12 // Max number of Domoticz sensors indices +#define MAX_RULE_SIZE 256 // Max number of characters in rules #define MODULE SONOFF_BASIC // [Module] Select default model @@ -163,7 +164,9 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX}; enum XsnsFunctions {FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, - FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR}; + FUNC_COMMAND, FUNC_NTP_INIT, FUNC_NTP_SET, + FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_MQTT_DISCONNECTED, FUNC_MQTT_CONNECTED, + FUNC_SET_POWER, FUNC_SHOW_SENSOR}; const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 }; diff --git a/sonoff/support.ino b/sonoff/support.ino index 58ecce027..591a4c571 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -1376,6 +1376,12 @@ void RtcSecond() snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str()); AddLog(LOG_LEVEL_DEBUG); + + if (local_time < 1451602800) { + XdrvCall(FUNC_NTP_SET); + } else { + XdrvCall(FUNC_NTP_SET); + } } else { ntp_sync_minute++; // Try again in next minute } diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index b697e2bab..20ddb0b0c 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -183,12 +183,10 @@ const char HTTP_BTN_RSTRT[] PROGMEM = "
"; const char HTTP_BTN_MENU_MODULE[] PROGMEM = "
"; -#ifdef USE_TIMERS -#ifdef USE_TIMERS_WEB +#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB) const char HTTP_BTN_MENU_TIMER[] PROGMEM = "
"; -#endif // USE_TIMERS_WEB -#endif // USE_TIMERS +#endif // USE_TIMERS and USE_TIMERS_WEB const char HTTP_BTN_MENU_WIFI[] PROGMEM = "
"; const char HTTP_BTN_MENU_MQTT[] PROGMEM = @@ -340,11 +338,9 @@ void StartWebserver(int type, IPAddress ipweb) WebServer->on("/", HandleRoot); WebServer->on("/cn", HandleConfiguration); WebServer->on("/md", HandleModuleConfiguration); -#ifdef USE_TIMERS -#ifdef USE_TIMERS_WEB +#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB) WebServer->on("/tm", HandleTimerConfiguration); -#endif // USE_TIMERS_WEB -#endif // USE_TIMERS +#endif // USE_TIMERS and USE_TIMERS_WEB WebServer->on("/w1", HandleWifiConfigurationWithScan); WebServer->on("/w0", HandleWifiConfiguration); if (Settings.flag.mqtt_enabled) { @@ -632,11 +628,9 @@ void HandleConfiguration() page.replace(F("{v}"), FPSTR(S_CONFIGURATION)); page += FPSTR(HTTP_HEAD_STYLE); page += FPSTR(HTTP_BTN_MENU_MODULE); -#ifdef USE_TIMERS -#ifdef USE_TIMERS_WEB +#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB) if (devices_present) page += FPSTR(HTTP_BTN_MENU_TIMER); -#endif // USE_TIMERS_WEB -#endif // USE_TIMERS +#endif // USE_TIMERS and USE_TIMERS_WEB page += FPSTR(HTTP_BTN_MENU_WIFI); if (Settings.flag.mqtt_enabled) page += FPSTR(HTTP_BTN_MENU_MQTT); page += FPSTR(HTTP_BTN_MENU4); @@ -1103,13 +1097,11 @@ void HandleSaveSettings() Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.tele_period); AddLog(LOG_LEVEL_INFO); break; -#ifdef USE_TIMERS -#ifdef USE_TIMERS_WEB +#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB) case 7: TimerSaveSettings(); break; -#endif // USE_TIMERS_WEB -#endif // USE_TIMERS +#endif // USE_TIMERS and USE_TIMERS_WEB #ifdef USE_DOMOTICZ case 4: DomoticzSaveSettings(); diff --git a/sonoff/xdrv_00_mqtt.ino b/sonoff/xdrv_00_mqtt.ino index f9be1003c..ca74724c3 100644 --- a/sonoff/xdrv_00_mqtt.ino +++ b/sonoff/xdrv_00_mqtt.ino @@ -316,6 +316,8 @@ void MqttDisconnected(int state) snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), Settings.mqtt_host, Settings.mqtt_port, state, mqtt_retry_counter); AddLog(LOG_LEVEL_INFO); + + XdrvCall(FUNC_MQTT_DISCONNECTED); } void MqttConnected() @@ -371,6 +373,8 @@ void MqttConnected() XdrvCall(FUNC_MQTT_INIT); } mqtt_initial_connection_state = 0; + + XdrvCall(FUNC_MQTT_CONNECTED); } #ifdef USE_MQTT_TLS diff --git a/sonoff/xsns_01_counter.ino b/sonoff/xsns_01_counter.ino index 68cc418d0..397f3d853 100644 --- a/sonoff/xsns_01_counter.ino +++ b/sonoff/xsns_01_counter.ino @@ -105,7 +105,7 @@ void CounterShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_COUNTER "%d\":%s"), mqtt_data, i +1, counter); #ifdef USE_DOMOTICZ - if (1 == dsxflg) { + if ((0 == tele_period) && (1 == dsxflg)) { DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]); dsxflg++; } diff --git a/sonoff/xsns_04_snfsc.ino b/sonoff/xsns_04_snfsc.ino index 944dff985..63bdcc5d8 100644 --- a/sonoff/xsns_04_snfsc.ino +++ b/sonoff/xsns_04_snfsc.ino @@ -123,10 +123,12 @@ void SonoffScShow(boolean json) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SonoffSC\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_LIGHT "\":%d,\"" D_JSON_NOISE "\":%d,\"" D_JSON_AIRQUALITY "\":%d}"), mqtt_data, temperature, humidity, sc_value[2], sc_value[3], sc_value[4]); #ifdef USE_DOMOTICZ - DomoticzTempHumSensor(temperature, humidity); - DomoticzSensor(DZ_ILLUMINANCE, sc_value[2]); - DomoticzSensor(DZ_COUNT, sc_value[3]); - DomoticzSensor(DZ_AIRQUALITY, 500 + ((100 - sc_value[4]) * 20)); + if (0 == tele_period) { + DomoticzTempHumSensor(temperature, humidity); + DomoticzSensor(DZ_ILLUMINANCE, sc_value[2]); + DomoticzSensor(DZ_COUNT, sc_value[3]); + DomoticzSensor(DZ_AIRQUALITY, 500 + ((100 - sc_value[4]) * 20)); + } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_05_ds18b20.ino b/sonoff/xsns_05_ds18b20.ino index bec747c45..6faeeed18 100644 --- a/sonoff/xsns_05_ds18b20.ino +++ b/sonoff/xsns_05_ds18b20.ino @@ -197,7 +197,7 @@ void Ds18b20Show(boolean json) if(json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18B20\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, temperature); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_TEMP, temperature); + if (0 == tele_period) DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino index 23dc4482e..4f17e94cd 100644 --- a/sonoff/xsns_05_ds18x20.ino +++ b/sonoff/xsns_05_ds18x20.ino @@ -380,7 +380,7 @@ void Ds18x20Show(boolean json) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, stemp, address, temperature); } #ifdef USE_DOMOTICZ - if (domoticz_flag) { + if ((0 == tele_period) && domoticz_flag) { DomoticzSensor(DZ_TEMP, temperature); domoticz_flag = false; } diff --git a/sonoff/xsns_05_ds18x20_legacy.ino b/sonoff/xsns_05_ds18x20_legacy.ino index 085280ece..bd78ff424 100644 --- a/sonoff/xsns_05_ds18x20_legacy.ino +++ b/sonoff/xsns_05_ds18x20_legacy.ino @@ -188,7 +188,7 @@ void Ds18x20Show(boolean json) mqtt_data, stemp, i +1, ds18x20_types, Ds18x20Addresses(i).c_str(), temperature); strcpy(stemp, ","); #ifdef USE_DOMOTICZ - if (1 == dsxflg) { + if ((0 == tele_period) && (1 == dsxflg)) { DomoticzSensor(DZ_TEMP, temperature); } #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_06_dht.ino b/sonoff/xsns_06_dht.ino index e23d1989f..2bca2d87f 100644 --- a/sonoff/xsns_06_dht.ino +++ b/sonoff/xsns_06_dht.ino @@ -226,7 +226,7 @@ void DhtShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, Dht[i].stype, temperature, humidity); #ifdef USE_DOMOTICZ - if (!dsxflg) { + if ((0 == tele_period) && !dsxflg) { DomoticzTempHumSensor(temperature, humidity); dsxflg++; } diff --git a/sonoff/xsns_07_sht1x.ino b/sonoff/xsns_07_sht1x.ino index 6ff557aff..08afed555 100644 --- a/sonoff/xsns_07_sht1x.ino +++ b/sonoff/xsns_07_sht1x.ino @@ -199,7 +199,7 @@ void ShtShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, "SHT1X", temperature, humidity); #ifdef USE_DOMOTICZ - DomoticzTempHumSensor(temperature, humidity); + if (0 == tele_period) DomoticzTempHumSensor(temperature, humidity); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_08_htu21.ino b/sonoff/xsns_08_htu21.ino index d4d52a6e3..a36ad0db7 100644 --- a/sonoff/xsns_08_htu21.ino +++ b/sonoff/xsns_08_htu21.ino @@ -262,7 +262,7 @@ void HtuShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, htu_types, temperature, humidity); #ifdef USE_DOMOTICZ - DomoticzTempHumSensor(temperature, humidity); + if (0 == tele_period) DomoticzTempHumSensor(temperature, humidity); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_09_bmp.ino b/sonoff/xsns_09_bmp.ino index abfe2e582..9ca0fa491 100644 --- a/sonoff/xsns_09_bmp.ino +++ b/sonoff/xsns_09_bmp.ino @@ -465,7 +465,7 @@ void BmpShow(boolean json) mqtt_data, bmp_name, temperature, (bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : ""); #endif // USE_BME680 #ifdef USE_DOMOTICZ - DomoticzTempHumPressureSensor(temperature, humidity, pressure); + if (0 == tele_period) DomoticzTempHumPressureSensor(temperature, humidity, pressure); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_10_bh1750.ino b/sonoff/xsns_10_bh1750.ino index f39833fc4..9c02f02e0 100644 --- a/sonoff/xsns_10_bh1750.ino +++ b/sonoff/xsns_10_bh1750.ino @@ -77,7 +77,7 @@ void Bh1750Show(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"BH1750\":{\"" D_JSON_ILLUMINANCE "\":%d}"), mqtt_data, illuminance); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_ILLUMINANCE, illuminance); + if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, illuminance); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_11_veml6070.ino b/sonoff/xsns_11_veml6070.ino index aa5dba112..557f615f3 100644 --- a/sonoff/xsns_11_veml6070.ino +++ b/sonoff/xsns_11_veml6070.ino @@ -82,7 +82,7 @@ void Veml6070Show(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"VEML6070\":{\"" D_JSON_UV_LEVEL "\":%d}"), mqtt_data, uvlevel); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_ILLUMINANCE, uvlevel); + if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, uvlevel); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_13_ina219.ino b/sonoff/xsns_13_ina219.ino index 8fb4e2f1b..50bcb1642 100644 --- a/sonoff/xsns_13_ina219.ino +++ b/sonoff/xsns_13_ina219.ino @@ -216,8 +216,10 @@ void Ina219Show(boolean json) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"INA219\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), mqtt_data, voltage, current, power); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_VOLTAGE, voltage); - DomoticzSensor(DZ_CURRENT, current); + if (0 == tele_period) { + DomoticzSensor(DZ_VOLTAGE, voltage); + DomoticzSensor(DZ_CURRENT, current); + } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_14_sht3x.ino b/sonoff/xsns_14_sht3x.ino index afedf31fc..76a808474 100644 --- a/sonoff/xsns_14_sht3x.ino +++ b/sonoff/xsns_14_sht3x.ino @@ -107,7 +107,7 @@ void Sht3xShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, types, temperature, humidity); #ifdef USE_DOMOTICZ - if (0 == i) { // We want the same first sensor to report to Domoticz in case a read is missed + if ((0 == tele_period) && (0 == i)) { // We want the same first sensor to report to Domoticz in case a read is missed DomoticzTempHumSensor(temperature, humidity); } #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_15_mhz19.ino b/sonoff/xsns_15_mhz19.ino index a5e09725c..4cbf88c9e 100644 --- a/sonoff/xsns_15_mhz19.ino +++ b/sonoff/xsns_15_mhz19.ino @@ -265,7 +265,7 @@ void MhzShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, mhz_types, mhz_last_ppm, temperature); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm); + if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino index 24ae0dee6..6fe09a88f 100644 --- a/sonoff/xsns_16_tsl2561.ino +++ b/sonoff/xsns_16_tsl2561.ino @@ -71,7 +71,7 @@ void Tsl2561Show(boolean json) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%u.%03u}"), mqtt_data, milliLux/1000, milliLux%1000); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_ILLUMINANCE, (milliLux+500)/1000); + if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, (milliLux+500)/1000); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_17_senseair.ino b/sonoff/xsns_17_senseair.ino index eb647b11c..3e938bdea 100644 --- a/sonoff/xsns_17_senseair.ino +++ b/sonoff/xsns_17_senseair.ino @@ -213,7 +213,7 @@ void SenseairShow(boolean json) } snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_AIRQUALITY, senseair_co2); + if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, senseair_co2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_18_pms5003.ino b/sonoff/xsns_18_pms5003.ino index 18b26263e..55a3b134e 100644 --- a/sonoff/xsns_18_pms5003.ino +++ b/sonoff/xsns_18_pms5003.ino @@ -131,9 +131,11 @@ void PmsShow(boolean json) pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env, pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um, pms_data.particles_50um, pms_data.particles_100um); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_COUNT, pms_data.pm10_env); // PM1 - DomoticzSensor(DZ_VOLTAGE, pms_data.pm25_env); // PM2.5 - DomoticzSensor(DZ_CURRENT, pms_data.pm100_env); // PM10 + if (0 == tele_period) { + DomoticzSensor(DZ_COUNT, pms_data.pm10_env); // PM1 + DomoticzSensor(DZ_VOLTAGE, pms_data.pm25_env); // PM2.5 + DomoticzSensor(DZ_CURRENT, pms_data.pm100_env); // PM10 + } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_20_novasds.ino b/sonoff/xsns_20_novasds.ino index 8f6b591da..5c38ff0f5 100644 --- a/sonoff/xsns_20_novasds.ino +++ b/sonoff/xsns_20_novasds.ino @@ -108,8 +108,10 @@ void NovaSdsShow(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SDS0X1\":{\"PM2.5\":%s,\"PM10\":%s}"), mqtt_data, pm2_5, pm10); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5 - DomoticzSensor(DZ_CURRENT, pm10); // PM10 + if (0 == tele_period) { + DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5 + DomoticzSensor(DZ_CURRENT, pm10); // PM10 + } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_21_sgp30.ino b/sonoff/xsns_21_sgp30.ino index eed03ce7f..d30281155 100644 --- a/sonoff/xsns_21_sgp30.ino +++ b/sonoff/xsns_21_sgp30.ino @@ -74,7 +74,7 @@ void Sgp30Show(boolean json) if (json) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), mqtt_data, sgp.eCO2, sgp.TVOC); #ifdef USE_DOMOTICZ - DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2); + if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2); #endif // USE_DOMOTICZ } else { #ifdef USE_WEBSERVER From 18074dbce3b91cefb5ca49ba9c14a6d35c7a33be Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Wed, 11 Apr 2018 10:49:37 +0200 Subject: [PATCH 2/3] Update Czech language file (#2418, #2410) --- sonoff/language/cs-CZ.h | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/sonoff/language/cs-CZ.h b/sonoff/language/cs-CZ.h index 0920fc2e6..0b2fed9f1 100644 --- a/sonoff/language/cs-CZ.h +++ b/sonoff/language/cs-CZ.h @@ -42,8 +42,8 @@ #define D_HOUR_MINUTE_SEPARATOR ":" #define D_MINUTE_SECOND_SEPARATOR ":" -#define D_DAY3LIST "PonÚteStřČtvPátSobNed" -#define D_MONTH3LIST "LedÚnoBřeDubKvěČerČevSrpZářŘíjLisPro" +#define D_DAY3LIST "Po Út St Čt Pá So Ne " +#define D_MONTH3LIST "LedÚnoBřeDubKvěČvnČvcSrpZářŘíjLisPro" // Non JSON decimal separator #define D_DECIMAL_SEPARATOR "," @@ -56,19 +56,19 @@ #define D_AUTO "AUTO" #define D_BLINK "Blikání" #define D_BLINKOFF "BlikáníVyp" -#define D_BOOT_COUNT "Počítadlo spuštění" +#define D_BOOT_COUNT "Počitadlo spuštění" #define D_BRIGHTLIGHT "Světlý" #define D_BUTTON "Tlačítko" #define D_BY "by" // Written by me -#define D_BYTES "Bytu" -#define D_CELSIUS "Celsia" -#define D_CO2 "Kysličníku uhličitého" +#define D_BYTES "Bytů" +#define D_CELSIUS "°C" +#define D_CO2 "CO2" #define D_CODE "kód" // Button code -#define D_COLDLIGHT "Studený" +#define D_COLDLIGHT "Studené světlo" #define D_COMMAND "Příkaz" #define D_CONNECTED "...připojeno" #define D_COUNT "Počítej" -#define D_COUNTER "Počítadlo" +#define D_COUNTER "Počitadlo" #define D_CURRENT "Proud" // As in Voltage and Current #define D_DATA "Data" #define D_DARKLIGHT "Tmavý" @@ -89,14 +89,14 @@ #define D_FALSE "Nepravda" #define D_FILE "Soubor" #define D_FREE_MEMORY "Volná paměť" -#define D_GAS "Gas" +#define D_GAS "Plyn" #define D_GATEWAY "Výchozí brána" #define D_GROUP "Skupina" #define D_HOST "Server" #define D_HOSTNAME "Název serveru" #define D_HUMIDITY "Vlhkost" #define D_ILLUMINANCE "Osvětlení" -#define D_IMMEDIATE "Mžikové" // Button immediate +#define D_IMMEDIATE "Okamžité" // Button immediate #define D_INDEX "Index" #define D_INFO "Informace" #define D_INITIALIZED "Inicializovaný" @@ -107,11 +107,11 @@ #define D_MQTT "MQTT" #define D_MULTI_PRESS "několikeré-stisknutí" #define D_NOISE "Hluk" -#define D_NONE "Není" -#define D_OFF "Vypnutý" +#define D_NONE "Žádný" +#define D_OFF "Vyp." #define D_OFFLINE "Neaktivní" #define D_OK "OK" -#define D_ON "Sepnutý" +#define D_ON "Zap." #define D_ONLINE "Aktivní" #define D_PASSWORD "Heslo" #define D_PORT "Port" @@ -119,15 +119,15 @@ #define D_POWERUSAGE "Příkon" #define D_PRESSURE "Tlak" #define D_PRESSUREATSEALEVEL "Tlak na úrovni hladiny moře" -#define D_PROGRAM_FLASH_SIZE "Velikost flash programu" +#define D_PROGRAM_FLASH_SIZE "Velikost paměti flash" #define D_PROGRAM_SIZE "Velikost programu" #define D_PROJECT "Projekt" -#define D_RECEIVED "Obdržený" +#define D_RECEIVED "Přijatý" #define D_RESTART "Restart" #define D_RESTARTING "Restartování" #define D_RESTART_REASON "Příčina restartu" -#define D_RESTORE "Načtený" -#define D_RETAINED "Uloženo" +#define D_RESTORE "Obnovit" +#define D_RETAINED "Zachováno" #define D_SAVE "Ulož" #define D_SENSOR "Sensor" #define D_SSID "SSID" @@ -137,8 +137,8 @@ #define D_SUBNET_MASK "Maska podsítě" #define D_SUBSCRIBE_TO "Přihlaš se do" #define D_SUCCESSFUL "úspěšné." -#define D_SUNRISE "Sunrise" -#define D_SUNSET "Sunset" +#define D_SUNRISE "Svítání" +#define D_SUNSET "Soumrak" #define D_TEMPERATURE "Teplota" #define D_TO "do" #define D_TOGGLE "Přepni" @@ -154,18 +154,18 @@ #define D_UV_LEVEL "úroveň UV" #define D_VERSION "Verze" #define D_VOLTAGE "Napětí" -#define D_WARMLIGHT "Ohřev" +#define D_WARMLIGHT "Teplé světlo" #define D_WEB_SERVER "Web Server" // sonoff.ino -#define D_WARNING_MINIMAL_VERSION "WARNING Tato verze nepodporuje trvalé nastavení" +#define D_WARNING_MINIMAL_VERSION "UPOZORNĚNÍ Tato verze nepodporuje trvalé nastavení" #define D_LEVEL_10 "úroveň 1-0" #define D_LEVEL_01 "úroveň 0-1" #define D_SERIAL_LOGGING_DISABLED "Logování na sériovém portu ukončeno" #define D_SYSLOG_LOGGING_REENABLED "Obnoven zápis do Syslog" #define D_SET_BAUDRATE_TO "Nastavení rychlosti přenosu na" -#define D_RECEIVED_TOPIC "Obdržený topic" +#define D_RECEIVED_TOPIC "Přijatý topic" #define D_DATA_SIZE "Velikost dat" #define D_ANALOG_INPUT "Analogový vstup" @@ -228,13 +228,13 @@ #define D_RESTORE_CONFIGURATION "Obnovení nastavení" #define D_MAIN_MENU "Hlavní menu" -#define D_MODULE_PARAMETERS "Parametry modulu" +#define D_MODULE_PARAMETERS "Nastavení modulu" #define D_MODULE_TYPE "Typ modulu" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" -#define D_WIFI_PARAMETERS "Parametry WiFi" +#define D_WIFI_PARAMETERS "Nastavení WiFi" #define D_SCAN_FOR_WIFI_NETWORKS "Scan sítí WiFi" #define D_SCAN_DONE "Scan dokončen" #define D_NO_NETWORKS_FOUND "Síť nebyla nalezena" @@ -250,11 +250,11 @@ #define D_AP2_SSID "AP2 SSID" #define D_AP2_PASSWORD "Heslo AP2" -#define D_MQTT_PARAMETERS "Parametry MQTT" +#define D_MQTT_PARAMETERS "Nastavení MQTT" #define D_CLIENT "Klient" #define D_FULL_TOPIC "Celý topic" -#define D_LOGGING_PARAMETERS "Volby logování" +#define D_LOGGING_PARAMETERS "Volba logování" #define D_SERIAL_LOG_LEVEL "Seriová úroveň logu" #define D_WEB_LOG_LEVEL "Webová úroveň logu" #define D_SYS_LOG_LEVEL "Systemová úroveň logu" @@ -263,7 +263,7 @@ #define D_SYSLOG_PORT "Syslog port" #define D_TELEMETRY_PERIOD "Interval telemetrie" -#define D_OTHER_PARAMETERS "Jiné parametry" +#define D_OTHER_PARAMETERS "Další nastavení" #define D_WEB_ADMIN_PASSWORD "Heslo Web administrátora" #define D_MQTT_ENABLE "MQTT aktivní" #define D_FRIENDLY_NAME "Friendly Name" @@ -346,7 +346,7 @@ #define D_3_RESPONSE_PACKETS_SENT "3 pakety odpovědi odeslány" // xdrv_05_domoticz.ino -#define D_DOMOTICZ_PARAMETERS "Parametry Domoticz" +#define D_DOMOTICZ_PARAMETERS "Nastavení Domoticz" #define D_DOMOTICZ_IDX "Idx" #define D_DOMOTICZ_KEY_IDX "Key idx" #define D_DOMOTICZ_SWITCH_IDX "Spinac idx" @@ -363,19 +363,19 @@ #define D_DOMOTICZ_UPDATE_TIMER "Aktualizace stopek" // xdrv_09_timers.ino -#define D_CONFIGURE_TIMER "Configure Timer" -#define D_TIMER_PARAMETERS "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_POWER "Power" +#define D_CONFIGURE_TIMER "Nastavení Časovače" +#define D_TIMER_PARAMETERS "Časovač" +#define D_TIMER_ARM "Zajistit" +#define D_TIMER_TIME "Čas" +#define D_TIMER_DAYS "Dny" +#define D_TIMER_REPEAT "Opakovat" +#define D_TIMER_OUTPUT "Výstup" +#define D_TIMER_POWER "Napájení" // xdrv_03_energy.ino -#define D_ENERGY_TODAY "Energie Dnes" -#define D_ENERGY_YESTERDAY "Energie Včera" -#define D_ENERGY_TOTAL "Energie Součet" +#define D_ENERGY_TODAY "Spotřeba Dnes" +#define D_ENERGY_YESTERDAY "Spotřeba Včera" +#define D_ENERGY_TOTAL "Celková spotřeba" // xsns_05_ds18b20.ino #define D_SENSOR_BUSY "Sensor DS18x20 obsazen" @@ -384,19 +384,19 @@ // xsns_06_dht.ino #define D_TIMEOUT_WAITING_FOR "Čekání na" -#define D_START_SIGNAL_LOW "signál, startovní nízký" -#define D_START_SIGNAL_HIGH "signál, startovní vysoký" -#define D_PULSE "puls" +#define D_START_SIGNAL_LOW "nízký startovní signál" +#define D_START_SIGNAL_HIGH "vysoký startovní signál" +#define D_PULSE "impuls" #define D_CHECKSUM_FAILURE "Chybný kontrolní součet" // xsns_07_sht1x.ino -#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor neobdržel pžíkaz ACK" +#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor neobdržel příkaz ACK" #define D_SHT1X_FOUND "SHT1X nalezen" // xsns_18_pms5003.ino #define D_STANDARD_CONCENTRATION "CF-1 PM" // Standard Particle CF-1 Particle Matter #define D_ENVIRONMENTAL_CONCENTRATION "PM" // Environmetal Particle Matter -#define D_PARTICALS_BEYOND "Particals" +#define D_PARTICALS_BEYOND "částic" // sonoff_template.h #define D_SENSOR_NONE "Není" @@ -409,11 +409,11 @@ #define D_SENSOR_WS2812 "WS2812" #define D_SENSOR_IRSEND "IRsend" #define D_SENSOR_SWITCH "Spínač" // Suffix "1" -#define D_SENSOR_BUTTON "Tlačít" // Suffix "1" +#define D_SENSOR_BUTTON "Tlačítko" // Suffix "1" #define D_SENSOR_RELAY "Relé" // Suffix "1i" #define D_SENSOR_LED "Led" // Suffix "1i" #define D_SENSOR_PWM "PWM" // Suffix "1", -#define D_SENSOR_COUNTER "Počíta" // Suffix "1" +#define D_SENSOR_COUNTER "Počitadlo" // Suffix "1" #define D_SENSOR_IRRECV "IRrecv" #define D_SENSOR_MHZ_RX "MHZ Rx" #define D_SENSOR_MHZ_TX "MHZ Tx" @@ -431,7 +431,7 @@ // Units #define D_UNIT_AMPERE "A" -#define D_UNIT_HOUR "Hod" +#define D_UNIT_HOUR "hod" #define D_UNIT_KILOOHM "kOhm" #define D_UNIT_KILOWATTHOUR "kWh" #define D_UNIT_LUX "lx" @@ -440,7 +440,7 @@ #define D_UNIT_MICROSECOND "us" #define D_UNIT_MILLIAMPERE "mA" #define D_UNIT_MILLISECOND "ms" -#define D_UNIT_MINUTE "Min" +#define D_UNIT_MINUTE "min" #define D_UNIT_PARTS_PER_BILLION "ppb" #define D_UNIT_PARTS_PER_DECILITER "ppd" #define D_UNIT_PARTS_PER_MILLION "ppm" From 208f64fd8f7595b41211ab089c3b789978815e74 Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Wed, 11 Apr 2018 17:56:18 +0200 Subject: [PATCH 3/3] Fix empty friendlyname (#2420) --- sonoff/sonoff.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index d689b66fc..4142b602f 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -558,7 +558,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) XsnsCall(FUNC_COMMAND); // if (!XsnsCall(FUNC_COMMAND)) type = NULL; } - else if ((CMND_SETOPTION == command_code) && ((index <= 23) || ((index > 31) && (index <= P_MAX_PARAM8 + 31)))) { + else if ((CMND_SETOPTION == command_code) && ((index <= 21) || ((index > 31) && (index <= P_MAX_PARAM8 + 31)))) { if (index <= 31) { ptype = 0; // SetOption0 .. 31 } else { @@ -588,7 +588,8 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) case 19: // hass_discovery case 20: // not_power_linked case 21: // no_power_on_check - case 23: // rules_enabled +// case 22: // mqtt_serial - use commands SerialSend and SerialLog +// case 23: // rules_enabled - use command Rule bitWrite(Settings.flag.data, index, payload); } if (12 == index) { // stop_flash_rotate @@ -1258,7 +1259,7 @@ void PublishStatus(uint8_t payload) if (!energy_flg && (9 == payload)) payload = 99; if ((0 == payload) || (99 == payload)) { - uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : devices_present; + uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present; stemp[0] = '\0'; for (byte i = 0; i < maxfn; i++) { snprintf_P(stemp, sizeof(stemp), PSTR("%s%s\"%s\"" ), stemp, (i > 0 ? "," : ""), Settings.friendlyname[i]);