diff --git a/tasmota/i18n.h b/tasmota/i18n.h index eb1130405fc4..26e2df78438b 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -304,6 +304,7 @@ #define D_JSON_FLAG "FLAG" #define D_JSON_BASE "BASE" #define D_CMND_TEMPOFFSET "TempOffset" +#define D_CMND_HUMOFFSET "HumOffset" // Commands xdrv_01_mqtt.ino #define D_CMND_MQTTLOG "MqttLog" diff --git a/tasmota/settings.h b/tasmota/settings.h index 673758890985..737ce8a829b9 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -467,8 +467,9 @@ struct SYSCFG { uint8_t bri_min; // F05 uint8_t bri_preset_low; // F06 uint8_t bri_preset_high; // F07 + int8_t hum_comp; // F08 - uint8_t free_f08[180]; // F08 + uint8_t free_f09[179]; // F09 uint32_t keeloq_master_msb; // FBC uint32_t keeloq_master_lsb; // FC0 diff --git a/tasmota/support.ino b/tasmota/support.ino index 984b4312f73b..6ad941d31af4 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -617,10 +617,14 @@ char TempUnit(void) float ConvertHumidity(float h) { + float result = h; + global_update = uptime; global_humidity = h; + + result = result + (0.1 * Settings.hum_comp); - return h; + return result; } float CalcTempHumToDew(float t, float h) diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 7915ea7a9d80..67ec47463877 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -26,7 +26,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix D_CMND_BUTTONDEBOUNCE "|" D_CMND_SWITCHDEBOUNCE "|" D_CMND_SYSLOG "|" D_CMND_LOGHOST "|" D_CMND_LOGPORT "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALCONFIG "|" D_CMND_SERIALDELIMITER "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|" D_CMND_WIFICONFIG "|" D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|" D_CMND_INTERLOCK "|" D_CMND_TELEPERIOD "|" D_CMND_RESET "|" D_CMND_TIME "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" - D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|" D_CMND_LEDMASK "|" D_CMND_WIFIPOWER "|" D_CMND_TEMPOFFSET "|" + D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|" D_CMND_LEDMASK "|" D_CMND_WIFIPOWER "|" D_CMND_TEMPOFFSET "|" D_CMND_HUMOFFSET "|" D_CMND_SPEEDUNIT "|" #ifdef USE_I2C D_CMND_I2CSCAN "|" D_CMND_I2CDRIVER "|" @@ -45,7 +45,7 @@ void (* const TasmotaCommand[])(void) PROGMEM = { &CmndButtonDebounce, &CmndSwitchDebounce, &CmndSyslog, &CmndLoghost, &CmndLogport, &CmndSerialSend, &CmndBaudrate, &CmndSerialConfig, &CmndSerialDelimiter, &CmndIpAddress, &CmndNtpServer, &CmndAp, &CmndSsid, &CmndPassword, &CmndHostname, &CmndWifiConfig, &CmndFriendlyname, &CmndSwitchMode, &CmndInterlock, &CmndTeleperiod, &CmndReset, &CmndTime, &CmndTimezone, &CmndTimeStd, - &CmndTimeDst, &CmndAltitude, &CmndLedPower, &CmndLedState, &CmndLedMask, &CmndWifiPower, &CmndTempOffset, + &CmndTimeDst, &CmndAltitude, &CmndLedPower, &CmndLedState, &CmndLedMask, &CmndWifiPower, &CmndTempOffset, &CmndHumOffset, &CmndSpeedUnit, #ifdef USE_I2C &CmndI2cScan, CmndI2cDriver, @@ -538,6 +538,17 @@ void CmndTempOffset(void) ResponseCmndFloat((float)(Settings.temp_comp) / 10, 1); } +void CmndHumOffset(void) +{ + if (XdrvMailbox.data_len > 0) { + int value = (int)(CharToFloat(XdrvMailbox.data) * 10); + if ((value > -101) && (value < 101)) { + Settings.hum_comp = value; + } + } + ResponseCmndFloat((float)(Settings.hum_comp) / 10, 1); +} + void CmndSleep(void) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 251)) {