Analysis - New Zealand got through Friday morning's power supply threat by a narrow margin, as a combination of consumer and business conservation measures and cranked up power stations met demand.
National grid operator Transpower gave the industry less than 24 hours notice of the immediate risk of power cuts and blackouts, with a call for as much as power as possible and a warning to be ready to reduce demand.
That was followed by the mid-afternoon public call for conservation or face the risk of power cuts.
In the end it got through with businesses and households delivering savings of about 260 megawatts (MW), equivalent to power that would have been consumed by Hamilton city.
"It was colder than expected, so the response from Kiwis at home and our major industrial electricity users was essential to ensure that all New Zealanders had continuous access to power this morning," chief executive Alison Andrew said.
But there were a few nervous moments as one plant went down on Thursday night, and a couple of the gas fired plants took time to get online.
How did we get here?
First a few basics. There are a lot of watts in electricity - watts, kilowatts, megawatts, gigawatts, and then they get linked with hours.
But to have a simple reference: A 1 kilowatt heater running for an hour will consume kWh (kilowatt hour) of electricity.
Average New Zealand households use about 8000kWh of electricity a year.
The country has theoretical total generation capacity of about 10,000 MW, and on past numbers peak winter demand has been just over 7,000 MW.
But in reality not all the stations are available, and there was at least 700 MW of capacity out of use for maintenance, although Transpower had been asking for some time for generators to delay maintenance if possible.
The low level of wind generation was a worry also.
On the other, side demand has been rising, with growth of about 4 percent over the past year, but in the short term the current cold snap with colder than expected temperatures were the short term worry.
How did we get through?
With a combination of power conservation from households and businesses, and cranking up all the generation that was possible.
The bulk of supply, about 63 percent, came from hydropower, 14 percent from geothermal, 9 percent from gas, 7 percent from coal, 3 percent from wind, and the rest from a mix of solar, batteries, and a small oil fired plant.
Transpower's comfort zone was about 200MW, but at one stage the amount in reserve got as low as 140MW. Any further drop would have triggered quick measures to cut demand such as turning off electric water heating systems, and then possibly supplies to bigger consumers and possible regions.
How does the power system work ?
There are five big power generators, the top four are also retailers so are called gentailers.
Manawa is a generator only, and there are a host of smaller players.
Contact - geothermal, hydro, quick start gas plants, a diesel powered back up station
Genesis - hydro, wind, and the massive coal and gas fired Huntly station.
Meridian - wind, hydro
Mercury - hydro, wind, geothermal
Manawa - virtually all smaller hydro plants, and a small diesel fired reserve station
A growing number of smaller operators generate from solar and wind power.
More than 80 percent of New Zealand's electricity is from renewable sources.
Matching supply and demand
State owned Transpower runs the national power grid and co-ordinates supply and demand to ensure enough electricity, including forecasting what the expected demand will be in coming days.
Transpower asks generators to offer power to meet the anticipated demand and looks at the price and quantity of offers and chooses the best priced ones to meet demand at that time. Prices vary through the day depending on demand and where it is.
Transpower's responsibility is to have reserves up its sleeves for a cold night, a storm, a power station or power line failure, which is why it issues market alerts as it did on Thursday when the conditions change what might be needed against how much power is on offer.
The system's vulnerabilities were laid bare in August 2021 when blackouts hit 34,000 households.
After lots of finger pointing, initially at the power companies, the Electricity Authority held Transpower's poor communication as a key factor.
Transpower is much more active in issuing notices to the industry as a result.
We need more power
Transpower says the country needs more fast-peaker stations. These are usually gas fired which can be turned on and start producing power in minutes. The problem is some of the old ones are broken, some have been dismantled, and power companies are reluctant to have tens of millions of dollars tied up in plants that might be used only occasionally.
And then there's the small problem of getting enough gas to fire them as well, but supplies are dwindling and no-one is looking for more ... at the moment. But industrial users are vocal about the need for gas as a transition between fossil fuels and renewable sources. But that is a whole other debate.
Wind and solar farms are growing apace, but pose problems when the wind does not blow and the sun doesn't shine.
Putting an end to the use of coal and gas in power generation and have a renewable power system means having to invest in more windmills and solar panels than might be needed. That can be partly solved by having big batteries to store renewable power which can be released when demand is up and generation at risk. Genesis is doing that at Huntly at the moment.
But for the time being imported coal, gas and in the future biomass are needed to help keep the lights on.