Earth Notes: On Website Technicals (2022-03)

Updated 2022-10-23.
Tech updates: jq, daylight bug not saving.
Learning some new tools, analysing data from some new toys!

2022-03-28: Timezone / DST Bug

So today I discover a subtle cross-platform (eg between macOS and Linux) bug in my handling of the difference in local time (for boost-from-grid) and UTC (for more or less everything else such as stats).

I expect more bugs to pop out of the woodwork over the next few days.

One of my tech suppliers had its on-line portal messed up this morning by the time change, another managed to avoid it this year but last was bad!

Amongst all the other reasons to stop flicking the clock back and forth 1h twice a year — fiddling at the edges of an ~8h change in UK day length between mid-summer and mid-winter — is avoiding all these hard-to-test code issues. Please just make it stop. Preferably on GMT/UTC for the UK, so that Greenwich stays on Greenwich time!

On a general note, the eddi+Thermino does seem to be working, and automatic diversion (not affected by the above bug) almost eliminated gas use this last week. Hurrah!

2022-03-12: Learning jq

I want to keep track of how much electricity I have diverted (or boosted) to my shiny new Sunamp Thermino heat battery (via the myenergi eddi) installed a few days ago.

This is energy that would have been kWh-for-kWh (ignoring efficiency issues) from gas before.

Today's new script is eddiDaySummary.sh which makes use of the rather nifty jq tool to extract and summarise data of interest from the eddi by-hour JSON stats to a single CSV row easier to process with *nix tools.

Example raw JSON from eddi for today so far:

% sh script/myenergi/eddiStatsByHour-netrc.sh 2022-03-12
{"U0":[{"yr":2022,"mon":3,"dom":12,"imp":59233,"exp":1440,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":1,"imp":62054,"exp":1380,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":2,"imp":61851,"exp":1488,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":3,"imp":58055,"exp":2700,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":4,"imp":608280,"exp":1080,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":5,"imp":279120,"exp":5400,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":6,"imp":740481,"exp":8340,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":7,"imp":466556,"exp":28933,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":8,"imp":185016,"exp":91735,"h1d":27120,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":9,"imp":250740,"exp":161640,"h1d":320220,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":10,"imp":151620,"exp":182760,"h1d":1047000,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":11,"imp":157500,"exp":198960,"h1d":1118520,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":12,"imp":221810,"exp":181320,"h1d":1276620,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":13,"imp":5880,"exp":344734,"h1d":4689939,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":14,"imp":1380,"exp":355980,"h1d":3749580,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":15,"imp":720,"exp":352343,"h1d":2520980,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":16,"imp":16980,"exp":283731,"h1d":653091,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":17,"imp":574500,"exp":24480,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":18,"imp":129090,"exp":3960,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":19,"imp":103605,"exp":2580,"dow":"Sat"},{"yr":2022,"mon":3,"dom":12,"hr":20,"imp":13208,"dow":"Sat"}]}

Example summarised output (in kWh rather than Joules!):

% sh script/myenergi/eddiDaySummary.sh -h
#Eddi daily stats summary in kWh; definitely partial if h < 24
#UTCISOdate,h,h1d,h1b,imp,exp,gen
% sh script/myenergi/eddiDaySummary.sh 2022-03-12
2022-03-12,21,4.279,0,1.153,0.621

Thus there was ~4.3kWh diverted and none boosted today so far (~21h). Also this claims ~1.2kWh grid imports and 0.6kWh exports in total so far. (The Enphase believes 0.6 and 0.9 respectively...)