From 5639b6d9664c13c322acc6eb92eb0962059ed453 Mon Sep 17 00:00:00 2001 From: arendst Date: Fri, 29 Dec 2017 14:35:05 +0100 Subject: [PATCH 1/3] v5.10.0f 5.10.0f * Differentiate between JSON text defines and other text defines to allow for English JSON while using different locale (#1449) * Fix display of build date and time in non-english locale (#1465) --- README.md | 2 +- sonoff/_releasenotes.ino | 8 +++- sonoff/i18n.h | 6 ++- sonoff/language/de-DE.h | 70 +++++++++++++++++++----------- sonoff/language/en-GB.h | 70 +++++++++++++++++++----------- sonoff/language/it-IT.h | 70 +++++++++++++++++++----------- sonoff/language/nl-NL.h | 72 +++++++++++++++++++------------ sonoff/language/pl-PL.h | 70 +++++++++++++++++++----------- sonoff/sonoff.ino | 10 ++--- sonoff/support.ino | 9 ++-- sonoff/xdrv_irremote.ino | 34 +++++++-------- sonoff/xdrv_light.ino | 2 +- sonoff/xdrv_snfbridge.ino | 2 +- sonoff/xsns_01_counter.ino | 2 +- sonoff/xsns_03_energy.ino | 6 +-- sonoff/xsns_04_snfsc.ino | 2 +- sonoff/xsns_05_ds18b20.ino | 2 +- sonoff/xsns_05_ds18x20.ino | 4 +- sonoff/xsns_05_ds18x20_legacy.ino | 2 +- sonoff/xsns_09_bmp.ino | 8 ++-- sonoff/xsns_10_bh1750.ino | 2 +- sonoff/xsns_11_veml6070.ino | 2 +- sonoff/xsns_12_ads1115.ino | 2 +- sonoff/xsns_12_ads1115_i2cdev.ino | 2 +- sonoff/xsns_13_ina219.ino | 2 +- sonoff/xsns_15_mhz19.ino | 2 +- sonoff/xsns_16_tsl2561.ino | 2 +- sonoff/xsns_17_senseair.ino | 4 +- 28 files changed, 282 insertions(+), 187 deletions(-) diff --git a/README.md b/README.md index 1fac28e61..e15875409 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **5.10.0e** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.10.0f** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 9ec2c7e84..45cc45518 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,7 +1,11 @@ -/* 5.10.0e +/* 5.10.0f + * Differentiate between JSON text defines and other text defines to allow for English JSON while using different locale (#1449) + * Fix display of build date and time in non-english locale (#1465) + * + * 5.10.0e * Add Italian language file (#1449) * Fix Wemo Emulation once again closest to issue (#1357) - * Add support for sensor SHT3x + * Add support for sensor SHT3x (#1314) * * 5.10.0d * Renamed commands Color2,3,4 to Color3,4,5 diff --git a/sonoff/i18n.h b/sonoff/i18n.h index 3c3fd66be..a730ba171 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -33,12 +33,14 @@ enum UnitNames { UNIT_AMPERE, UNIT_HOUR, + UNIT_KILOOHM, UNIT_KILOWATTHOUR, UNIT_LUX, UNIT_MICROSECOND, UNIT_MILLIAMPERE, UNIT_MILLISECOND, UNIT_MINUTE, + UNIT_PPM, UNIT_PRESSURE, UNIT_SECOND, UNIT_SECTORS, @@ -48,12 +50,14 @@ enum UnitNames { const char kUnitNames[] PROGMEM = D_UNIT_AMPERE "|" D_UNIT_HOUR "|" + D_UNIT_KILOOHM "|" D_UNIT_KILOWATTHOUR "|" D_UNIT_LUX "|" D_UNIT_MICROSECOND "|" D_UNIT_MILLIAMPERE "|" D_UNIT_MILLISECOND "|" D_UNIT_MINUTE "|" + D_UNIT_PPM "|" D_UNIT_PRESSURE "|" D_UNIT_SECOND "|" D_UNIT_SECTORS "|" @@ -77,7 +81,7 @@ const char S_JSON_COMMAND_INDEX_NVALUE[] PROGMEM = "{\"%s%d\":%d}"; const char S_JSON_COMMAND_INDEX_SVALUE[] PROGMEM = "{\"%s%d\":\"%s\"}"; const char S_JSON_COMMAND_INDEX_SVALUE_SVALUE[] PROGMEM = "{\"%s%d\":\"%s%s\"}"; -const char JSON_SNS_TEMPHUM[] PROGMEM = "%s,\"%s\":{\"" D_TEMPERATURE "\":%s,\"" D_HUMIDITY "\":%s}"; +const char JSON_SNS_TEMPHUM[] PROGMEM = "%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"; const char S_LOG_I2C_FOUND_AT[] PROGMEM = D_LOG_I2C "%s " D_FOUND_AT " 0x%x"; diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index a89aa29e5..98f25d8b1 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -46,10 +46,8 @@ // Common #define D_ABORTED "abgebrochen" #define D_ACTIVE "aktiv" -#define D_ADDRESS "Addresse" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Luftqualität" -#define D_AIRQUALITY "LuftQualität" #define D_AP "AP" // Access Point #define D_APMAC_ADDRESS "AP-Mac" #define D_APPENDED "angehängt" @@ -106,7 +104,6 @@ #define D_GATEWAY "Gateway" #define D_GROUP "Gruppe" #define D_HEAPSIZE "Heap-Größe" -#define D_HIGH "hoch" #define D_HOST "Host" #define D_HOSTNAME "Hostname" #define D_HUMIDITY "Feuchtigkeit" @@ -120,7 +117,6 @@ #define D_LIGHT "Licht" #define D_LIMIT "Grenzwert" #define D_LOCAL_TIME "lokale Zeit" -#define D_LOW "niedrig" #define D_LWT "LWT" #define D_MAC "MAC" #define D_MASK "Maske" @@ -135,12 +131,9 @@ #define D_OK "OK" #define D_ON "an" #define D_ONLINE "online" -#define D_OR "oder" #define D_PASSWORD "Passwort" -#define D_PERIOD "Punkt" #define D_PORT "Port" #define D_POWER_FACTOR "Leistungsfaktor" -#define D_POWERFACTOR "Faktor" #define D_POWERUSAGE "Leistung" #define D_PRESSURE "Druck" #define D_PRESSUREATSEALEVEL "MeeresDruck" @@ -176,20 +169,15 @@ #define D_SUBSCRIBE_TO "subscribe to" #define D_SUCCESSFUL "erfolgreich" #define D_SWITCH "Schalter" -#define D_SYNC "sync" #define D_SYS "Sys " // Sys log #define D_TEMPERATURE "Temperatur" #define D_TEMPERATURE_UNIT "TempUnit" #define D_TIME "Zeit" #define D_TO "zu" -#define D_TODAY "heute" #define D_TOGGLE "An/Aus" #define D_TOPIC "topic" -#define D_TOTAL "Total" #define D_TRANSMIT "Übertragen" #define D_TRUE "wahr" -#define D_TYPE "Art" -#define D_UNKNOWN "unbekannt" #define D_UPGRADE "update" #define D_UPLOAD "Upload" #define D_UPTIME "Laufzeit" @@ -203,8 +191,38 @@ #define D_WEB "Web" // Web log #define D_WEB_SERVER "Web-Server" #define D_WIFI "WLAN" -#define D_WRONG "falsch" -#define D_YESTERDAY "gestern" + +// Text used in JSON messages +#define D_JSON_ADDRESS "Addresse" +#define D_JSON_AIRQUALITY "LuftQualität" +#define D_JSON_ANALOG_INPUT "Analog" +#define D_JSON_CO2 "CO²" +#define D_JSON_COUNTER "Zähler" +#define D_JSON_CURRENT "Strom" // As in Voltage and Current +#define D_JSON_DATA "Daten" +#define D_JSON_DONE "erledigt" +#define D_JSON_HIGH "hoch" +#define D_JSON_HUMIDITY "Feuchtigkeit" +#define D_JSON_ILLUMINANCE "Beleuchtungsintensität" +#define D_JSON_UNKNOWN "unbekannt" +#define D_JSON_LIGHT "Licht" +#define D_JSON_LOW "niedrig" +#define D_JSON_NOISE "Lautstärke" +#define D_JSON_OR "oder" +#define D_JSON_PERIOD "Punkt" +#define D_JSON_POWERFACTOR "Faktor" +#define D_JSON_POWERUSAGE "Leistung" +#define D_JSON_PRESSURE "Druck" +#define D_JSON_PRESSUREATSEALEVEL "MeeresDruck" +#define D_JSON_SYNC "sync" +#define D_JSON_TEMPERATURE "Temperatur" +#define D_JSON_TODAY "heute" +#define D_JSON_TOTAL "Total" +#define D_JSON_TYPE "Art" +#define D_JSON_UV_LEVEL "UV Level" +#define D_JSON_VOLTAGE "Spannung" +#define D_JSON_WRONG "falsch" +#define D_JSON_YESTERDAY "gestern" // settings.ino #define D_SAVED_TO_FLASH_AT "in Flash gespeichert am" @@ -391,17 +409,17 @@ #define D_DOMOTICZ_UPDATE_TIMER "Update timer" // xdrv_irremote.ino -#define D_INVALID_JSON "ungültiger JSON" -#define D_PROTOCOL_NOT_SUPPORTED "Protokoll nicht unterstützt" -#define D_IR_PROTOCOL "PROTOKOLL" -#define D_IR_BITS "BITS" -#define D_IR_DATA "DATEN" -#define D_IRHVAC_VENDOR "HERSTELLER" -#define D_IRHVAC_POWER "STROM" -#define D_IRHVAC_MODE "MODUS" -#define D_IRHVAC_FANSPEED "LÜFTERGESCHWINDIGKEIT" -#define D_IRHVAC_TEMP "TEMPERATUR" -#define D_IRRECEIVED "IR empfangen" +#define D_JSON_INVALID_JSON "ungültiger JSON" +#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protokoll nicht unterstützt" +#define D_JSON_IR_PROTOCOL "PROTOKOLL" +#define D_JSON_IR_BITS "BITS" +#define D_JSON_IR_DATA "DATEN" +#define D_JSON_IRHVAC_VENDOR "HERSTELLER" +#define D_JSON_IRHVAC_POWER "STROM" +#define D_JSON_IRHVAC_MODE "MODUS" +#define D_JSON_IRHVAC_FANSPEED "LÜFTERGESCHWINDIGKEIT" +#define D_JSON_IRHVAC_TEMP "TEMPERATUR" +#define D_JSON_IRRECEIVED "IR empfangen" // xdrv_snfbridge.ino #define D_RFRECEIVED "RF empfangen" @@ -707,4 +725,4 @@ #define D_CMND_MAXENERGY "MaxEnergy" #define D_CMND_MAXENERGYSTART "MaxEnergyStart" -#endif // _LANGUAGE_DE_DE_H_ \ No newline at end of file +#endif // _LANGUAGE_DE_DE_H_ diff --git a/sonoff/language/en-GB.h b/sonoff/language/en-GB.h index 497654872..dc293dc1c 100644 --- a/sonoff/language/en-GB.h +++ b/sonoff/language/en-GB.h @@ -46,10 +46,8 @@ // Common #define D_ABORTED "Aborted" #define D_ACTIVE "Active" -#define D_ADDRESS "Address" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Air quality" -#define D_AIRQUALITY "AirQuality" #define D_AP "AP" // Access Point #define D_APMAC_ADDRESS "APMac" #define D_APPENDED "Appended" @@ -106,7 +104,6 @@ #define D_GATEWAY "Gateway" #define D_GROUP "Group" #define D_HEAPSIZE "Heap" -#define D_HIGH "High" #define D_HOST "Host" #define D_HOSTNAME "Hostname" #define D_HUMIDITY "Humidity" @@ -120,7 +117,6 @@ #define D_LIGHT "Light" #define D_LIMIT "Limit" #define D_LOCAL_TIME "Local" -#define D_LOW "Low" #define D_LWT "LWT" #define D_MAC "Mac" #define D_MASK "Mask" @@ -135,12 +131,9 @@ #define D_OK "Ok" #define D_ON "On" #define D_ONLINE "Online" -#define D_OR "or" #define D_PASSWORD "Password" -#define D_PERIOD "Period" #define D_PORT "Port" #define D_POWER_FACTOR "Power Factor" -#define D_POWERFACTOR "Factor" #define D_POWERUSAGE "Power" #define D_PRESSURE "Pressure" #define D_PRESSUREATSEALEVEL "SeaPressure" @@ -176,20 +169,15 @@ #define D_SUBSCRIBE_TO "Subscribe to" #define D_SUCCESSFUL "Successful" #define D_SWITCH "Switch" -#define D_SYNC "Sync" #define D_SYS "Sys" // Sys log #define D_TEMPERATURE "Temperature" #define D_TEMPERATURE_UNIT "TempUnit" #define D_TIME "Time" #define D_TO "to" -#define D_TODAY "Today" #define D_TOGGLE "Toggle" #define D_TOPIC "Topic" -#define D_TOTAL "Total" #define D_TRANSMIT "Transmit" #define D_TRUE "True" -#define D_TYPE "Type" -#define D_UNKNOWN "Unknown" #define D_UPGRADE "upgrade" #define D_UPLOAD "Upload" #define D_UPTIME "Uptime" @@ -203,8 +191,38 @@ #define D_WEB "Web" // Web log #define D_WEB_SERVER "Web Server" #define D_WIFI "Wifi" -#define D_WRONG "Wrong" -#define D_YESTERDAY "Yesterday" + +// Text used in JSON messages +#define D_JSON_ADDRESS "Address" +#define D_JSON_AIRQUALITY "AirQuality" +#define D_JSON_ANALOG_INPUT "Analog" +#define D_JSON_CO2 "Carbon dioxide" +#define D_JSON_COUNTER "Counter" +#define D_JSON_CURRENT "Current" // As in Voltage and Current +#define D_JSON_DATA "Data" +#define D_JSON_DONE "Done" +#define D_JSON_HIGH "High" +#define D_JSON_HUMIDITY "Humidity" +#define D_JSON_ILLUMINANCE "Illuminance" +#define D_JSON_UNKNOWN "Unknown" +#define D_JSON_LIGHT "Light" +#define D_JSON_LOW "Low" +#define D_JSON_NOISE "Noise" +#define D_JSON_OR "or" +#define D_JSON_PERIOD "Period" +#define D_JSON_POWERFACTOR "Factor" +#define D_JSON_POWERUSAGE "Power" +#define D_JSON_PRESSURE "Pressure" +#define D_JSON_PRESSUREATSEALEVEL "SeaPressure" +#define D_JSON_SYNC "Sync" +#define D_JSON_TEMPERATURE "Temperature" +#define D_JSON_TODAY "Today" +#define D_JSON_TOTAL "Total" +#define D_JSON_TYPE "Type" +#define D_JSON_UV_LEVEL "UV Level" +#define D_JSON_VOLTAGE "Voltage" +#define D_JSON_WRONG "Wrong" +#define D_JSON_YESTERDAY "Yesterday" // settings.ino #define D_SAVED_TO_FLASH_AT "Saved to flash at" @@ -391,17 +409,17 @@ #define D_DOMOTICZ_UPDATE_TIMER "Update timer" // xdrv_irremote.ino -#define D_INVALID_JSON "Invalid JSON" -#define D_PROTOCOL_NOT_SUPPORTED "Protocol not supported" -#define D_IR_PROTOCOL "PROTOCOL" -#define D_IR_BITS "BITS" -#define D_IR_DATA "DATA" -#define D_IRHVAC_VENDOR "VENDOR" -#define D_IRHVAC_POWER "POWER" -#define D_IRHVAC_MODE "MODE" -#define D_IRHVAC_FANSPEED "FANSPEED" -#define D_IRHVAC_TEMP "TEMP" -#define D_IRRECEIVED "IrReceived" +#define D_JSON_INVALID_JSON "Invalid JSON" +#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocol not supported" +#define D_JSON_IR_PROTOCOL "PROTOCOL" +#define D_JSON_IR_BITS "BITS" +#define D_JSON_IR_DATA "DATA" +#define D_JSON_IRHVAC_VENDOR "VENDOR" +#define D_JSON_IRHVAC_POWER "POWER" +#define D_JSON_IRHVAC_MODE "MODE" +#define D_JSON_IRHVAC_FANSPEED "FANSPEED" +#define D_JSON_IRHVAC_TEMP "TEMP" +#define D_JSON_IRRECEIVED "IrReceived" // xdrv_snfbridge.ino #define D_RFRECEIVED "RfReceived" @@ -707,4 +725,4 @@ #define D_CMND_MAXENERGY "MaxEnergy" #define D_CMND_MAXENERGYSTART "MaxEnergyStart" -#endif // _LANGUAGE_EN_GB_H_ \ No newline at end of file +#endif // _LANGUAGE_EN_GB_H_ diff --git a/sonoff/language/it-IT.h b/sonoff/language/it-IT.h index 63c3ca0e9..c568b5c5d 100644 --- a/sonoff/language/it-IT.h +++ b/sonoff/language/it-IT.h @@ -46,10 +46,8 @@ // Common #define D_ABORTED "Aborted" #define D_ACTIVE "Active" -#define D_ADDRESS "Address" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Qualita' dell'aria" -#define D_AIRQUALITY "AirQuality" #define D_AP "AP" // Access Point #define D_APMAC_ADDRESS "APMac" #define D_APPENDED "Appended" @@ -106,7 +104,6 @@ #define D_GATEWAY "Gateway" #define D_GROUP "Gruppo" #define D_HEAPSIZE "Heap" -#define D_HIGH "High" #define D_HOST "Host" #define D_HOSTNAME "Hostname" #define D_HUMIDITY "Humidity" @@ -120,7 +117,6 @@ #define D_LIGHT "Light" #define D_LIMIT "Limit" #define D_LOCAL_TIME "Local" -#define D_LOW "Low" #define D_LWT "LWT" #define D_MAC "Mac" #define D_MASK "Mask" @@ -135,12 +131,9 @@ #define D_OK "Ok" #define D_ON "On" #define D_ONLINE "Online" -#define D_OR "or" #define D_PASSWORD "Password" -#define D_PERIOD "Period" #define D_PORT "Porta" #define D_POWER_FACTOR "Fattore di potenza" -#define D_POWERFACTOR "Factor" #define D_POWERUSAGE "Power" #define D_PRESSURE "Pressure" #define D_PRESSUREATSEALEVEL "SeaPressure" @@ -176,20 +169,15 @@ #define D_SUBSCRIBE_TO "Sottoscrivi a" #define D_SUCCESSFUL "Successful" #define D_SWITCH "Switch" -#define D_SYNC "Sync" #define D_SYS "Sys" // Sys log #define D_TEMPERATURE "Temperature" #define D_TEMPERATURE_UNIT "TempUnit" #define D_TIME "Time" #define D_TO "a" -#define D_TODAY "Today" #define D_TOGGLE "Toggle" #define D_TOPIC "Topic" -#define D_TOTAL "Total" #define D_TRANSMIT "Trasmesso" #define D_TRUE "True" -#define D_TYPE "Type" -#define D_UNKNOWN "Unknown" #define D_UPGRADE "aggiornamento" #define D_UPLOAD "Invio" #define D_UPTIME "Uptime" @@ -203,8 +191,38 @@ #define D_WEB "Web" // Web log #define D_WEB_SERVER "Web Server" #define D_WIFI "Wifi" -#define D_WRONG "Wrong" -#define D_YESTERDAY "Yesterday" + +// Text used in JSON messages +#define D_JSON_ADDRESS "Address" +#define D_JSON_AIRQUALITY "AirQuality" +#define D_JSON_ANALOG_INPUT "Analog" +#define D_JSON_CO2 "Carbon dioxide" +#define D_JSON_COUNTER "Counter" +#define D_JSON_CURRENT "Current" // As in Voltage and Current +#define D_JSON_DATA "Data" +#define D_JSON_DONE "Done" +#define D_JSON_HIGH "High" +#define D_JSON_HUMIDITY "Humidity" +#define D_JSON_ILLUMINANCE "Illuminance" +#define D_JSON_UNKNOWN "Unknown" +#define D_JSON_LIGHT "Light" +#define D_JSON_LOW "Low" +#define D_JSON_NOISE "Noise" +#define D_JSON_OR "or" +#define D_JSON_PERIOD "Period" +#define D_JSON_POWERFACTOR "Factor" +#define D_JSON_POWERUSAGE "Power" +#define D_JSON_PRESSURE "Pressure" +#define D_JSON_PRESSUREATSEALEVEL "SeaPressure" +#define D_JSON_SYNC "Sync" +#define D_JSON_TEMPERATURE "Temperature" +#define D_JSON_TODAY "Today" +#define D_JSON_TOTAL "Total" +#define D_JSON_TYPE "Type" +#define D_JSON_UV_LEVEL "UV Level" +#define D_JSON_VOLTAGE "Voltage" +#define D_JSON_WRONG "Wrong" +#define D_JSON_YESTERDAY "Yesterday" // settings.ino #define D_SAVED_TO_FLASH_AT "Salvato nella flash in" @@ -391,17 +409,17 @@ #define D_DOMOTICZ_UPDATE_TIMER "Intervallo di aggiornamento" // xdrv_irremote.ino -#define D_INVALID_JSON "JSON non valido" -#define D_PROTOCOL_NOT_SUPPORTED "Protocollo non supportato" -#define D_IR_PROTOCOL "PROTOCOL" -#define D_IR_BITS "BITS" -#define D_IR_DATA "DATA" -#define D_IRHVAC_VENDOR "VENDOR" -#define D_IRHVAC_POWER "POWER" -#define D_IRHVAC_MODE "MODE" -#define D_IRHVAC_FANSPEED "FANSPEED" -#define D_IRHVAC_TEMP "TEMP" -#define D_IRRECEIVED "IrReceived" +#define D_JSON_INVALID_JSON "JSON non valido" +#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocollo non supportato" +#define D_JSON_IR_PROTOCOL "PROTOCOL" +#define D_JSON_IR_BITS "BITS" +#define D_JSON_IR_DATA "DATA" +#define D_JSON_IRHVAC_VENDOR "VENDOR" +#define D_JSON_IRHVAC_POWER "POWER" +#define D_JSON_IRHVAC_MODE "MODE" +#define D_JSON_IRHVAC_FANSPEED "FANSPEED" +#define D_JSON_IRHVAC_TEMP "TEMP" +#define D_JSON_IRRECEIVED "IrReceived" // xdrv_snfbridge.ino #define D_RFRECEIVED "RfReceived" @@ -707,4 +725,4 @@ #define D_CMND_MAXENERGY "MaxEnergy" #define D_CMND_MAXENERGYSTART "MaxEnergyStart" -#endif // _LANGUAGE_EN_GB_H_ \ No newline at end of file +#endif // _LANGUAGE_IT_IT_H_ diff --git a/sonoff/language/nl-NL.h b/sonoff/language/nl-NL.h index a6f3b020e..df945f62f 100644 --- a/sonoff/language/nl-NL.h +++ b/sonoff/language/nl-NL.h @@ -46,10 +46,8 @@ // Common #define D_ABORTED "Afgebroken" #define D_ACTIVE "Actief" -#define D_ADDRESS "Adres" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Lucht kwalitiet" -#define D_AIRQUALITY "LuchtKwaliteit" #define D_AP "AP" // Access Point #define D_APMAC_ADDRESS "APMac" #define D_APPENDED "Aangevuld" @@ -106,7 +104,6 @@ #define D_GATEWAY "Gateway" #define D_GROUP "Groep" #define D_HEAPSIZE "Heap" -#define D_HIGH "Hoog" #define D_HOST "Host" #define D_HOSTNAME "Hostnaam" #define D_HUMIDITY "Luchtvochtigheid" @@ -117,10 +114,9 @@ #define D_INFO "Info" #define D_INITIALIZED "Geinitialiseerd" #define D_IP_ADDRESS "IP Adres" -#define D_LIGHT "Ligt" +#define D_LIGHT "Licht" #define D_LIMIT "Grenswaarde" #define D_LOCAL_TIME "Plaatselijk" -#define D_LOW "Laag" #define D_LWT "LWT" #define D_MAC "Mac" #define D_MASK "Masker" @@ -135,12 +131,9 @@ #define D_OK "Ok" #define D_ON "Ann" #define D_ONLINE "Online" -#define D_OR "of" #define D_PASSWORD "Wachtwoord" -#define D_PERIOD "Periode" #define D_PORT "Poort" #define D_POWER_FACTOR "Arbeidsfactor" -#define D_POWERFACTOR "Factor" #define D_POWERUSAGE "Vermogen" #define D_PRESSURE "Luchtdruk" #define D_PRESSUREATSEALEVEL "ZeeLuchtdruk" @@ -176,20 +169,15 @@ #define D_SUBSCRIBE_TO "Abonneer op" #define D_SUCCESSFUL "Gelukt" #define D_SWITCH "Schakelaar" -#define D_SYNC "Sync" #define D_SYS "Sys" // Sys log #define D_TEMPERATURE "Temperatuur" #define D_TEMPERATURE_UNIT "TempEenheid" #define D_TIME "Tijd" #define D_TO "naar" -#define D_TODAY "Vandaag" #define D_TOGGLE "Toggle" // Wissel, Tuimel #define D_TOPIC "Topic" // Onderwerp -#define D_TOTAL "Totaal" #define D_TRANSMIT "Verzend" #define D_TRUE "Waar" -#define D_TYPE "Soort" -#define D_UNKNOWN "Onbekend" #define D_UPGRADE "opwaarderen" #define D_UPLOAD "Verzenden" #define D_UPTIME "Bedrijfstijd" @@ -203,8 +191,38 @@ #define D_WEB "Web" // Web log #define D_WEB_SERVER "Webserver" #define D_WIFI "Wifi" -#define D_WRONG "Fout" -#define D_YESTERDAY "Gisteren" + +// Text used in JSON messages +#define D_JSON_ADDRESS "Adres" +#define D_JSON_AIRQUALITY "LuchtKwaliteit" +#define D_JSON_ANALOG_INPUT "Analoog" +#define D_JSON_CO2 "Koolstofdioxide" +#define D_JSON_COUNTER "Teller" +#define D_JSON_CURRENT "Stroom" // As in Voltage and Current +#define D_JSON_DATA "Data" +#define D_JSON_DONE "Klaar" +#define D_JSON_HIGH "Hoog" +#define D_JSON_HUMIDITY "Luchtvochtigheid" +#define D_JSON_ILLUMINANCE "Verlichtingssterkte" +#define D_JSON_UNKNOWN "Onbekend" +#define D_JSON_LIGHT "Licht" +#define D_JSON_LOW "Laag" +#define D_JSON_NOISE "Lawaai" +#define D_JSON_OR "of" +#define D_JSON_PERIOD "Periode" +#define D_JSON_POWERFACTOR "Factor" +#define D_JSON_POWERUSAGE "Vermogen" +#define D_JSON_PRESSURE "Luchtdruk" +#define D_JSON_PRESSUREATSEALEVEL "ZeeLuchtdruk" +#define D_JSON_SYNC "Sync" +#define D_JSON_TEMPERATURE "Temperatuur" +#define D_JSON_TODAY "Vandaag" +#define D_JSON_TOTAL "Totaal" +#define D_JSON_TYPE "Soort" +#define D_JSON_UV_LEVEL "UV niveau" +#define D_JSON_VOLTAGE "Spanning" +#define D_JSON_WRONG "Fout" +#define D_JSON_YESTERDAY "Gisteren" // settings.ino #define D_SAVED_TO_FLASH_AT "Opgeslagen in flash op" @@ -391,17 +409,17 @@ #define D_DOMOTICZ_UPDATE_TIMER "Bijwerk timer" // xdrv_irremote.ino -#define D_INVALID_JSON "Ongeldig JSON" -#define D_PROTOCOL_NOT_SUPPORTED "Protocol wordt niet ondersteund" -#define D_IR_PROTOCOL "PROTOCOL" -#define D_IR_BITS "BITS" -#define D_IR_DATA "DATA" -#define D_IRHVAC_VENDOR "VENDOR" -#define D_IRHVAC_POWER "POWER" -#define D_IRHVAC_MODE "MODE" -#define D_IRHVAC_FANSPEED "FANSPEED" -#define D_IRHVAC_TEMP "TEMP" -#define D_IRRECEIVED "IrReceived" +#define D_JSON_INVALID_JSON "Ongeldig JSON" +#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocol wordt niet ondersteund" +#define D_JSON_IR_PROTOCOL "PROTOCOL" +#define D_JSON_IR_BITS "BITS" +#define D_JSON_IR_DATA "DATA" +#define D_JSON_IRHVAC_VENDOR "VENDOR" +#define D_JSON_IRHVAC_POWER "POWER" +#define D_JSON_IRHVAC_MODE "MODE" +#define D_JSON_IRHVAC_FANSPEED "FANSPEED" +#define D_JSON_IRHVAC_TEMP "TEMP" +#define D_JSON_IRRECEIVED "IrReceived" // xdrv_snfbridge.ino #define D_RFRECEIVED "RfReceived" @@ -707,4 +725,4 @@ #define D_CMND_MAXENERGY "MaxEnergy" #define D_CMND_MAXENERGYSTART "MaxEnergyStart" -#endif // _LANGUAGE_NL_NL_H_ \ No newline at end of file +#endif // _LANGUAGE_NL_NL_H_ diff --git a/sonoff/language/pl-PL.h b/sonoff/language/pl-PL.h index 51281d0fd..0edf07c68 100644 --- a/sonoff/language/pl-PL.h +++ b/sonoff/language/pl-PL.h @@ -46,10 +46,8 @@ // Common #define D_ABORTED "Anulowany" #define D_ACTIVE "Aktywny" -#define D_ADDRESS "Adres" #define D_ADMIN "Admin" #define D_AIR_QUALITY "Jakosc powietrza" -#define D_AIRQUALITY "JakPowietrza" #define D_AP "AP" // Access Point #define D_APMAC_ADDRESS "APMac" #define D_APPENDED "Dolaczony" @@ -106,7 +104,6 @@ #define D_GATEWAY "Brama" #define D_GROUP "Grupa" #define D_HEAPSIZE "Stos" -#define D_HIGH "Wysoki" #define D_HOST "Serwer" #define D_HOSTNAME "Nazwa serwera" #define D_HUMIDITY "Wilgotnosc" @@ -120,7 +117,6 @@ #define D_LIGHT "Swiatlo" #define D_LIMIT "Wartość graniczna" #define D_LOCAL_TIME "Lokalny" -#define D_LOW "Niski" #define D_LWT "LWT" #define D_MAC "Mac" #define D_MASK "Maska" @@ -135,12 +131,9 @@ #define D_OK "Ok" #define D_ON "Wlaczony" #define D_ONLINE "Aktywny" -#define D_OR "lub" #define D_PASSWORD "Haslo" -#define D_PERIOD "Okres" #define D_PORT "Port" #define D_POWER_FACTOR "Wspolczynik mocy" -#define D_POWERFACTOR "WspolczynikMocy" #define D_POWERUSAGE "Moc" #define D_PRESSURE "Cisnienie" #define D_PRESSUREATSEALEVEL "Cisnienie na poziomie morza" @@ -176,20 +169,15 @@ #define D_SUBSCRIBE_TO "Subskrybuj do" #define D_SUCCESSFUL "Powodzenie" #define D_SWITCH "Przelacznik" -#define D_SYNC "Sync" #define D_SYS "System " // Sys log #define D_TEMPERATURE "Temperatura" #define D_TEMPERATURE_UNIT "JednTemp" #define D_TIME "Czas" #define D_TO "do" -#define D_TODAY "Dzisiaj" #define D_TOGGLE "Przelacz" #define D_TOPIC "Temat" -#define D_TOTAL "Suma" #define D_TRANSMIT "Wyslij" #define D_TRUE "Prawda" -#define D_TYPE "Typ" -#define D_UNKNOWN "Nieznany" #define D_UPGRADE "aktualizacji" #define D_UPLOAD "Wgraj" #define D_UPTIME "Uptime" @@ -203,8 +191,38 @@ #define D_WEB "Web" // Web log #define D_WEB_SERVER "Web Server" #define D_WIFI "Wifi" -#define D_WRONG "Bledny" -#define D_YESTERDAY "Wczoraj" + +// Text used in JSON messages +#define D_JSON_ADDRESS "Adres" +#define D_JSON_AIRQUALITY "JakPowietrza" +#define D_JSON_ANALOG_INPUT "Wej_analogowe" +#define D_JSON_CO2 "Dwutlenku węgla" +#define D_JSON_COUNTER "Licznik" +#define D_JSON_CURRENT "Biezacy" // As in Voltage and Current +#define D_JSON_DATA "Data" +#define D_JSON_DONE "Wykonane" +#define D_JSON_HIGH "Wysoki" +#define D_JSON_HUMIDITY "Wilgotnosc" +#define D_JSON_ILLUMINANCE "Oswietlenie" +#define D_JSON_UNKNOWN "Nieznany" +#define D_JSON_LIGHT "Swiatlo" +#define D_JSON_LOW "Niski" +#define D_JSON_NOISE "Halas" +#define D_JSON_OR "lub" +#define D_JSON_PERIOD "Okres" +#define D_JSON_POWERFACTOR "WspolczynikMocy" +#define D_JSON_POWERUSAGE "Moc" +#define D_JSON_PRESSURE "Cisnienie" +#define D_JSON_PRESSUREATSEALEVEL "Cisnienie na poziomie morza" +#define D_JSON_SYNC "Sync" +#define D_JSON_TEMPERATURE "Temperatura" +#define D_JSON_TODAY "Dzisiaj" +#define D_JSON_TOTAL "Suma" +#define D_JSON_TYPE "Typ" +#define D_JSON_UV_LEVEL "Poziom UV" +#define D_JSON_VOLTAGE "Napiecie" +#define D_JSON_WRONG "Bledny" +#define D_JSON_YESTERDAY "Wczoraj" // settings.ino #define D_SAVED_TO_FLASH_AT "Zapisane do pamieci flash w" @@ -391,17 +409,17 @@ #define D_DOMOTICZ_UPDATE_TIMER "Zaktualizuj czasomierz" // xdrv_irremote.ino -#define D_INVALID_JSON "Invalid JSON" -#define D_PROTOCOL_NOT_SUPPORTED "Protokol nie jest obslugiwany" -#define D_IR_PROTOCOL "PROTOCOL" -#define D_IR_BITS "BITS" -#define D_IR_DATA "DATA" -#define D_IRHVAC_VENDOR "VENDOR" -#define D_IRHVAC_POWER "POWER" -#define D_IRHVAC_MODE "MODE" -#define D_IRHVAC_FANSPEED "FANSPEED" -#define D_IRHVAC_TEMP "TEMP" -#define D_IRRECEIVED "IrReceived" +#define D_JSON_INVALID_JSON "Invalid JSON" +#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protokol nie jest obslugiwany" +#define D_JSON_IR_PROTOCOL "PROTOCOL" +#define D_JSON_IR_BITS "BITS" +#define D_JSON_IR_DATA "DATA" +#define D_JSON_IRHVAC_VENDOR "VENDOR" +#define D_JSON_IRHVAC_POWER "POWER" +#define D_JSON_IRHVAC_MODE "MODE" +#define D_JSON_IRHVAC_FANSPEED "FANSPEED" +#define D_JSON_IRHVAC_TEMP "TEMP" +#define D_JSON_IRRECEIVED "IrReceived" // xdrv_snfbridge.ino #define D_RFRECEIVED "RfReceived" @@ -707,4 +725,4 @@ #define D_CMND_MAXENERGY "MaxEnergy" #define D_CMND_MAXENERGYSTART "MaxEnergyStart" -#endif // _LANGUAGE_PL_PL_H_ \ No newline at end of file +#endif // _LANGUAGE_PL_PL_H_ diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 23afff59e..31277e155 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,8 +25,8 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x050A0005 -#define VERSION_STRING "5.10.0e" // Would be great to have a macro that fills this from VERSION ... +#define VERSION 0x050A0006 +#define VERSION_STRING "5.10.0f" // Would be great to have a macro that fills this from VERSION ... // Location specific includes #include "sonoff.h" // Enumaration used in user_config.h @@ -1480,7 +1480,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) } else if (CMND_CFGDUMP == command_code) { SettingsDump(dataBuf); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_DONE); + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } #ifdef USE_I2C else if ((CMND_I2CSCAN == command_code) && i2c_flg) { @@ -1515,7 +1515,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) if (data_len > 0) { ExceptionTest(payload); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_DONE); + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } #endif // DEBUG_THEO else { @@ -1525,7 +1525,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) if (type == NULL) { blinks = 201; snprintf_P(topicBuf, sizeof(topicBuf), PSTR(D_COMMAND)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_COMMAND "\":\"" D_UNKNOWN "\"}")); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_COMMAND "\":\"" D_JSON_UNKNOWN "\"}")); type = (char*)topicBuf; } if (mqtt_data[0] != '\0') { diff --git a/sonoff/support.ino b/sonoff/support.ino index bee00b2ca..1cbe12cd0 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -891,6 +891,7 @@ extern "C" { Ticker TickerRtc; static const uint8_t kDaysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; // API starts months from 1, this array starts from 0 +static const char kMonthNamesEnglish[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; uint32_t utc_time = 0; uint32_t local_time = 0; @@ -926,7 +927,7 @@ String GetBuildDateAndTime() year = atoi(str); } } - month = (strstr(kMonthNames, smonth) -kMonthNames) /3 +1; + month = (strstr(kMonthNamesEnglish, smonth) -kMonthNamesEnglish) /3 +1; snprintf_P(bdt, sizeof(bdt), PSTR("%d" D_YEAR_MONTH_SEPARATOR "%02d" D_MONTH_DAY_SEPARATOR "%02d" D_DATE_TIME_SEPARATOR "%s"), year, month, day, __TIME__); return String(bdt); } @@ -1317,7 +1318,7 @@ void AdcShow(boolean json) analog >>= 5; if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_ANALOG_INPUT "0\":%d"), mqtt_data, analog); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_ANALOG_INPUT "0\":%d"), mqtt_data, analog); #ifdef USE_WEBSERVER } else { snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ANALOG, mqtt_data, "", 0, analog); @@ -1337,10 +1338,6 @@ boolean Xsns02(byte function) if (pin[GPIO_ADC0] < 99) { switch (function) { -// case FUNC_INIT: -// break; -// case FUNC_PREP_BEFORE_TELEPERIOD: -// break; case FUNC_JSON_APPEND: AdcShow(1); break; diff --git a/sonoff/xdrv_irremote.ino b/sonoff/xdrv_irremote.ino index 8a54adf8b..4d9af4213 100644 --- a/sonoff/xdrv_irremote.ino +++ b/sonoff/xdrv_irremote.ino @@ -107,9 +107,9 @@ void IrReceiveCheck() if ((iridx < 0) || (iridx > 14)) { iridx = 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_IRRECEIVED "\":{\"" D_IR_PROTOCOL "\":\"%s\",\"" D_IR_BITS "\":%d,\"" D_IR_DATA "\":\"%X\"}}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_IRRECEIVED "\":{\"" D_JSON_IR_PROTOCOL "\":\"%s\",\"" D_JSON_IR_BITS "\":%d,\"" D_JSON_IR_DATA "\":\"%X\"}}"), GetTextIndexed(sirtype, sizeof(sirtype), iridx, kIrRemoteProtocols), results.bits, results.value); - MqttPublishPrefixTopic_P(6, PSTR(D_IRRECEIVED)); + MqttPublishPrefixTopic_P(6, PSTR(D_JSON_IRRECEIVED)); #ifdef USE_DOMOTICZ unsigned long value = results.value | (iridx << 28); // [Protocol:4, Data:28] DomoticzSensor(DZ_COUNT, value); // Send data as Domoticz Counter value @@ -299,13 +299,13 @@ boolean IrSendCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l StaticJsonBuffer<128> jsonBuf; JsonObject &ir_json = jsonBuf.parseObject(dataBufUc); if (!ir_json.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_INVALID_JSON "\"}")); // JSON decode failed + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_INVALID_JSON "\"}")); // JSON decode failed } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_DONE "\"}")); - protocol = ir_json[D_IR_PROTOCOL]; - bits = ir_json[D_IR_BITS]; - data = ir_json[D_IR_DATA]; + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_DONE "\"}")); + protocol = ir_json[D_JSON_IR_PROTOCOL]; + bits = ir_json[D_JSON_IR_BITS]; + data = ir_json[D_JSON_IR_DATA]; if (protocol && bits && data) { int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols); switch (protocol_code) { @@ -326,7 +326,7 @@ boolean IrSendCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l case PANASONIC: irsend->sendPanasonic(bits, data); break; default: - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_PROTOCOL_NOT_SUPPORTED "\"}")); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_PROTOCOL_NOT_SUPPORTED "\"}")); } } else { @@ -338,7 +338,7 @@ boolean IrSendCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l error = true; } if (error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_NO " " D_IR_PROTOCOL ", " D_IR_BITS " " D_OR " " D_IR_DATA "\"}")); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_NO " " D_JSON_IR_PROTOCOL ", " D_JSON_IR_BITS " " D_JSON_OR " " D_JSON_IR_DATA "\"}")); } } #ifdef USE_IR_HVAC @@ -347,15 +347,15 @@ boolean IrSendCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l StaticJsonBuffer<164> jsonBufer; JsonObject &root = jsonBufer.parseObject(dataBufUc); if (!root.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_INVALID_JSON "\"}")); // JSON decode failed + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_JSON_INVALID_JSON "\"}")); // JSON decode failed } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_DONE "\"}")); - HVAC_Vendor = root[D_IRHVAC_VENDOR]; - HVAC_Power = root[D_IRHVAC_POWER]; - HVAC_Mode = root[D_IRHVAC_MODE]; - HVAC_FanMode = root[D_IRHVAC_FANSPEED]; - HVAC_Temp = root[D_IRHVAC_TEMP]; + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_JSON_DONE "\"}")); + HVAC_Vendor = root[D_JSON_IRHVAC_VENDOR]; + HVAC_Power = root[D_JSON_IRHVAC_POWER]; + HVAC_Mode = root[D_JSON_IRHVAC_MODE]; + HVAC_FanMode = root[D_JSON_IRHVAC_FANSPEED]; + HVAC_Temp = root[D_JSON_IRHVAC_TEMP]; // snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: Received Vendor %s, Power %d, Mode %s, FanSpeed %s, Temp %d"), // HVAC_Vendor, HVAC_Power, HVAC_Mode, HVAC_FanMode, HVAC_Temp); @@ -376,7 +376,7 @@ boolean IrSendCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l error = true; } if (error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_WRONG " " D_IRHVAC_VENDOR ", " D_IRHVAC_MODE " " D_OR " " D_IRHVAC_FANSPEED "\"}")); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_JSON_WRONG " " D_JSON_IRHVAC_VENDOR ", " D_JSON_IRHVAC_MODE " " D_JSON_OR " " D_JSON_IRHVAC_FANSPEED "\"}")); } } #endif // USE_IR_HVAC diff --git a/sonoff/xdrv_light.ino b/sonoff/xdrv_light.ino index 9d79eb26c..d98c90a3c 100644 --- a/sonoff/xdrv_light.ino +++ b/sonoff/xdrv_light.ino @@ -698,7 +698,7 @@ void LightAnimate() light_new_color[i] = light_current_color[i]; } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_DONE "\"}")); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_JSON_DONE "\"}")); MqttPublishPrefixTopic_P(2, PSTR(D_CMND_WAKEUP)); light_wakeup_active = 0; Settings.light_scheme = LS_POWER; diff --git a/sonoff/xdrv_snfbridge.ino b/sonoff/xdrv_snfbridge.ino index 6c7993cd4..7c0e3cbd0 100644 --- a/sonoff/xdrv_snfbridge.ino +++ b/sonoff/xdrv_snfbridge.ino @@ -100,7 +100,7 @@ void SonoffBridgeReceived() } } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_RFRECEIVED "\":{\"" D_SYNC "\":%d,\"" D_LOW "\":%d,\"" D_HIGH "\":%d,\"" D_DATA "\":\"%06X\",\"" D_CMND_RFKEY "\":%s}}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_RFRECEIVED "\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":\"%06X\",\"" D_CMND_RFKEY "\":%s}}"), sync_time, low_time, high_time, received_id, rfkey); MqttPublishPrefixTopic_P(6, PSTR(D_RFRECEIVED)); #ifdef USE_DOMOTICZ diff --git a/sonoff/xsns_01_counter.ino b/sonoff/xsns_01_counter.ino index 316445dfb..68cc418d0 100644 --- a/sonoff/xsns_01_counter.ino +++ b/sonoff/xsns_01_counter.ino @@ -103,7 +103,7 @@ void CounterShow(boolean json) } if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_COUNTER "%d\":%s"), mqtt_data, i +1, counter); + 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) { DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]); diff --git a/sonoff/xsns_03_energy.ino b/sonoff/xsns_03_energy.ino index 4d67fb2c4..4c9277777 100644 --- a/sonoff/xsns_03_energy.ino +++ b/sonoff/xsns_03_energy.ino @@ -715,7 +715,7 @@ boolean EnergyCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_l dtostrfd((float)Settings.energy_kWhyesterday / 100000000, Settings.flag2.energy_resolution, energy_yesterday_chr); dtostrfd((float)RtcSettings.energy_kWhtoday / 100000000, Settings.flag2.energy_resolution, stoday_energy); dtostrfd((float)(RtcSettings.energy_kWhtotal + (energy_kWhtoday / 1000)) / 100000, Settings.flag2.energy_resolution, energy_total_chr); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"" D_TOTAL "\":%s,\"" D_YESTERDAY "\":%s,\"" D_TODAY "\":%s}}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"), command, energy_total_chr, energy_yesterday_chr, stoday_energy); status_flag = 1; } @@ -903,8 +903,8 @@ void EnergyShow(boolean json) dtostrfd((float)Settings.energy_kWhyesterday / 100000000, Settings.flag2.energy_resolution, energy_yesterday_chr); if (json) { - snprintf_P(speriod, sizeof(speriod), PSTR(",\"" D_PERIOD "\":%s"), energy_period_chr); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_TOTAL "\":%s,\"" D_YESTERDAY "\":%s,\"" D_TODAY "\":%s%s,\"" D_POWERUSAGE "\":%s,\"" D_POWERFACTOR "\":%s,\"" D_VOLTAGE "\":%s,\"" D_CURRENT "\":%s}"), + snprintf_P(speriod, sizeof(speriod), PSTR(",\"" D_JSON_PERIOD "\":%s"), energy_period_chr); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s%s,\"" D_JSON_POWERUSAGE "\":%s,\"" D_JSON_POWERFACTOR "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), mqtt_data, energy_total_chr, energy_yesterday_chr, energy_daily_chr, (show_energy_period) ? speriod : "", energy_power_chr, energy_power_factor_chr, energy_voltage_chr, energy_current_chr); #ifdef USE_DOMOTICZ if (show_energy_period) { // Only send if telemetry diff --git a/sonoff/xsns_04_snfsc.ino b/sonoff/xsns_04_snfsc.ino index f6e44eae5..67ee2d5ba 100644 --- a/sonoff/xsns_04_snfsc.ino +++ b/sonoff/xsns_04_snfsc.ino @@ -120,7 +120,7 @@ void SonoffScShow(boolean json) dtostrfd(h, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_TEMPERATURE "\":%s,\"" D_HUMIDITY "\":%s,\"" D_LIGHT "\":%d,\"" D_NOISE "\":%d,\"" D_AIRQUALITY "\":%d"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" 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); diff --git a/sonoff/xsns_05_ds18b20.ino b/sonoff/xsns_05_ds18b20.ino index 4a4220831..ece24dd2b 100644 --- a/sonoff/xsns_05_ds18b20.ino +++ b/sonoff/xsns_05_ds18b20.ino @@ -195,7 +195,7 @@ void Ds18b20Show(boolean json) dtostrfi(t, Settings.flag2.temperature_resolution, temperature); if(json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18B20\":{\"" D_TEMPERATURE "\":%s}"), mqtt_data, temperature); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18B20\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, temperature); #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino index c8ed8be59..9825e36c8 100644 --- a/sonoff/xsns_05_ds18x20.ino +++ b/sonoff/xsns_05_ds18x20.ino @@ -366,13 +366,13 @@ void Ds18x20Show(boolean json) snprintf_P(stemp, sizeof(stemp), PSTR("%s-%d"), ds18x20_types, i +1); if (json) { if (1 == ds18x20_sensors) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_TEMPERATURE "\":%s}"), mqtt_data, ds18x20_types, temperature); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, ds18x20_types, temperature); } else { char address[17]; for (byte j = 0; j < 6; j++) { sprintf(address+2*j, "%02X", ds18x20_address[ds18x20_index[i]][6-j]); // Skip sensor type and crc } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_ID "\":\"%s\",\"" D_TEMPERATURE "\":%s}"), mqtt_data, stemp, address, temperature); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, stemp, address, temperature); } #ifdef USE_DOMOTICZ if (domoticz_flag) { diff --git a/sonoff/xsns_05_ds18x20_legacy.ino b/sonoff/xsns_05_ds18x20_legacy.ino index 881337656..cf083d766 100644 --- a/sonoff/xsns_05_ds18x20_legacy.ino +++ b/sonoff/xsns_05_ds18x20_legacy.ino @@ -179,7 +179,7 @@ void Ds18x20Show(boolean json) stemp[0] = '\0'; } dsxflg++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"DS%d\":{\"" D_TYPE "\":\"%s\",\"" D_ADDRESS "\":\"%s\",\"" D_TEMPERATURE "\":%s}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"DS%d\":{\"" D_JSON_TYPE "\":\"%s\",\"" D_JSON_ADDRESS "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, stemp, i +1, ds18x20_types, Ds18x20Addresses(i).c_str(), temperature); strcpy(stemp, ","); #ifdef USE_DOMOTICZ diff --git a/sonoff/xsns_09_bmp.ino b/sonoff/xsns_09_bmp.ino index 0653d0c0d..77143b94b 100644 --- a/sonoff/xsns_09_bmp.ino +++ b/sonoff/xsns_09_bmp.ino @@ -455,16 +455,16 @@ void BmpShow(boolean json) if (json) { char json_humidity[40]; - snprintf_P(json_humidity, sizeof(json_humidity), PSTR(",\"" D_HUMIDITY "\":%s"), humidity); + snprintf_P(json_humidity, sizeof(json_humidity), PSTR(",\"" D_JSON_HUMIDITY "\":%s"), humidity); char json_sealevel[40]; - snprintf_P(json_sealevel, sizeof(json_sealevel), PSTR(",\"" D_PRESSUREATSEALEVEL "\":%s"), sea_pressure); + snprintf_P(json_sealevel, sizeof(json_sealevel), PSTR(",\"" D_JSON_PRESSUREATSEALEVEL "\":%s"), sea_pressure); #ifdef USE_BME680 char json_gas[40]; snprintf_P(json_gas, sizeof(json_gas), PSTR(",\"" D_GAS "\":%s"), gas_resistance); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_TEMPERATURE "\":%s%s,\"" D_PRESSURE "\":%s%s%s}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s%s}"), mqtt_data, bmp_name, temperature, (bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : "", (bmp_model >= 3) ? json_gas : ""); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_TEMPERATURE "\":%s%s,\"" D_PRESSURE "\":%s%s}"), + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s}"), mqtt_data, bmp_name, temperature, (bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : ""); #endif // USE_BME680 #ifdef USE_DOMOTICZ diff --git a/sonoff/xsns_10_bh1750.ino b/sonoff/xsns_10_bh1750.ino index fc05673d0..f39833fc4 100644 --- a/sonoff/xsns_10_bh1750.ino +++ b/sonoff/xsns_10_bh1750.ino @@ -75,7 +75,7 @@ void Bh1750Show(boolean json) uint16_t illuminance = Bh1750ReadLux(); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"BH1750\":{\"" D_ILLUMINANCE "\":%d}"), mqtt_data, illuminance); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"BH1750\":{\"" D_JSON_ILLUMINANCE "\":%d}"), mqtt_data, illuminance); #ifdef USE_DOMOTICZ DomoticzSensor(DZ_ILLUMINANCE, illuminance); #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_11_veml6070.ino b/sonoff/xsns_11_veml6070.ino index 6b27de71e..aa5dba112 100644 --- a/sonoff/xsns_11_veml6070.ino +++ b/sonoff/xsns_11_veml6070.ino @@ -80,7 +80,7 @@ void Veml6070Show(boolean json) uint16_t uvlevel = Veml6070ReadUv(); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"VEML6070\":{\"" D_UV_LEVEL "\":%d}"), mqtt_data, uvlevel); + 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); #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_12_ads1115.ino b/sonoff/xsns_12_ads1115.ino index 4c2e7f976..19c3ccf8a 100644 --- a/sonoff/xsns_12_ads1115.ino +++ b/sonoff/xsns_12_ads1115.ino @@ -190,7 +190,7 @@ void Ads1115Show(boolean json) stemp[0] = '\0'; } dsxflg++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_JSON_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value); strcpy(stemp, ","); #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_12_ads1115_i2cdev.ino b/sonoff/xsns_12_ads1115_i2cdev.ino index d9735327a..692040743 100644 --- a/sonoff/xsns_12_ads1115_i2cdev.ino +++ b/sonoff/xsns_12_ads1115_i2cdev.ino @@ -110,7 +110,7 @@ void Ads1115Show(boolean json) stemp[0] = '\0'; } dsxflg++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_JSON_ANALOG_INPUT "%d\":%d"), mqtt_data, stemp, i, adc_value); strcpy(stemp, ","); #ifdef USE_WEBSERVER } else { diff --git a/sonoff/xsns_13_ina219.ino b/sonoff/xsns_13_ina219.ino index 211021d9e..6ee99ed13 100644 --- a/sonoff/xsns_13_ina219.ino +++ b/sonoff/xsns_13_ina219.ino @@ -193,7 +193,7 @@ void Ina219Show(boolean json) dtostrfd(fcurrent, Settings.flag2.current_resolution, current); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"INA219\":{\"" D_VOLTAGE "\":%s,\"" D_CURRENT "\":%s,\"" D_POWERUSAGE "\":%s}"), + 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); diff --git a/sonoff/xsns_15_mhz19.ino b/sonoff/xsns_15_mhz19.ino index 859f19c56..32bf247dd 100644 --- a/sonoff/xsns_15_mhz19.ino +++ b/sonoff/xsns_15_mhz19.ino @@ -227,7 +227,7 @@ void MhzShow(boolean json) GetTextIndexed(mhz_types, sizeof(mhz_types), mhz_type -1, kMhzTypes); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_CO2 "\":%d,\"" D_TEMPERATURE "\":%s}"), mqtt_data, mhz_types, mhz_last_ppm, temperature); + 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); #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino index cbddb7e8e..a50c16804 100644 --- a/sonoff/xsns_16_tsl2561.ino +++ b/sonoff/xsns_16_tsl2561.ino @@ -67,7 +67,7 @@ void Tsl2561Show(boolean json) uint16_t illuminance = tsl->getLuminosity(TSL2561_VISIBLE); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TSL2561\":{\"" D_ILLUMINANCE "\":%d}"), mqtt_data, illuminance); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%d}"), mqtt_data, illuminance); #ifdef USE_DOMOTICZ DomoticzSensor(DZ_ILLUMINANCE, illuminance); #endif // USE_DOMOTICZ diff --git a/sonoff/xsns_17_senseair.ino b/sonoff/xsns_17_senseair.ino index 6b23a5a69..fb90e1e1f 100644 --- a/sonoff/xsns_17_senseair.ino +++ b/sonoff/xsns_17_senseair.ino @@ -203,9 +203,9 @@ void SenseairShow(boolean json) GetTextIndexed(senseair_types, sizeof(senseair_types), senseair_type -1, kSenseairTypes); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_CO2 "\":%d"), mqtt_data, senseair_types, senseair_co2); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d"), mqtt_data, senseair_types, senseair_co2); if (senseair_type != 2) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_TEMPERATURE "\":%s,\"" D_HUMIDITY "\":%s"), mqtt_data, temperature, humidity); + snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s"), mqtt_data, temperature, humidity); } snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); #ifdef USE_DOMOTICZ From 85d75ffc952b7f5a9681a09f3ddb908df4d15e5f Mon Sep 17 00:00:00 2001 From: arendst Date: Fri, 29 Dec 2017 14:55:39 +0100 Subject: [PATCH 2/3] Add WS2812 scheme define (#1463) * Add define for additional number of WS2812 schemes (#1463) --- sonoff/_releasenotes.ino | 1 + sonoff/xdrv_light.ino | 6 ++++-- sonoff/xdrv_ws2812.ino | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 45cc45518..4824ab3de 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,6 +1,7 @@ /* 5.10.0f * Differentiate between JSON text defines and other text defines to allow for English JSON while using different locale (#1449) * Fix display of build date and time in non-english locale (#1465) + * Add define for additional number of WS2812 schemes (#1463) * * 5.10.0e * Add Italian language file (#1449) diff --git a/sonoff/xdrv_light.ino b/sonoff/xdrv_light.ino index d98c90a3c..a3a554890 100644 --- a/sonoff/xdrv_light.ino +++ b/sonoff/xdrv_light.ino @@ -51,6 +51,8 @@ * \*********************************************************************************************/ +#define WS2812_SCHEMES 7 // Number of additional WS2812 schemes supported by xdrv_ws2812.ino + enum LightCommands { CMND_COLOR, CMND_COLORTEMPERATURE, CMND_DIMMER, CMND_LED, CMND_LEDTABLE, CMND_FADE, CMND_PIXELS, CMND_SCHEME, CMND_SPEED, CMND_WAKEUP, CMND_WAKEUPDURATION, CMND_WIDTH, CMND_UNDOCA }; @@ -377,7 +379,7 @@ void LightInit(void) light_subtype++; // from RGB to RGBW #endif Ws2812Init(); - max_scheme = LS_MAX +7; + max_scheme = LS_MAX + WS2812_SCHEMES; } #endif // USE_WS2812 ************************************************************************ else { @@ -1069,7 +1071,7 @@ boolean LightCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_le } #endif // USE_WS2812 ************************************************************************ else if ((CMND_SCHEME == command_code) && (light_subtype >= LST_RGB)) { - uint8_t max_scheme = (LT_WS2812 == light_type) ? LS_MAX +7 : LS_MAX -1; + uint8_t max_scheme = (LT_WS2812 == light_type) ? LS_MAX + WS2812_SCHEMES : LS_MAX -1; if (('+' == option) && (Settings.light_scheme < max_scheme)) { payload = Settings.light_scheme + ((0 == Settings.light_scheme) ? 2 : 1); // Skip wakeup } diff --git a/sonoff/xdrv_ws2812.ino b/sonoff/xdrv_ws2812.ino index 2aea22054..9f76c9b9c 100644 --- a/sonoff/xdrv_ws2812.ino +++ b/sonoff/xdrv_ws2812.ino @@ -62,7 +62,7 @@ WsColor kHanukkah[2] = { 0,0,255, 255,255,255 }; WsColor kwanzaa[3] = { 255,0,0, 0,0,0, 0,255,0 }; WsColor kRainbow[7] = { 255,0,0, 255,128,0, 255,255,0, 0,255,0, 0,0,255, 128,0,255, 255,0,255 }; WsColor kFire[3] = { 255,0,0, 255,102,0, 255,192,0 }; -ColorScheme kSchemes[7] = { +ColorScheme kSchemes[WS2812_SCHEMES] = { kIncandescent, 2, kRgb, 3, kChristmas, 2, From 24a69607492298be256ff00719ad3377d0d0a8fe Mon Sep 17 00:00:00 2001 From: arendst Date: Sat, 30 Dec 2017 12:47:19 +0100 Subject: [PATCH 3/3] v5.10.0g - Alexa 2nd Gen support 5.10.0g * Add 2nd Gen Alexa support to Wemo emulation discovery (#1357, #1450) --- README.md | 2 +- sonoff/_releasenotes.ino | 5 +- sonoff/sonoff.ino | 4 +- sonoff/xdrv_wemohue.ino | 104 +++++++-------------------------------- 4 files changed, 25 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index e15875409..74dedf6ae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **5.10.0f** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.10.0g** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 4824ab3de..f8bde43a0 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,7 @@ -/* 5.10.0f +/* 5.10.0g + * Add 2nd Gen Alexa support to Wemo emulation discovery (#1357, #1450) + * + * 5.10.0f * Differentiate between JSON text defines and other text defines to allow for English JSON while using different locale (#1449) * Fix display of build date and time in non-english locale (#1465) * Add define for additional number of WS2812 schemes (#1463) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 31277e155..bfefb52cf 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,8 +25,8 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x050A0006 -#define VERSION_STRING "5.10.0f" // Would be great to have a macro that fills this from VERSION ... +#define VERSION 0x050A0007 +#define VERSION_STRING "5.10.0g" // Would be great to have a macro that fills this from VERSION ... // Location specific includes #include "sonoff.h" // Enumaration used in user_config.h diff --git a/sonoff/xdrv_wemohue.ino b/sonoff/xdrv_wemohue.ino index 2bd7c3100..907ee3c95 100755 --- a/sonoff/xdrv_wemohue.ino +++ b/sonoff/xdrv_wemohue.ino @@ -220,14 +220,18 @@ void PollUdp() // AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: M-SEARCH Packet received")); // AddLog_P(LOG_LEVEL_DEBUG_MORE, request.c_str()); - if ((EMUL_WEMO == Settings.flag2.emulation) && (request.indexOf(F("urn:belkin:device:**")) > 0)) { + if ((EMUL_WEMO == Settings.flag2.emulation) && + ((request.indexOf(F("urn:belkin:device:**")) > 0) || + (request.indexOf(F("upnp:rootdevice")) > 0) || // Needed by 2nd generation Echo + (request.indexOf(F("ssdpsearch:all")) > 0) || + (request.indexOf(F("ssdp:all")) > 0))) { WemoRespondToMSearch(); } else if ((EMUL_HUE == Settings.flag2.emulation) && - ((request.indexOf(F("st:urn:schemas-upnp-org:device:basic:1")) > 0) || - (request.indexOf(F("st:upnp:rootdevice")) > 0) || - (request.indexOf(F("st:ssdpsearch:all")) > 0) || - (request.indexOf(F("st:ssdp:all")) > 0))) { + ((request.indexOf(F("urn:schemas-upnp-org:device:basic:1")) > 0) || + (request.indexOf(F("upnp:rootdevice")) > 0) || + (request.indexOf(F("ssdpsearch:all")) > 0) || + (request.indexOf(F("ssdp:all")) > 0))) { HueRespondToMSearch(); } } @@ -241,48 +245,13 @@ void PollUdp() \*********************************************************************************************/ const char WEMO_EVENTSERVICE_XML[] PROGMEM = -/* - // Original - "" - "" - "" - "SetBinaryState" - "" - "" - "" - "BinaryState" - "BinaryState" - "in" - "" - "" - "" - "" - "BinaryState" - "Boolean" - "0" - "" - "" - "level" - "string" - "0" - "" - "" - "" - "\r\n" - "\r\n"; -*/ - -/* - // XosePerez version 20171108 - v2.3.0 - "" "" - "10" "" "" "SetBinaryState" "" "" - "" + "" "BinaryState" "BinaryState" "in" @@ -307,48 +276,12 @@ const char WEMO_EVENTSERVICE_XML[] PROGMEM = "Boolean" "0" "" + "" + "level" + "string" + "0" + "" "" - ""; -*/ - - // Reloxx13 from #1357 - "" - "" - "" - "SetBinaryState" - "" - "" - "" - "BinaryState" - "BinaryState" - "in" - "" - "" - "" - "" - "BinaryState" - "Boolean" - "0" - "" - "" - "level" - "string" - "0" - "" - "" - "" - "" - "GetBinaryState" - "" - "" - "" - "BinaryState" - "BinaryState" - "out" - "" - "" - "" - "" "\r\n" "\r\n"; @@ -360,8 +293,7 @@ const char WEMO_RESPONSE_STATE_SOAP[] PROGMEM = "{x1" "" "" - "\r\n" - "\r\n"; + "\r\n"; const char WEMO_SETUP_XML[] PROGMEM = "" @@ -370,7 +302,7 @@ const char WEMO_SETUP_XML[] PROGMEM = "urn:Belkin:device:controllee:1" "{x1" "Belkin International Inc." - "Sonoff Socket" + "Socket" "3.1415" "uuid:{x2" "{x3" @@ -385,7 +317,7 @@ const char WEMO_SETUP_XML[] PROGMEM = "" "" "" - ""; + "\r\n"; /********************************************************************************************/