The Energy Detective Forums

General Category => Developer Support => Topic started by: jasono on February 10, 2016, 07:09:37 PM

Title: TED and Nest API for on-peak kW demand, Python script
Post by: jasono on February 10, 2016, 07:09:37 PM
I am on Duke Energy residential and have solar panels. The largest part of my monthly bill is on-peak demand for a 15 minute window. If I turn on my oven at the same time my AC is running, that can add about $28 to my bill for just for that 15 minutes. This happens time-to-time, and I hate it.

I have been looking for a long time for a solution for turning off appliances and other devices when my demand goes above my current peak. I figure through the Nest API, I can just turn off the heater/AC if I, for example, turn on the oven.  If the sun is out at that time and my solar panels are generating electricity, I can run both. This solution has been working well for me over the last few months.

Since I am not much of a programmer, I grabbed what I could from the web. Most of the program is from this base:
That script pulls the TED data and puts it into MySQL every minute. I added all the Nest data like temperature, humidity, set point, away, outside temp, etc to the database. I then added a moving 15 minute average and a 2 minute average. If my 2 minute average goes above my current peak demand, I turn on the heater/AC. Once both averages are back below my peak demand, I turn it back on. I find that the heat/AC only turn off a few minutes a day.

I then wrote a simple PHP script to serve the MySQL data to Excel for plotting and calculating. Excel updates itself every time you open it to get the latest data. I thought about web-based graphing programs, but in the end the only one who cares about the data is me. 

I am interested to see if anyone else is looking for this type of solution and wants to share ideas.
Title: Re: TED and Nest API for on-peak kW demand, Python script
Post by: jasono on February 10, 2016, 07:29:57 PM
This is an example of the TED/Nest data in excel.
Title: Re: TED and Nest API for on-peak kW demand, Python script
Post by: 34by151 on February 11, 2016, 03:52:56 PM
Take a look at what im doing with load shedding,3397.0.html

My issue is similar although a bit more complex
We get 6c for exported power but pay 48c for imported power
On top of that we pay $1.50 per day to be connected to the grid

My goal is to go off grid, not being connected saves almost $550 right away
For now the goal for each day is to first get the battery banks fully charged
That means turning off the pool pump and WHS (which are the biggest loads by far) till im exporting to the grid
Export will not happen till the batteries are charged.
Once im exporting im limited to a max of 5kw export power
I have 15kw of inverters, so up to 10 is not being used unless I have extra loads im self consuming
This is the point where I turn on the HWS system and pool pumps

Im just using contactors on the circuits controlled by a web relay.
The code is written in a bash script that im running on one of my Linux servers (SUSE 11) but this would run equally as well on a raspberry pi or on windows with win-bash