diff --git a/README.md b/README.md index 710de9b..9968f5f 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ Here's a breakdown of all the available configuration items: | cheapest | Y | false | If true show the cheapest rate in light green / light blue | | combinerate | Y | false | If true combine rows where the rate is the same price, useful if you have a daily tracker tarrif for instance | | multiplier | Y | 100 | multiple rate values for pence (100) or pounds (1) | - +| rateListLimit | Y | N/A | Limit number of rates to display, useful if you only want to only show next 4 rates #### A note on colouring diff --git a/octopus-energy-rates-card.js b/octopus-energy-rates-card.js index a437079..0f8032c 100644 --- a/octopus-energy-rates-card.js +++ b/octopus-energy-rates-card.js @@ -150,6 +150,7 @@ class OctopusEnergyRatesCard extends HTMLElement { const cheapest = config.cheapest; const combinerate = config.combinerate; const multiplier = config.multiplier + const rateListLimit = config.rateListLimit var colours = (config.exportrates ? colours_export : colours_import); var rates_totalnumber = 0; var combinedRates = []; @@ -236,7 +237,7 @@ class OctopusEnergyRatesCard extends HTMLElement { rates_processingRow ++; var ratesToEvaluate = key.value_inc_vat * multiplier; - if(showpast || (date - Date.parse(new Date())>-1800000)) + if((showpast || (date - Date.parse(new Date())>-1800000)) && (rateListLimit == 0 || rates_list_length < rateListLimit)) { rates_currentNumber++; @@ -404,7 +405,9 @@ class OctopusEnergyRatesCard extends HTMLElement { // Combine equal rates combinerate: false, // multiple rate values for pence (100) or pounds (1) - multiplier: 100 + multiplier: 100, + // Limit display to next X rows + rateListLimit: 0 }; const cardConfig = {