Emoncms agile app CSV download

I’ve been using the Agile app to investigate whether shifting would make sense. I’d like to do some custom processing so have been trying to download the CSV data but encountered some issues, some of which seem to be bugs. (This is with a self hosted emoncms.)

  1. i don’t yet have a smart meter so there is no meter_kwh_hh feed. But if I set this to ‘Disable’ in the app settings, download fails with a ‘data[keys[i]][z] is undefined’ message, even though the graphs displayed are fine. I can set that feed to something else (though with effectively dummy data) and the download is now OK, but the graphs now display the dummy data rather than the import feed. I think this behaviour is caused by the setting of ‘keys’ around line 613 in octopus.php, which does not check for whether the meter_kwh_hh feed is defined or not. I have hacked the missing feeds out in my install but there must be a better solution.
  2. I got confused about the cost figures being shown in the graphs vs. those shown in the CSV download. Eventually I realised that the UI shows all costs inclusive of VAT, but the CSV data is exported ex VAT. I am not sure whether there is a right or wrong answer here, but at least it would be helpful to make this obvious in the CSV column headings.
  3. The agile tariff figures are not being exported right. I can see that the graph in the UI uses 2 identical figures at each end of each 1/2 hour period (to give the stepped look), but the CSV export is just going through the array beginning to end, so exporting e.g. 00:00 2.52 00:30 2.52 01:00 3.21 01:30 3.21 … rather than 00:00 2.52 00:30 3.21 01:00 3.15 …

Happy to test fixes for these locally if something provides them, but my PHP/web skills are not such as to allow me to be confident in making them myself.