Heating controller added. Created by myself initially in LUA running as a Domoticz (running on a raspberry pi) script and controlling Qubino relays for floor heating. Ported to tasmota to get the logic within the relay itself and be less dependent on Domoticz.

The controller supports several working modes. From off (no action) to manual (following input), automatic (hybrid, rampup or pi controller) and timeplan (automatic following predefined schedule with 3 temperatures for each weekday). It is fully configured via commands, it will include in the future diagnostics and will be extended to more outputs (will be tested on sonoff 4CH Pro).

The controller has been tested successfully with a Shelly 1PM device and works as the original LUA domoticz script.
This commit is contained in:
Javier Arigita 2020-04-17 10:31:53 +02:00
parent bb54c870f7
commit 31d0268df4
6 changed files with 127 additions and 4 deletions

View File

@ -577,6 +577,40 @@
#define D_CMND_PING "Ping"
#define D_JSON_PING "Ping"
// Commands xdrv_90_heating.ino
#define D_CMND_HEATINGMODESET "HeatingModeSet"
#define D_CMND_TEMPFROSTPROTECTSET "TempFrostProtectSet"
#define D_CMND_CONTROLLERMODESET "ControllerModeSet"
#define D_CMND_INPUTSWITCHSET "InputSwitchSet"
#define D_CMND_OUTPUTRELAYSET "OutputRelaySet"
#define D_CMND_TIMEALLOWRAMPUPSET "TimeAllowRampupSet"
#define D_CMND_TEMPMEASUREDSET "TempMeasuredSet"
#define D_CMND_TEMPTARGETSET "TempTargetSet"
#define D_CMND_TIMEPLANSET "TimePlanSet"
#define D_CMND_TEMPTARGETREAD "TempTargetRead"
#define D_CMND_TEMPMEASUREDREAD "TempMeasuredRead"
#define D_CMND_TEMPMEASUREDGRDREAD "TempMeasuredGrdRead"
#define D_CMND_TEMPSENSNUMBERSET "TempSensNumberSet"
#define D_CMND_STATEEMERGENCYSET "StateEmergencySet"
#define D_CMND_POWERMAXSET "PowerMaxSet"
#define D_CMND_TIMEMANUALTOAUTOSET "TimeManualToAutoSet"
#define D_CMND_TIMEONLIMITSET "TimeOnLimitSet"
#define D_CMND_PROPBANDSET "PropBandSet"
#define D_CMND_TIMERESETSET "TimeResetSet"
#define D_CMND_TIMEPICYCLESET "TimePiCycleSet"
#define D_CMND_TEMPANTIWINDUPRESETSET "TempAntiWindupResetSet"
#define D_CMND_TEMPHYSTSET "TempHystSet"
#define D_CMND_TIMEMAXACTIONSET "TimeMaxActionSet"
#define D_CMND_TIMEMINACTIONSET "TimeMinActionSet"
#define D_CMND_TIMEMINTURNOFFACTIONSET "TimeMinTurnoffActionSet"
#define D_CMND_TEMPRUPDELTINSET "TempRupDeltInSet"
#define D_CMND_TEMPRUPDELTOUTSET "TempRupDeltOutSet"
#define D_CMND_TIMERAMPUPMAXSET "TimeRampupMaxSet"
#define D_CMND_TIMERAMPUPCYCLESET "TimeRampupCycleSet"
#define D_CMND_TEMPRAMPUPPIACCERRSET "TempRampupPiAccErrSet"
#define D_CMND_TIMEPIPROPORTREAD "TimePiProportRead"
#define D_CMND_TIMEPIINTEGRREAD "TimePiIntegrRead"
// Commands xsns_02_analog.ino
#define D_CMND_ADCPARAM "AdcParam"

View File

@ -656,6 +656,38 @@
#define USE_TASMOTA_SLAVE_FLASH_SPEED 57600 // Usually 57600 for 3.3V variants and 115200 for 5V variants
#define USE_TASMOTA_SLAVE_SERIAL_SPEED 57600 // Depends on the sketch that is running on the Uno/Pro Mini
/*********************************************************************************************\
* HEATING CONTROLLER
\*********************************************************************************************/
#define USE_HEATING
#define HEATING_RELAY_NUMBER 1 // Default output relay number
#define HEATING_SWITCH_NUMBER 1 // Default input switch number
#define HEATING_TIME_ALLOW_RAMPUP 18000 // Default time in seconds after last target update to allow ramp-up controller phase
#define HEATING_TIME_RAMPUP_MAX 57600 // Default time maximum ramp-up controller duration
#define HEATING_TIME_RAMPUP_CYCLE 1800 // Default time ramp-up cycle
#define HEAT_TIME_SENS_LOST 1800 // Default target temperature in seconds
#define HEAT_TEMP_SENS_NUMBER 1 // Default temperature sensor number
#define HEAT_STATE_EMERGENCY false // Default state for heating emergency
#define HEAT_POWER_MAX 60 // Default maximum output power in Watt
#define HEAT_TIME_MANUAL_TO_AUTO 3600 // Default time without input switch active to change from manual to automatic in seconds
#define HEAT_TIME_ON_LIMIT 7200 // Default maximum time with output active in seconds
#define HEAT_TIME_RESET 12000 // Default reset time of the PI controller in seconds
#define HEAT_TIME_PI_CYCLE 1800 // Default cycle time for the heating controller in seconds
#define HEAT_TIME_MAX_ACTION 1200 // Default maximum heating time per cycle in seconds
#define HEAT_TIME_MIN_ACTION 240 // Default minimum heating time per cycle in seconds
#define HEAT_TIME_MIN_TURNOFF_ACTION 180 // Default minimum turnoff time in seconds, below it the heating will be held on
#define HEAT_PROP_BAND 4 // Default proportional band of the PI controller in degrees celsius
#define HEAT_TEMP_RESET_ANTI_WINDUP 8 // Default range where reset antiwindup is disabled, in tenths of degrees celsius
#define HEAT_TEMP_HYSTERESIS 1 // Default range hysteresis for temperature PI controller, in tenths of degrees celsius
#define HEAT_TEMP_FROST_PROTECT 40 // Default minimum temperature for frost protection, in tenths of degrees celsius
#define HEATING_TEMP_RAMPUP_DELTA_IN 4 // Default minimum delta temperature to target to get into rampup mode, in tenths of degrees celsius
#define HEATING_TEMP_RAMPUP_DELTA_OUT 2 // Default minimum delta temperature to target to get out of the rampup mode, in tenths of degrees celsius
#define HEATING_TEMP_PI_RAMPUP_ACC_E 20 // Default accumulated error when switching from ramp-up controller to PI
#define HEATING_ENERGY_OUTPUT_MAX 10 // Default maximum allowed energy output for heating valve in Watts
#define HEATING_TIME_OUTPUT_DELAY 180 // Default output delay between state change and real actuation event (f.i. valve open/closed)
// -- End of general directives -------------------
/*********************************************************************************************\

View File

@ -516,6 +516,7 @@ struct SYSCFG {
uint8_t wifi_bssid[6]; // F0A
uint8_t as3935_sensor_cfg[5]; // F10
As3935IntCfg as3935_functions; // F15
//uint8_t free_f35;
As3935Param as3935_parameter; // F16
uint64_t zb_ext_panid; // F18
uint64_t zb_precfgkey_l; // F20
@ -525,11 +526,38 @@ struct SYSCFG {
uint8_t zb_free_byte; // F33
uint16_t pms_wake_interval; // F34
uint8_t free_f36[130]; // F36 - Decrement if adding new Setting variables just above and below
uint8_t free_f36[70]; // F36 - Decrement if adding new Setting variables just above and below
// Only 32 bit boundary variables below
uint8_t time_output_delay; // F7C
uint8_t temp_rampup_pi_acc_error; // F7D
uint8_t temp_rampup_delta_out; // F7E
uint8_t temp_rampup_delta_in; // F7F
uint32_t time_rampup_max; // F80
uint32_t time_rampup_cycle; // F84
uint32_t time_allow_rampup; // F88
uint32_t time_sens_lost; // F8C
uint8_t temp_sens_number; // F90
bool state_emergency; // F91
uint8_t output_relay_number; // F92
uint8_t input_switch_number; // F93
uint32_t time_manual_to_auto; // F94
uint32_t time_on_limit; // F98
uint32_t time_reset; // F9C
uint32_t time_pi_cycle; // FA0
uint32_t time_max_action; // FA4
uint32_t time_min_action; // FA8
uint32_t time_min_turnoff_action; // FAC
uint8_t val_prop_band; // FB0
uint8_t temp_reset_anti_windup; // FB1
int8_t temp_hysteresis; // FB2
uint8_t temp_frost_protect; // FB3
uint16_t power_max; // FB4
uint16_t energy_heating_output_max; // FB6
uint16_t pulse_counter_debounce_low; // FB8
uint16_t pulse_counter_debounce_high; // FBA
uint32_t keeloq_master_msb; // FBC
uint32_t keeloq_master_lsb; // FC0
uint32_t keeloq_serial; // FC4

View File

@ -1001,6 +1001,34 @@ void SettingsDefaultSet2(void)
Settings.flag3.shutter_mode = SHUTTER_SUPPORT;
Settings.flag3.pcf8574_ports_inverted = PCF8574_INVERT_PORTS;
Settings.flag4.zigbee_use_names = ZIGBEE_FRIENDLY_NAMES;
// Heating
Settings.energy_heating_output_max = HEATING_ENERGY_OUTPUT_MAX;
Settings.time_output_delay = HEATING_TIME_OUTPUT_DELAY;
Settings.temp_rampup_pi_acc_error = HEATING_TEMP_PI_RAMPUP_ACC_E;
Settings.temp_rampup_delta_out = HEATING_TEMP_RAMPUP_DELTA_OUT;
Settings.temp_rampup_delta_in = HEATING_TEMP_RAMPUP_DELTA_IN;
Settings.output_relay_number = HEATING_RELAY_NUMBER;
Settings.input_switch_number = HEATING_SWITCH_NUMBER;
Settings.time_allow_rampup = HEATING_TIME_ALLOW_RAMPUP;
Settings.time_rampup_max = HEATING_TIME_RAMPUP_MAX;
Settings.time_rampup_cycle = HEATING_TIME_RAMPUP_CYCLE;
Settings.time_sens_lost = HEAT_TIME_SENS_LOST;
Settings.temp_sens_number = HEAT_TEMP_SENS_NUMBER;
Settings.state_emergency = HEAT_STATE_EMERGENCY;
Settings.power_max = HEAT_POWER_MAX;
Settings.time_manual_to_auto = HEAT_TIME_MANUAL_TO_AUTO;
Settings.time_on_limit = HEAT_TIME_ON_LIMIT;
Settings.time_reset = HEAT_TIME_RESET;
Settings.time_pi_cycle = HEAT_TIME_PI_CYCLE;
Settings.time_max_action = HEAT_TIME_MAX_ACTION;
Settings.time_min_action = HEAT_TIME_MIN_ACTION;
Settings.time_min_turnoff_action = HEAT_TIME_MIN_TURNOFF_ACTION;
Settings.val_prop_band = HEAT_PROP_BAND;
Settings.temp_reset_anti_windup = HEAT_TEMP_RESET_ANTI_WINDUP;
Settings.temp_hysteresis = HEAT_TEMP_HYSTERESIS;
Settings.temp_frost_protect = HEAT_TEMP_FROST_PROTECT;
}
/********************************************************************************************/

