Skip to content

Instantly share code, notes, and snippets.

@hacki11
Created November 21, 2022 20:07
Show Gist options
  • Save hacki11/8bfe92fe3fca62543bc722645a3377a5 to your computer and use it in GitHub Desktop.
Save hacki11/8bfe92fe3fca62543bc722645a3377a5 to your computer and use it in GitHub Desktop.
Jeisha iobroker start fix
var pumpTimeout
/* Fix failing starts
* When the heat pump starts with high power (> 50Hz) the pump is not set to
* a higher duty. The temperature will be immediately higher than the expected
* reference temperature and the heat pump will stop within a few minutes.
*
* This workaround will be triggered when all conditions are fulfilled
* - Defrosting is not active
* - Last value of Compressor_Freq == 0
* - New value of Compressor_Freq > 0
* - Pump duty is lower than maximum pump duty - 5%
*
* The workaround sets the pump to max duty (SetPump == 1) for 15 minutes.
* If the heat pump restarts within 15 minutes the old 15 minute timeout is cleared
* and a new timeout is configured for SetPump == 0.
*/
on({id: "mqtt.0.heishamon.main.Compressor_Freq", change: "any"}, (obj) => {
// Heat pump starts from idle mode (Compressor_Freq change 0 -> any value > 0)
if(obj.oldState.val == 0 && obj.state.val > 0) {
// Activate workaround only if not in defrost state
const defrosting_state = getState("mqtt.0.heishamon.main.Defrosting_State");
if(defrosting_state.val == 0) {
log("Jeisha is starting...");
// Check if pump is already on high duty
const pump_duty = getState("mqtt.0.heishamon.main.Pump_Duty");
const max_pump_duty = getState("mqtt.0.heishamon.main.Max_Pump_Duty");
if(pump_duty.val > max_pump_duty.val * 0.95) {
log("Pump already on high duty (" + pump_duty + "/" + max_pump_duty + ")");
return;
}
// clear old timer if Jeisha restarts within 15 minute window
if(pumpTimeout != null) {
log("Reset old pump duty timeout");
clearTimeout(pumpTimeout)
}
// Set the pump to run on max duty for a few minutes to overcome the failing starts
log("Set pump to max duty mode")
setState("mqtt.0.heishamon.commands.SetPump", 1, true);
// Activate a timer which resets the pump to normal mode after 15 minutes
pumpTimeout = setTimeout(function() {
log("Reset pump to normal mode");
setState("mqtt.0.heishamon.commands.SetPump", 0, true);
}, 15*60*1000);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment