From 0243e2be7e8b96214dcc7a285550d5e276952afd Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 8 Jul 2019 14:16:33 +0200 Subject: [PATCH] Add command SetOption42 0..255 to set over temperature in Celsius. Defaults to 90 Add command SetOption42 0..255 to set over temperature in Celsius. Defaults to 90 (#6036) --- sonoff/_changelog.ino | 7 +++++-- sonoff/settings.ino | 3 +++ sonoff/sonoff.h | 4 +++- sonoff/sonoff_post.h | 4 ++++ sonoff/sonoff_version.h | 2 +- sonoff/xdrv_03_energy.ino | 3 +-- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index fb05b3545..0616140bd 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,9 @@ /*********************************************************************************************\ - * 6.6.0.1 20190707 - * Add blend RGB leds with White leds for better whites #5895 #5704 + * 6.6.0.1 20190708 + * Add blend RGB leds with White leds for better whites (#5895, #5704) + * Add command SetOption41 0..8 to control number of Tuya switches (#6039) + * Add command SetOption42 0..255 to set overtemperature (Celsius only) threshold resulting in power off all on energy monitoring devices. Default setting is 90 (#6036) + * Fix Domoticz battery level set to 100 if define USE_ADC_VCC is not used (#6033) * * 6.6.0 20190707 * Remove support of TLS on core 2.3.0 and extent support on core 2.4.2 and up diff --git a/sonoff/settings.ino b/sonoff/settings.ino index eae6d3817..08448ce79 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -1186,6 +1186,9 @@ void SettingsDelta(void) if (Settings.version < 0x0605000D) { Settings.param[P_IR_UNKNOW_THRESHOLD] = IR_RCV_MIN_UNKNOWN_SIZE; } + if (Settings.version < 0x06060001) { + Settings.param[P_OVER_TEMP] = ENERGY_OVERTEMP; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 7ecebaa79..f739f84df 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -230,7 +230,9 @@ enum ButtonStates { PRESSED, NOT_PRESSED }; enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER }; -enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, P_CSE7766_INVALID_POWER, P_HOLD_IGNORE, P_TUYA_RELAYS, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 +enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, // SetOption32 .. SetOption38 + P_CSE7766_INVALID_POWER, P_HOLD_IGNORE, P_TUYA_RELAYS, P_OVER_TEMP, // SetOption39 .. SetOption42 + P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 enum DomoticzSensors {DZ_TEMP, DZ_TEMP_HUM, DZ_TEMP_HUM_BARO, DZ_POWER_ENERGY, DZ_ILLUMINANCE, DZ_COUNT, DZ_VOLTAGE, DZ_CURRENT, DZ_AIRQUALITY, DZ_MAX_SENSORS}; diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 1f25c308a..3be46fb59 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -46,6 +46,10 @@ void KNX_CB_Action(message_t const &msg, void *arg); * Default global defines \*********************************************************************************************/ +#ifndef ENERGY_OVERTEMP +#define ENERGY_OVERTEMP 90 // Overtemp in Celsius +#endif + #ifdef USE_EMULATION_HUE #define USE_EMULATION #endif diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 32c1e92e6..0a9aa8dc3 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,6 +20,6 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -const uint32_t VERSION = 0x06060000; +const uint32_t VERSION = 0x06060001; #endif // _SONOFF_VERSION_H_ diff --git a/sonoff/xdrv_03_energy.ino b/sonoff/xdrv_03_energy.ino index 52585a632..b9c58e127 100644 --- a/sonoff/xdrv_03_energy.ino +++ b/sonoff/xdrv_03_energy.ino @@ -27,7 +27,6 @@ #define ENERGY_NONE 0 -#define ENERGY_OVERTEMP 73.0 // Industry standard lowest overtemp in Celsius #define ENERGY_WATCHDOG 4 // Allow up to 4 seconds before deciding no valid data present #define FEATURE_POWER_LIMIT true @@ -325,7 +324,7 @@ void EnergyMqttShow(void) void EnergyOverTempCheck() { if (global_update) { - if (power && (global_temperature != 9999) && (global_temperature > ENERGY_OVERTEMP)) { // Device overtemp, turn off relays + if (power && (global_temperature != 9999) && (global_temperature > Settings.param[P_OVER_TEMP])) { // Device overtemp, turn off relays SetAllPower(POWER_ALL_OFF, SRC_OVERTEMP); } }