View File

@ -554,8 +554,9 @@ void GetFeatures(void)
#ifdef USE_PING
feature6 |= 0x00000080; // xdrv_38_ping.ino
#endif
// feature6 |= 0x00000100;
#ifdef USE_HEATING
feature6 |= 0x00000100; // xdrv_39_heating.ino
#endif
// feature6 |= 0x00000200;
// feature6 |= 0x00000400;
// feature6 |= 0x00000800;

View File

@ -324,7 +324,7 @@ enum DevGroupShareItem { DGR_SHARE_POWER = 1, DGR_SHARE_LIGHT_BRI = 2, DGR_SHARE
enum CommandSource { SRC_IGNORE, SRC_MQTT, SRC_RESTART, SRC_BUTTON, SRC_SWITCH, SRC_BACKLOG, SRC_SERIAL, SRC_WEBGUI, SRC_WEBCOMMAND, SRC_WEBCONSOLE, SRC_PULSETIMER,
SRC_TIMER, SRC_RULE, SRC_MAXPOWER, SRC_MAXENERGY, SRC_OVERTEMP, SRC_LIGHT, SRC_KNX, SRC_DISPLAY, SRC_WEMO, SRC_HUE, SRC_RETRY, SRC_REMOTE, SRC_SHUTTER,
SRC_MAX };
SRC_HEATING, SRC_MAX };
const char kCommandSource[] PROGMEM = "I|MQTT|Restart|Button|Switch|Backlog|Serial|WebGui|WebCommand|WebConsole|PulseTimer|"
"Timer|Rule|MaxPower|MaxEnergy|Overtemp|Light|Knx|Display|Wemo|Hue|Retry|Remote|Shutter";