Skip to content

Instantly share code, notes, and snippets.

minute(59) := 20,26
minute(58) := 20,27
minute(57) := 20,28
minute(56) := 20,29
minute(55) := 20,30
minute(54) := 19,20
minute(53) := 19,21
minute(52) := 19,22
minute(51) := 19,23
minute(50) := 19,24
@hacki11
hacki11 / Jeisha_TimeSync.js
Last active April 23, 2023 19:08
Time Synchronization with HeishaMon
// define MQTT ID to set curves
const JeishaCurve = "mqtt.0.heishamon.commands.SetCurves";
// define MQTT ID for the Time Request Trigger
const JeishaTimeRequest = "mqtt.0.heishamon.main.Z1_Cool_Request_Temp";
// define MQTTT ID to acknowledge time transfer
const JeishaTimeResponse = "mqtt.0.heishamon.commands.SetZ1CoolRequestTemperature";
on({id: JeishaTimeRequest, val: 1}, function(obj) {
var date = new Date();
@hacki11
hacki11 / iobroker_ema.js
Last active November 23, 2022 20:17
Calculate exponential moving average of a temperature sensor and calculate heating curve
const EMAID = 'javascript.0.variables.Jeisha_AT_EMA'
const Outside_Temp = 'mqtt.0.heishamon.main.Outside_Temp';
// EMA 1 day, one measurement every minute 24*60
const alpha = 2.0/(24*60-1);
function calcExponentialMovingAverage(accumulator, new_value, alpha) {
const new_avg = (alpha * new_value) + (1.0 - alpha) * accumulator;
// round 2 decimals
return Math.round(new_avg * 100)/100;
@hacki11
hacki11 / jeisha_start_fix.js
Created November 21, 2022 20:07
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
@hacki11
hacki11 / iobroker.js
Created October 25, 2020 13:40
Basic ioBroker iOS14 Widget
// First draft of fetching values from iobroker datapoints with iobroker.web adapter
let host = args.widgetParameter;
if (!host)
host = "http://<iobroker-ip>:8087"
console.log(host)
let widget = await createWidget()
/* CYCLONE_CONSTANTS */
var VlxDevConstants = VlxDevConstants || {};
/* g_cyclone_general_info */
VlxDevConstants.A_CYC_APPL_SW_VERSION = 1;
VlxDevConstants.A_CYC_APPL_SW_VERSION_1 = 2;
VlxDevConstants.A_CYC_APPL_SW_VERSION_2 = 3;
VlxDevConstants.A_CYC_APPL_SW_VERSION_3 = 4;
VlxDevConstants.A_CYC_APPL_SW_VERSION_4 = 5;
VlxDevConstants.A_CYC_APPL_SW_VERSION_5 = 6;