Smart Home Energy Management Project

The objective of this project is simply to improve our quality of life and save us a LOT of money, whilst maximising our Return On Investment (ROI) and reducing the payback period of our solar installation. I am aiming for less than 5 years and given the full scope of our smart home solar installation project, I am very confident that this is achievable.

My contextual smart home sees everything that goes on in our smart home because it has whole home context. It has real-time access to the state of many sensors, devices and external data feeds. As part of my smart home solar energy project, I have modelled all aspects of our energy usage and storage. It knows if we are in, out or away on holiday and can adapt its behaviour accordingly. It even knows who is at home.

This simply means that our Home Control System has all the information required to do the best job of intelligently managing our energy strategy too. In doing so, it will improve our quality of life and deliver a zero touch user experience. This project describes how I have implemented my smart energy management capability.

There are some very clever energy products on the market right now, providing really useful information and insight but, none of them are really smart. None of them have a wider view of what is going on in your home, aside from a few other energy related products that might be linked to them. For energy management to really work well and realise its full potential and deliver a great user experience, it needs to be part of something bigger.

Approach

My approach takes into account that during the summer months we will be generating large amounts of excess energy (sometimes over 45kWh per day) and during the winter months we will be importing more energy as our generation capability drops off significantly (sometimes generating just a few kWh per day). It makes a lot of sense to switch tariff as we enter winter and back again when we enter spring. I will be aiming to work out the optimum time to do this.

The tariff we are currently on is going to change the way my smart energy management works, so I have modelled this and the associated import and export rates. With Octopus Agile Export, these rates change and my smart home will use their API to download and store the data.

Note:  On 12th April 2023 we moved on to the Octopus Flux tariff. This changes the way our smart energy management works because there are three different import and export rates used in each 24-hour day.

My contextual smart home uses models (Java classes) to model the different object types of objects that form its whole home context. There are currently 400+ objects, with 40+ object types. There are also 120+ IP networked devices in and around our home and 300+ sensors installed within our home and garden. My Home Control System typically handles 100,000 - 200,000 events every day and processes each one in just a few milliseconds. It is essentially a real-time events processing engine. In order to effectively manage our energy usage and storage, a (large) subset of these events will need to be passed to my energy management process.

Free Power

'Free Power' is an object with an object type of 'Power' and is part of the contextual smart home.
Free Power = Solar Power (the energy being generated by my solar panels) - House Power (the energy currently being used by our home)

My contextual smart home needs an accurate view of 'Free Power' and it also needs to be very timely, with minimal latency. A cloud API is not going to be responsive enough and will not work if the Internet connection or remote server is unavailable, so I have developed my own split-core current transformer interface PCB, to determine this locally.

Note:  My Zappi smart EV charger is not wired through our consumer unit and so it is not viewed as a house load.

My @smartest_home sometime tweets about Solar Power. This is measured using my AC current transformer sensor

Time Slicing

My approach to energy management is based on slicing the day up into discrete time periods. These vary slightly depending on it being a week day or the weekend and the tariff periods. I've taken this approach because it avoids conflicts between services and appliances which may compete for energy and interact with each other.

Note:  Note that I only plan to use free, solar energy to charge our CUPRA Born. Our Zappi smart EV charger can be configured to charge using only the available solar power (Eco+ mode).

The time periods of my energy management plan is:

00:00 to 02:00

The house will be running on battery power.

02:00 to 05:00

05:00 to Sunrise

On June 21st (longest day) sunrise was at 04:32, so this time period could be quite short.

Sunrise - 07:00(w/d) or 08:00am(w/e)

On June 21st (longest day) sunrise was at 04:32. On December 21st (shortest day) sunrise was at 08:06, so this time period will not exist for some days during winter.

07:00(w/d) or 08:00(w/e) - 09:00

09:00 - 11:00

This is a peak time period and the focus is on maximising export, if the predicted energy generation is high enough and the tariff is right. I will investigate how much power I can safely export from the Tesla Powerwall during this period over winter.

11:00 - 16:00

16:00 - 19:00

This is the Octopus Flux peak time period and the focus is on maximising export, if the predicted generation is high enough and tariff is right.

19:00 - Sunset

On December 21st (shortest day) sunset was at 15:40, so this time period may not exist. On June 21st (longest day) sunset was at 21:14.

Sunset - 00:00

Design

Note:  My contextual smart home generates extensive logs, which are both machine and human readable. All of the things described here are included in these logs, so it very easy to see what is going on and to diagnose and resolve issues.

A lot of the simpler energy management features can be implemented without coding, using configurable, dynamic controllers. These make it really easy to very powerful things, such as dynamically controlling thermostat set points based on whole home context.

