Gasbudget vertalen naar dagelijkse tijdlijn melding

Om te voorkomen dat je 24 variabelen aanmaakt, hier een scriptje daarvoor.

// Setting tag GasBudget and ElectricityBudget

const date = new Date();
const currentMonth = date.getMonth();

var gasBudget = [221,189,159,85,35,19,17,17,24,81,146,207];
var electricityBudget =[339,281,267,206,180,160,160,177,200,267,307,356];

var count = 0
while(count <= gasBudget.length -1)
{
if(count === currentMonth)
{
var gasBudget = gasBudget[count];
var electricityBudget = electricityBudget[count];
}
count++
}
await tag('GasBudget', +gasBudget);
await tag('ElectricityBudget', +electricityBudget);

// Delete Tags remove // before await tag('GasBudget', null) and await tag('ElectricityBudget', null);;

//await tag('GasBudget', null);
//await tag('ElectricityBudget', null);

Kopieer dit script in advanced flows in het kaartje Homeyscript, Run Code.
Maak de volgende flow en je hebt twee tags genaamd GasBudget en Electricity Budget beschikbaar met de juiste gegevens

10 Likes