I’m speccing out a solar installation, and one of the tools I use supports adding custom usage patterns for a more accurate prediction.
Home Assistant has this, but the REST API doesn’t have an endpoint to query it. But the websockets API that bits of the front end use, does.
I made a CLI tool to fetch the hourly electricity consumption data as shown on the Energy Dashboard.
It also calculates the average hourly consumption for any number of days, so you can get a real good idea how much energy you use, on average, at 4pm over a period of 3 months.
Check it out. Feedback via issues on GitHub is welcome!
Example:
go run ./main.go
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
| 0.374000 | 0.338000 | 0.352000 | 0.361000 | 0.386000 | 0.596000 | 0.499000 | 0.662000 | 0.837000 | 0.643000 | 0.819000 | 0.865000 | 0.680000 | 0.612000 | 0.570000 | 0.793000 | 1.350000 | 1.141000 | 1.179000 | 1.048000 | 0.621000 | 0.422000 | 0.277000 | 0.361000 |
| 0.368000 | 0.442000 | 0.338000 | 0.451000 | 0.349000 | 0.663000 | 1.645000 | 0.655000 | 0.672000 | 0.793000 | 0.577000 | 0.790000 | 0.820000 | 0.529000 | 0.682000 | 0.485000 | 1.827000 | 0.929000 | 0.779000 | 0.973000 | 0.606000 | 0.928000 | 0.338000 | 0.374000 |
| 0.354000 | 0.432000 | 0.390000 | 0.390000 | 0.613000 | 0.827000 | 0.973000 | 0.824000 | 0.438000 | 0.762000 | 0.936000 | 0.830000 | 0.943000 | 0.873000 | 0.749000 | 1.452000 | 1.215000 | 0.729000 | 0.813000 | 0.683000 | 0.529000 | 0.389000 | 0.419000 | 0.404000 |
| 0.370000 | 0.449000 | 0.358000 | 0.400000 | 0.402000 | 0.625000 | 0.567000 | 1.175000 | 1.106000 | 0.448000 | 0.391000 | 0.723000 | 0.604000 | 0.754000 | 0.713000 | 0.830000 | 1.267000 | 1.237000 | 0.865000 | 0.790000 | 0.652000 | 0.649000 | 0.420000 | 0.489000 |
| 0.399000 | 0.372000 | 0.340000 | 0.371000 | 0.373000 | 0.591000 | 0.409000 | 0.744000 | 0.475000 | 0.649000 | 0.433000 | 0.536000 | 0.494000 | 0.561000 | 0.568000 | 0.583000 | 0.519000 | 0.543000 | 0.577000 | 0.483000 | 0.459000 | 0.440000 | 0.432000 | 0.432000 |
| 0.306000 | 0.394000 | 0.344000 | 0.352000 | 0.414000 | 0.617000 | 0.611000 | 0.861000 | 0.897000 | 0.971000 | 0.734000 | 0.552000 | 0.781000 | 0.465000 | 0.553000 | 0.621000 | 0.853000 | 0.776000 | 0.948000 | 0.507000 | 0.864000 | 0.348000 | 0.435000 | 0.331000 |
| 0.312000 | 0.318000 | 0.313000 | 0.329000 | 0.354000 | 0.978000 | 1.084000 | 1.083000 | 0.830000 | 1.159000 | 0.727000 | 0.697000 | 0.823000 | 0.587000 | 0.760000 | 0.693000 | 0.656000 | 0.842000 | 0.772000 | 0.530000 | 0.829000 | 0.461000 | 0.289000 | 0.408000 |
| 0.255000 | 0.370000 | 0.243000 | 0.330000 | 0.330000 | 0.549000 | 0.498000 | 0.496000 | 0.484000 | 0.609000 | 0.658000 | 0.603000 | 0.736000 | 0.753000 | 0.819000 | 0.584000 | 1.272000 | 0.411000 | 0.925000 | 0.550000 | 0.370000 | 0.413000 | 0.320000 | 0.309000 |
| 0.311000 | 0.340000 | 0.345000 | 0.337000 | 0.345000 | 0.999000 | 0.700000 | 1.223000 | 0.956000 | 1.085000 | 0.692000 | 0.568000 | 0.674000 | 0.838000 | 0.673000 | 0.538000 | 1.002000 | 1.345000 | 0.665000 | 0.545000 | 0.399000 | 0.399000 | 0.246000 | 0.373000 |
| 0.281000 | 0.367000 | 0.270000 | 0.356000 | 0.332000 | 0.560000 | 0.481000 | 0.431000 | 1.090000 | 1.199000 | 0.928000 | 0.299000 | 0.730000 | 0.424000 | 0.477000 | 0.694000 | 1.519000 | 1.037000 | 0.601000 | 0.636000 | 0.404000 | 0.438000 | 0.301000 | 0.403000 |
| 0.465000 | 0.425000 | 0.380000 | 0.396000 | 0.340000 | 0.410000 | 0.381000 | 0.484000 | 0.531000 | 0.847000 | 0.706000 | 0.789000 | 0.678000 | 1.217000 | 0.577000 | 0.896000 | 1.809000 | 1.665000 | 1.292000 | 0.612000 | 0.487000 | 0.328000 | 0.389000 | 0.354000 |
| 0.278000 | 0.417000 | 0.229000 | 0.423000 | 0.353000 | 0.373000 | 1.176000 | 1.212000 | 0.681000 | 0.646000 | 0.793000 | 0.704000 | 0.688000 | 0.462000 | 0.548000 | 0.606000 | 0.782000 | 1.520000 | 0.627000 | 0.725000 | 0.661000 | 0.516000 | 0.557000 | 0.405000 |
| 0.286000 | 0.318000 | 0.277000 | 0.276000 | 0.338000 | 0.350000 | 0.611000 | 0.591000 | 0.887000 | 1.371000 | 0.764000 | 0.952000 | 0.726000 | 0.823000 | 0.719000 | 0.958000 | 1.392000 | 1.216000 | 0.449000 | 0.517000 | 0.349000 | 0.404000 | 0.282000 | 0.406000 |
| 0.338000 | 0.334000 | 0.386000 | 0.338000 | 0.385000 | 0.597000 | 0.514000 | 1.148000 | 1.610000 | 0.713000 | 0.654000 | 0.547000 | 0.609000 | 0.587000 | 1.864000 | 0.856000 | 1.405000 | 1.071000 | 0.827000 | 0.742000 | 0.959000 | 0.354000 | 0.293000 | 0.309000 |
| 0.361000 | 0.316000 | 0.361000 | 0.302000 | 0.357000 | 0.517000 | 0.651000 | 0.743000 | 0.649000 | 0.633000 | 0.657000 | 1.117000 | 0.675000 | 0.751000 | 1.361000 | 1.090000 | 1.293000 | 0.819000 | 0.606000 | 0.650000 | 0.496000 | 0.394000 | 0.353000 | 0.337000 |
| 0.373000 | 0.390000 | 0.322000 | 0.361000 | 0.343000 | 0.612000 | 0.949000 | 1.119000 | 0.592000 | 0.737000 | 0.849000 | 0.625000 | 0.665000 | 0.679000 | 0.832000 | 0.577000 | 2.345000 | 0.831000 | 0.586000 | 0.528000 | 0.438000 | 0.357000 | 0.399000 | 0.306000 |
| 0.328000 | 0.340000 | 0.357000 | 0.316000 | 0.352000 | 0.505000 | 0.900000 | 0.766000 | 0.688000 | 0.675000 | 0.757000 | 0.844000 | 0.863000 | 1.557000 | 1.354000 | 0.777000 | 0.807000 | 0.822000 | 0.803000 | 0.466000 | 0.454000 | 0.443000 | 0.318000 | 0.355000 |
| 0.364000 | 0.368000 | 0.387000 | 0.364000 | 0.402000 | 0.805000 | 1.263000 | 0.813000 | 0.648000 | 0.956000 | 0.832000 | 0.887000 | 0.903000 | 0.727000 | 0.604000 | 0.414000 | 0.496000 | 0.469000 | 1.045000 | 0.924000 | 0.494000 | 0.377000 | 0.414000 | 0.329000 |
| 0.404000 | 0.363000 | 0.402000 | 0.362000 | 0.373000 | 0.631000 | 0.835000 | 0.642000 | 1.248000 | 0.743000 | 0.677000 | 0.749000 | 0.462000 | 0.515000 | 0.491000 | 0.597000 | 0.571000 | 1.520000 | 0.824000 | 0.561000 | 0.423000 | 0.441000 | 0.450000 | 0.374000 |
| 0.375000 | 0.426000 | 0.419000 | 0.412000 | 0.429000 | 0.445000 | 1.003000 | 1.153000 | 0.986000 | 0.716000 | 0.595000 | 0.986000 | 0.943000 | 0.796000 | 0.920000 | 0.889000 | 0.860000 | 0.684000 | 0.988000 | 0.821000 | 0.977000 | 0.434000 | 0.463000 | 0.369000 |
| 0.390000 | 0.437000 | 0.400000 | 0.410000 | 0.439000 | 0.462000 | 0.958000 | 0.753000 | 0.607000 | 1.214000 | 0.900000 | 0.788000 | 0.726000 | 0.584000 | 0.615000 | 0.588000 | 0.959000 | 1.139000 | 0.801000 | 0.727000 | 0.816000 | 0.819000 | 0.425000 | 0.373000 |
| 0.426000 | 0.331000 | 0.373000 | 0.314000 | 0.417000 | 0.357000 | 0.636000 | 0.678000 | 0.645000 | 0.623000 | 0.643000 | 0.526000 | 0.653000 | 1.117000 | 1.690000 | 1.701000 | 1.275000 | 0.701000 | 0.669000 | 0.923000 | 0.952000 | 0.906000 | 0.788000 | 0.455000 |
| 0.340000 | 0.365000 | 0.330000 | 0.363000 | 0.353000 | 0.424000 | 0.572000 | 0.883000 | 0.605000 | 0.750000 | 0.533000 | 0.779000 | 0.766000 | 0.630000 | 0.503000 | 0.769000 | 1.774000 | 0.985000 | 0.661000 | 0.707000 | 0.671000 | 0.551000 | 0.458000 | 0.391000 |
| 0.361000 | 0.364000 | 0.365000 | 0.351000 | 0.364000 | 0.370000 | 0.616000 | 0.489000 | 0.762000 | 0.716000 | 0.472000 | 0.447000 | 0.837000 | 0.957000 | 1.244000 | 0.645000 | 2.200000 | 0.867000 | 0.670000 | 0.614000 | 0.646000 | 0.679000 | 0.366000 | 0.360000 |
| 0.388000 | 0.324000 | 0.385000 | 0.322000 | 0.381000 | 0.369000 | 0.762000 | 0.864000 | 0.975000 | 0.951000 | 0.531000 | 0.743000 | 0.829000 | 0.703000 | 0.718000 | 1.114000 | 0.925000 | 1.017000 | 0.691000 | 0.531000 | 0.460000 | 0.435000 | 0.393000 | 0.378000 |
| 0.299000 | 0.368000 | 0.314000 | 0.364000 | 0.344000 | 0.420000 | 0.657000 | 0.493000 | 0.369000 | 0.596000 | 0.356000 | 0.640000 | 0.434000 | 0.440000 | 0.459000 | 0.447000 | 0.863000 | 0.592000 | 0.892000 | 0.411000 | 0.393000 | 0.366000 | 0.422000 | 0.330000 |
| 0.371000 | 0.307000 | 0.369000 | 0.321000 | 0.373000 | 0.368000 | 0.620000 | 0.394000 | 1.160000 | 0.803000 | 0.482000 | 0.438000 | 0.511000 | 0.388000 | 0.487000 | 0.396000 | 0.443000 | 0.488000 | 0.586000 | 0.512000 | 0.397000 | 0.421000 | 0.319000 | 0.358000 |
| 0.408000 | 0.443000 | 0.412000 | 0.441000 | 0.441000 | 0.558000 | 0.677000 | 0.543000 | 0.629000 | 0.516000 | 0.517000 | 0.609000 | 0.682000 | 0.516000 | 0.498000 | 0.691000 | 1.691000 | 0.602000 | 0.537000 | 0.589000 | 0.460000 | 0.429000 | 0.380000 | 0.315000 |
| 0.343000 | 0.397000 | 0.342000 | 0.389000 | 0.339000 | 0.450000 | 0.504000 | 0.745000 | 0.786000 | 0.577000 | 0.480000 | 0.538000 | 0.420000 | 0.544000 | 0.655000 | 0.675000 | 1.759000 | 0.647000 | 0.683000 | 0.701000 | 0.883000 | 0.577000 | 0.961000 | 0.446000 |
| 0.328000 | 0.386000 | 0.326000 | 0.380000 | 0.356000 | 0.444000 | 0.426000 | 1.399000 | 0.641000 | 0.590000 | 0.708000 | 0.622000 | 1.147000 | 0.512000 | 0.480000 | 0.694000 | 0.560000 | 0.440000 | 0.449000 | 0.495000 | 0.436000 | 0.444000 | 0.349000 | 0.399000 |
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
| 0.351867 | 0.374700 | 0.347633 | 0.362733 | 0.379233 | 0.549067 | 0.739267 | 0.802200 | 0.782800 | 0.789700 | 0.660033 | 0.693100 | 0.716733 | 0.696700 | 0.772767 | 0.755100 | 1.189633 | 0.902833 | 0.760333 | 0.650033 | 0.586167 | 0.485400 | 0.408533 | 0.374433 |
+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+