To do the really clever stuff though, I am implementing an energy management Java class. This enables very complex, programmatic control and so anything is possible :-)

Timeliness

Whilst my Home Control System is event driven and handles each event in just a few milliseconds, energy management doesn't require this level of responsiveness. Initially, I'm planning for the energy management process to run every 15 seconds but, I will see how well this works and will shorten or extend this time accordingly.

Sometimes, the energy management process is going to take action (e.g. switch on the hot water immersion heater) and then need to wait to see exactly what impact that action has (although many are predictable).

House Mode & Status

A big part of how my contextual smart home adapts dynamically is driven by the house mode & house status and the energy management is no exception. Simple things like not heating the hot water tank when we are away on holiday already happen but, we also wouldn't want to pre-heat the hot water tank when we could export that energy instead and get paid for it.

Time

The decision making process is going to make different choices at different times of the year and the day. My contextual smart home also knows everything about the sun, where it is in the sky, how strong it is, sunrise and sunset times, as well as dawn and dusk.

History

The decision making process is going to make different choices at different times of the year. My contextual smart home knows about our historical usage and expected generation and demand for any given time of year.

  1. Our monthly baseline (average usage for the last 8 years) is stored as an array of float values, one for each month.
  2. Our electricity usage also will be stored as an array of float values, representing monthly usage for each year.
  3. Our gas usage also will be stored as an array of float values, representing monthly usage for each year.
  4. I also store highest and lowest daily usage for each month.

My process will support a range of functions, to work out average values for each month, highest and lowest values, etc.

Tariffs

A big part of the energy management process is based on awareness of the current import and export tariffs. It will also use the cost of gas (in kWh) to make intelligent decisions, e.g. exporting energy (e.g. at peak times) and using cheaper gas instead.

Solar Prediction

My Home Control System predicts how much solar energy is likely to be generated in the coming 5 days, broken down into 30 minute slots. This will change its behaviour in terms of how much energy is stored in the batteries and will also change the recommendations made by my contextual smart home. This is achieved using the Solcast service. It can provide a forecast up to 6 days ahead but, the further you look ahead, the less accurate they become. At the moment my algorithms are only using data for the coming three days but, this may change. The data also changes as the weather changes, so you need to update your forecasts regularly. I update mine every hour. There have been a few occasions where the forecast for the current day has changed quite a lot in a fairly short period of time.

When I started using the API, I created a 'site' and put in the details of my solar installation. The forecasts provided were a bit optimistic and so I captured them in my daily data, along with actual daily generation. I then calculated the averages for a whole month and used the difference between them as a 'correction factor' for future predictions. By multiplying future predictions by this correction factor, my predictions going forward were much more accurate.

I can't emphasise enough, how important and useful solar prediction is. I've found that once calibrated to my specific installation, the Solcast forecasts are remarkably accurate and provide really useful insight into how much you will generate. This can be used to optimise usage, battery charging and also let the whole family know when is a good time to be using high energy appliances.

My @smartest_home occasionally tweets in real time about the predicted solar energy from my solar panels for the coming day. This is really useful information for prioritisation of energy usage.

My @smartest_home will also occasionally tweet about the predicted solar energy from my solar panels in the coming days.

My @smartest_home also stores and uses predictions for the morning and afternoon. These can be used to make better energy management decisions.

I've created a separate service and Java class to model and capture Solcast data. It stores a 2-dimensional, rolling array of 31 days, each with 48 slots (30 mins each), with predicted power and a timestamp. The timestamp allows my smart home to know how current the data is.

Generation, Usage & Storage

Knowing how much energy is currently being generated and used, along with how much is stored in the Tesla Powerwall is going to be a factor in the decision making process. These numbers will come from the Tesla Backup Gateway API.

The Tesla Powerwall is modelled by my contextual smart home, so that it can intelligently control it based in current battery state and predicted solar generation.

Batteries

The two main batteries of importance to this project are:

Note:  My smart energy management has to also factor in the possibility of power outages. It does this by dynamically modelling and calculating the 'Tesla Powerwall Minimum Level' and this is covered in more detail in my models.

Electric Vehicle

A key piece of context is knowing if the CUPRA Born is plugged in and can be charged. I am currently investigating the Zappi smart EV charger's API to see what is possible. Mostly, it will be on the drive and plugged in, so that it will be charged automatically by my smart home. According to the EV charging standard, the minimum charging current is 6A (approximately 1.4kW) so if we have less than 1.4kW of free power, the charger is configured to not attempt charging.

