Skip to content

Instantly share code, notes, and snippets.

@matthinc
Last active May 30, 2020 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthinc/6799bcb1ed883aaa6e0bf9306f4195e3 to your computer and use it in GitHub Desktop.
Save matthinc/6799bcb1ed883aaa6e0bf9306f4195e3 to your computer and use it in GitHub Desktop.
// Heizplan
const heatingPlan = [20, 21, 22, 23, 23.5, 25, 25, 25, 25, 20];
const currentPosition = context.get('pos') || 0;
// Berechne und speichere nächste Position
const nextPosition = (currentPosition++) % heatingPlan.length;
context.set('pos', nextPosition);
// Zieltemperatur
const targetTemp = heatingPlan[currentPosition];
return [{ payload: targetTemp }];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment