how much energy are we using?

We finally got a smart meter installed in the flat. Octopus Energy have a REST API. I have hardcore bash scripting skills. gnuplot + curl + jq + cron combined to provide these graphs which update every so often.

Not sure how often Octopus provide updates through the API, it seems to be a few to several hours behind reality. Not sure if this is because our smart meter is still new or what.

Snippets of how I did this

            curl -u "${api_key}:" "https://api.octopus.energy/v1/electricity-meter-points/${elec_mpan}/meters/${elec_serial}/consumption/?order_by=-period" \
| jq -r '.results[] | {interval_start,consumption} | join(" ")' \
| head -n48 \
> elec-24.dat
            
          
            set xdata time                      
set timefmt "%Y-%m-%dT%H:%M:%SZ"     
set format x "%H:%M"                 
set key off                          
set xtics rotate by -45              
set title "Electricity Usage (24h) kWh"   
  
set terminal png            
set output 'elec-24.png'  
  
plot 'elec-24.dat' using 1:2 with linespoints linetype 4 linewidth 2