If the EV charger is enabled and not putting energy into the EV, then it is either not connected or it is fully charged. Fully charged can mean different things. The default is that the CUPRA Born charges to 80% only but, this can be changed using the vehicle smartphone app. If we know we are going on a longer journey, this will be set to 100%.

Implementation

Free Power

The first thing to do is to determine the Free Power, which is the Solar Power (the power being generated by my solar panels) minus the House Power (the power being consumed by the house in normal operation). This assumes none of the following are active:

My contextual smart home is control of all of these though and would know if they are active and factor them in to the Free Power calculation. Knowing the Free Power it can start to make energy management decisions.

Tesla Powerwall

A decision will be made as to whether the Tesla Powerwall needs to be charged or whether it is a good time to export energy. At peak times, the rates paid by Octopus Agile sometimes mean it is sometimes worth exporting as much as possible. This will come down to charge state and time of day though. The Tesla Powerwall needs to have enough power to keep the house running through the night and calculations are made to ensure it reaches the required level.

You could argue that using cheap rate energy over night is better but, I'm factoring energy security as well for now and assuming that it needs enough charge to handle a power outage.

Hot Water

Note: My original plans were based around a binary (on/off) controller for my immersion heater but, my research and testing showed that this really wouldn't do much as it would be activated very infrequently. I'm now planning variable/proportional control that will enable my immersion heater to use anything from 450W to 3000W.

You can read more about this project, my design and implementation.

EV Charging

My contextual smart home will know if our CUPRA Born is plugged in and its battery state. Our Cupra Born has a 54kWh battery but typically electric cars are only charged to 80% for day to day use, so that's 43.2kWh at most for one charge. It will also never be starting from 0%, so my approach is to leave it plugged in whenever possible and let my contextual smart home intelligently charge it as required.

My @smartest_home occasionally tweets about the battery state of our Cupra Born.

Note:  I will never charge our CUPRA Born using the Tesla Powerwall. There maybe a conflict during the winter months, when the Zappi smart EV charger will be in Eco+ mode on a schedule and will try and pull power from the battery. To avoid this, I may have to force the Tesla Powerwall into slow charging.

Air Conditioning

We plan to fit air conditioning later. This will only be used on the hottest, sunniest days of the year and the assumption is that this will only ever use free solar energy.

Hot Tub

We plan to install a hot tub later. The thinking is that this will also be smartly managed to use free solar energy too. This will not be the case in the longest winter months though.

Recommendations

All of the things I've talked about so far are actively managed by my contextual smart home, with no input or action required by me or my family. There is more potential to save money though, by my smart home making recommendations for the best time to switch appliances on, such as the washing machine or dishwasher.

I am also exploring how this might work with smart appliance control as we now have a Wi-Fi connected washing machine.

Testing

Sunrise - 7am(w/d) or 8am(w/e)

I hit an immediate problem with pre-heating the hot water using the immersion heater with a simple on/off controller. The problem is that the gas boiler just cuts in on a timer before the immersion has a chance to do anything. To get around this, I've designed a proportional/variable controller that works much like an Eddi / iBoost device and allows my contextual smart home to choose how much power get put into the immersion heater. My gas boiler also only heats the water if the Hot Water Tank is below 50% capacity. This 50% number may be reduced further, depending on how future testing goes. This means my wife will always have enough hot water for a bath before she goes out to work but, the solar energy and immersion heater are doing a lot more of the work on sunny days.

Zappi EV Charger

My initial tests on our Zappi smart EV charger have been really impressive! As an example, on the 22nd October 2022 we generated 25kWh and the charger was able to put 18kWh of this into our CUPRA Born, despite also running the washing machine 3 times that day. It is remarkable good at utilising excess solar power, which is an essential part of my smart energy strategy.

Energy Dashboard

It is all very well having my contextual smart home make really smart decisions but, myself and my family can make decisions that will have an impact on our energy management strategy. One thing my smart home can do is help us make better decisions. This means using appliances at the best time and not turning on several at once, if it can be avoided. To help myself and my family make better decisions, we have an 'energy dashboard' on a display in our kitchen. My energy dashboard project describes this in a lot more detail.

Summary

This has been a really interesting project to undertake. It has really made me think about how we can use the energy generated by our solar panels and what our priorities are. It is about achieving the right balance between improved quality of life and saving the maximum amount of money. My smart home solar energy project was never just about the money though.

Ultimately, this is one big experiment for me and I will continue the experiment and see what works best.

Further Reading

My Features

My Projects

My Reviews

Buy Me A Coffee

If you found this page useful you can buy me a coffee. This helps me maintain this website and add more content.