This program is a two hour introduction to smart homes with an emphasis on electricity controls.
If you would like to take this for continuing education, please register here.
If you would the audio/visual experience, please click here.
Smart homes can be installed in a code compliant manner, to improve health, safety, and welfare benefits of the user and may even save the user some money.
The focus of this two hour program will be to introduce smart home components and concerns, while later walking through the set up of a low budget smart home with a focus on energy controls.
There is a lot to learn, so let’s start with a safety topic.
Here is an example where a hacker infiltrated a home and pretended to be Santa Clause.
Smart Home 2
Later, Google announced one of their web camera partners had a vulnerability which allowed third party access to home security cameras. Google’s response was to cut off access to the cameras until the vulnerability was patched.
This is alarming, but on the other hand, many users of the cameras would be just as annoyed to learn their camera service was interrupted because someone else’s camera was hacked. As much as the public is alarmed about internet security, we are even more enamored with cloud services which invite such insecurities.
The smart home designer will always invite the risk of failure into the home, despite the advantages of smart home technology. Pushing the limits of the technology too far can be a costly error. Cloud services, which require an internet connection, provide can provide convenience, stability, and value, but that internet connection will always mean the device services could be lost, disconnected, or hacked.
Cloud services provide the best voice commands, onces that have obvious accessibility advantages. Voice controls, such as Amazon Alexa or Ok Google, offer new ways of accessing home lighting and other devices.
Home Assistant, the open-source home automation platform we will use in class, has partnered with a privacy oriented voice service called Alta, powered by the Stanford voice engine Almond. But it’s features are still in the early stages of development. But for voice commands to be useful, they can be connected to Amazon or Google cloud services.
Voice commands have immediate uses. What if an automation accidently turns off a light that needs to be turned back on? It almost seems natural in a smart home to yell out to turn the light on, so how does that actually happen?
It is possible to set up a secure internet connection to Google Or Amazon to avoid subscription fees. Home Assistant charges a $5/month fee to enable cloud services to Google and Amazon in a secure manner easily. This is not a programming class, so I suggest paying the fee however it can be avoided with enough hacking.
If you are like me, you might already own a Google or Amazon voice speaker in the house. In any event, I don’t plan to implement my own voice control configuration, and I’d like to control all of my smart devices by voice using these speakers. So there’s no better excuse to sign up for the Home Assistant cloud service trial.
After accepting the invite email, I am prompted to enable Home Assistant within Google Assistant. In other words I need to use the Google Home or Amazon Alexa app to say it is okay to talk to Home Assistant. My Home Assistant devices are now pulled into Google Home.
Immediately, I can tell Google Home to turn on or off my dehumidifier smart plug, or make voice command changes to my thermostat. I can ask the status of these device settings as well. This is cool because my $65 programmable thermostat was not intended to be voice activated. But because it was an internet things device, code has been written to connect it to voice services.
My home is now voice activated, using Google’s cloud service, but unless I am an advanced programmer, I will end up paying some form of monthly subscription feed for this convenience, even if it is modest.
Facial recognition for building security is much more likely to be a cloud service than run on a local computer.. A cloud service doorbell might be more useful than a non-cloud doorbell, unless that non-cloud dumbell is connected to a very powerful computer that runs all the same kind of software as the cloud doorbell.
Companies are commercially incentivized to fund and develop cloud services. So cloud services are sometimes cheaper or sometimes more functional than more secure, local device. Cloud devices usually are easier than secure, local devices. But cloud services also invite security risks, such as a visit from the Christmas Grinch from earlier, or simply losing access to the devices due to external circumstances.
Building design is changing. I like to think of how smart homes could benefit new construction. Could the thermostat be installed directly on the indoor unit, eliminating the wire run to the wall? Temperature sensors from any room could serve as the trigger so a living room mounted thermostat is no longer necessary.
How else might building design change? Might power-over-ethernet devcies require running ethernet cable to the window curtains? Or completely replace AC lighting circuits? Is national electric code even ready for smart home devices?
Let’s start with 210.70 Lighting Outlets Required. (A) Dwelling UInits (1) Habitable Rooms
At least one wall switch-controlled lighting outlet shall be installed in every habitable room, kitchen, and bathroom. The definition of a habitable room is not found in NEC, but rather in International Building Code as a “space for living, sleeping, eating or cooking. Bathrooms, toilet rooms, closets, halls, storage or utility spaces and similar areas are not considered habitable spaces”.
So while not all rooms in the smart home need multiple light switches, code requires most rooms have at least one. Code is less clear as whether or not the switch must be a manual switch or a wireless one, but I think an inspector could put his foot down while being reasonable.
There’s also the spouse acceptance factor to consider. It would not be in the best interest of health safety or welfare to invite negative emotional reactions into the smart home by not providing users with a manual fall back during a smart home failure.
This is interesting because some smart home light switches require rewiring the light switch, routing the power circuit through a tucked-away controller while rewiring the actual light switches as a low voltage relay, rather than a 120V traveling switch. A particularly hard inspector might suggest that a relay on the wall is not the same thing as an actual electrical switch. Also the relays do not work as well as a light switch, as the relays only detect flickering voltage, whereas the traditional light switch actually carries the 120V circuit through a switching traveler circuit.
It is possible to retorfit two-way or three-way light switches but it is also more difficult than to retrofit a single lightswitch. It is much easier to install these controllers when there is only one light switch to control the circuit, not two or three through separate switches. It is also appropriate to have at least one hard-wired light switch on a wall in each room powering at least one hardwired light bulb.
So I don’t think smart homes are ready yet to eliminate all the wires from all the walls. In fact, for new construction, I’d caution a smart home designer to remember that battery-powered devices which mount on walls or ceilings (rather than doors or windows) will usually have either a powered-by-USB or powered-by-ethernet option. In new construction, it is usually a better choice to go with a hardwired option rather than rely on batteries, so that the device can be used more frequently and no longer require batteries to function. The batteries could then be used for power outages as well as to address other power quality issues.
Power quality issues are particularly close to my heart, as I am a solar installer. LED lighting is powered by DC current. But AC current is easier to transmit by the utility. So each DC LED lightbulb has to go from the home AC power to DC lightbulb power. Off-grid solar homes have additional inverters to convert DC solar electricity into a stable AC output. These energy conversions can create voltage flicker in cheap LED lights, a problem that can occur with a grid connection but can become worse in an off-grid setting. The easy solution is to use high quality LEDs – but that can be a difficult solution as a retrofit.
The future of lighting may well be powered-over-ethernet lighting circuits providing 24V DC lighting, powered by an ethernet switch and backed up by an uninterruptible power supply. The future of buildings may be renewable solar homes with offgrid capability. But that isn’t really where I want our focus to be today. There are smart lighting solutions for AC circuits, so customers won’t get left behind by installing traditional lighting systems. Today, I want us to think modestly.
There are future proofing considerations in new construction which could be made today. To me, the achilles heel is bringing power out to window blinds, and I think it is a good bet to plan for powered over ethernet options. Indoor video cameras are another device which might not be installed today, but could be tomorrow. And always remember that a hardwired smart sensor is better than a battery powered one, because it can always be on without requiring a battery replacement.
So we still have light switches on the wall and we still have light switch installation being done by a competent electrician, because if the rather tedious wires are improperly terminated, it can easily become a safety hazard as the wires often are jammed into the back of the junction box behind the switch. Although I have only used the behind-the-box switches, I feel like a full switch replacement would be easier and costs about the same.
So let’s leave our lighting discussion behind to talk about wireless communication protocols within the context of safety.
First, these platforms are no more safe than wifi, or any other wireless signal, in the sense that these communications can be encrypted, or not. Encryption will slow down the signal, and it requires other devices which relay signal to also be encrypted. Sometimes the performance loss on encrypted signals leads to poor signal quality, which isn’t preferable for systems such as security alarms or door locks. A wifi device, such as a cloud service device like Google Nest or Amazon Alexa, can result in customer data being stolen, but there are good uses for a wifi device on a secure connection within a smart home.
Other devices may not need a robust internet signal to function, and so can be taken off wifi completely. An unencrypted, low energy Zwave signal may find it hard to infiltrate a wifi network, whereas a wifi signal is more likely to be on a device powerful enough to do some damage.
Encryption is no good if devices are hacked on the customer side of the network, such as through poor password security. A recommended practice is to select a wifi router which can set up a second “virtual network” which is completely independent of the primary network. The problem of cloud services is that they inevitably want their cloud network to touch your local network at some point, and so the vulnerabilities can be difficult to isolate.
But local encrypted networks do exist, and they can be encrypted networks, and they do not require direct connection to the building’s internet network, which can simplify the internet security concerns of building owners and managers.
These networks wireless networks use different communication frequencies, which offer miniscule advantages compared to each other, usually trading off signal quality for reduced cost and increased battery life. But these networks are really no more secure than if they were wifi devices communicating locally across an independent wifi router, except for the fact that they are less likely to be harboring malware due to their reduced capabilities and smaller distribution channels as compared to a more powerful smart home behmoths using wifi cloud services like Google or Amazon.
So we’re going to conclude the security discussion with the understanding that cloud services are all but inevitable. Having internet in the home means that most people are already purchasing cloud-services. Amazon Alexa, Ring, and Nest are no different than Netflix, Disney +, or even cell phone or traditional utility providers in that they will collect sensitive data in exchange for providing valuable off-site services to the home.
So we will agree that security is a good thing and there are good options available which can be wifi-based or use their own wireless communication platform (such as zigbee or zwave – which are similar but not compatible, and vary by country).
I then add a Zwave antennae via a USB outlet. The rest of my devices are Zwave based and so do not require the internet to run. Any of these devices would have to use my Raspberry Pi to hack the user network, and so only one point of internet connection needs to be sniffed. An even more secure device hardware might have more limited functionality, such as not having a wifi antennae only using a hardwired ethernet connection. A dedicated mini-PC with a linux-friendly computer processor can serve as a nice host for a home automation machine.
Cloud services, as well as other proprietary services, can have limited functions.
Consider the differences between a non-programmable thermostat and a programmable thermostat. The non-programmable thermostat can adjust the temperature but the programmable thermostat can be zoned for each hour of the day and each day of the week. But if I want a programmable thermostat that can be programmed for each hour of the day for each day of the year, I would need something a little more capable. And even a $300 smart thermostat like the Rheem econet only has 7 day programming. I want programming for every hour of the day, every day of the year, with even further capability to accomodate a variety of on-sight energy issues to promote renewable energy in the interest of public welfare, but also to save the customer money through energy automation. The $300 Rheem smart thermostat is not good enough.
The smart home automation platform I use for energy load control is Home Assistant, powered by a $40 Raspberry Pi. It has both a wifi and and ethernet connection. Let’s take a quick break from the technical discussion to show how to set up the smart home controller.
What we’re doing here is building a “local” device, using the Raspberry Pi as a computer. The home automation software will be stored on the computer. The software, called Home Assistant, is an open-source software which can be freely downloaded and even expanded upon. This means our home energy controller will not be a cloud service and will continue running into the future.
The version of Home Assistant I’m using is Hassio. This is because Hassio is easier for non-coders to connect third party applications into. This is not a problem for basic uses, such as voice command and most mainstream devices, but to set up an energy monitor and data logger, use of some complicated software will become necessary. So we will do it in the simplest way possible.
First, I start out by visiting Home Assistant’s official documentation. There are many how to guides for home assistant out there. Using the official guides will make sure that you get proper technical support.
Speaking of technical support, this is where open-source software becomes really fun. Because the software allows for programmers to make contributions to the code, an active user community is available to help with your controller set up.
There is a chat program called Discord which is primarily used by gamers but also has a following within the technical support community. It is similar to the group messaging software Slack, but is more like a chat room from the 1990s. Home Assistant has an active discord community that provides support for beginners and programmers alike.
I also have a Discord community which you can join by visiting the www.community.solar website.
So you are not alone if you are attempting to install open-source home automation software onto a $40 computer for the very first time, if lacking computer skill. Personally, I find this the best way to learn about computers, and if you have children at home, steering them towards a Raspberry Pi home automation build would provide a solid introduction to computer programming. It is a platform that is technical, but more friendly towards beginners than other kinds of computer device manufacturing.
As a reminder, use the “Hassio” installation method because of the Add-on capability, which makes it more compatible with more devices without much programming, as compared to the other “hass” kind of installation, which is done either in Docker or in a virtual machine environment (commonly on a Linux “Intel” machine)
A few different options are presented. These are different kinds of computers which could host Home Assisstant. I recommend starting with a Raspberry Pi, for this class. The need for more robust computer options are discussed later in the program, but a Raspberry Pi is sufficient to implement a modest smart home build.
The next step will require many to take a step out of their comfort zone. Essentially, the operating system and software need to be installed onto the Raspberry Pi hardware. This step is doing both items at once using the balenaEtcher program to write the code onto a (specific Raspberry Pi-friendly) memory card. The software is then burned onto the memory card.
I got lucky. My laptop has the SD mini memory card slot. But already I am faced with a technical challenge. I am using a Chromebook, which is not a Windows PC or a Mac, or even a real Linux computer. But what I need to do is burn an image onto the memory card. Chromebook has a recovery tool which does the same thing as balenaEtcher. This is a program which lets me create a backup boot disk of my computer, or otherwise write image files to boot disks. I select local image, because I am selecting the image file that I have locally downloaded onto my computer from the first step.
It tells me to input my SD card.
It then says that my current SD card will be erased to create a recovery image.
I select create now and within a few seconds I am done. The next step is to pre-load the customer wifi information onto the machine. This involves opening up the SD card and adding a file to it.
My SD card won’t open, and I’m wondering already if I’ve done something wrong. When I click on it, it won’t open. What I can say about flashing software onto hardware, which is what we’re doing, is that the instructions must be performed exactly. I run into some more snags, and the advice I receive from the Discord group is to follow the directions. Consistency is nice. I finally guess the zip program has removed the image “img” extention from my software file, and so I put that back on before zipping it, then reburning it to the hard drive. This finally gets things working.
I want to give the machine wifi access, so that it can download any necessary software when it starts up without me having to plug it in to anything. A clients wifi password could also be pre-programmed so the device would work before shipping to site.
I have to create a text file containing my wifi password and put it in a very specific location on the SD card image file, in a folder known as the boot. This will load the wifi password to the software so that when it powers up, it will automatically update itself. Other configurations could be used to allow for use of the ethernet only.
I know my efforts have worked because the home assistant software has created a website at its address on the local network, using the wifi password access. I can now go through the user creation process.
Already it is recognizing the Google Minis and Chromecasts on my network.
I also take the time to register my Zwave memory stick, by telling the software its location. I don’t actually both to figure out the location of the memory stick.
There are plenty of websites with the answer, so I simply use the information online. Because the Raspberry Pi is a uniform hardware, I don’t need to both with going into the command line interface to actually find the answer the hard way.
It would now be an appropriate time to pat yourself on the back for building a smart home controller from scratch. Later we will add some devices to the controller to start managing the electric load.
But let’s do two more steps first, which will assist the controller’s data logging and display capability. The point of this exercise was to show a very specific installation of Home Assistant called Hassio. What Hassio gains the user is an add-on store which spares the user from learning much of the hard way to program the controller.
Hassio recommends installing the Samba add-on, as well as the SSH add-on. Without getting too far into detail, this is to promote communication between the Raspberry Pi and another device.
We’re going to install InfluxDB to store the data of the energy monitor. When I install Influx, I can’t initially use it. I look in the config files, and I have to disable an https option in order to get it to communicate with my computer over the wifi network. After restarting and giving it a little more time, it starts working.
There isn’t any data in it yet, and I have to create a database named homeassistant, and a user named homeassistant. I use my homeassistant software password for this, in case for some reason it may be used by InfluxDB to accept data from my home assistant user, named homassistant.
The next step is to install the add-on Grafana. I also disable SSL, and then read through the documentation. Grafana is a software based on displaying metrics.
It also suggests to create a new admin user, which I will create the same name and password as my home assistant user.
The next thing I will do is add a data source and select InfluxDB. I enter in the appropriate information, but I still get an error. I needed to go back into InfluxDB and give my influxDB homeassistant user full admin permission in order to make queries into grafana.
Now the datasource is working. The smart home hub is now ready for the energy controllers to be registered.
We’ll come back to this in a minute, for now, let’s get back into the class discussion about technical components. Remember what we have done is set up a local home automation controller, which can communicate with other devices plugged into the controller, including the host site’s internet. This internet access is useful so that the local controller can communicate with cloud-devices such as voice services. It is also useful to enable the home automation software to be accessed by any phone or computer, provided the user has the login password.
However, users concerned about internet privacy at the very least would like to keep smart home device internet access to a minimum, in the interest of internet safety. So for the next few devices registered will be on a different wireless network, one powered by a USB stick plugged into the Raspberry Pi.
So what I do is search for Zwave thermostats, under the assumption that a Zwave thermostat is going to be a smart thermostat. A myriad of options are available on ebay. With any smart device, the version of the software is important. Zwave is now on the “zwave plus” version of its technology. I recommend sticking to Zwave plus components. I’d also consider Zigbee as well as wifi components, so long as they were compatible with my home automation platform (more on that later). I chose Zwave because traditionally they have been cheaper than wifi devices but more intelligent as well. But now many wifi devices can be found at similar price points and functions. I’d caution that Zwave devices can be more difficult but that it also comes with increased core functionality.
At any rate, I went with a $65 Zwave plus thermostat and decided to swap it out with my existing non-programmable Honeywell.
Remember that National Electric Code defines a Qualified Person as one who has skills and knowledge related to the construction and operation of the electrical equipment and installations and has received safety training to recognize and avoid the hazards involved. So if you are a solar installer and you think you can simply take a thermostat off a wall, you might be surprised to discover that it will short out a fuse in the air handler, such that the fan will not turn on when you install the new thermostat. This is avoided by remembering to do things safely, like powering down the equipment you are working on before servicing the equipment.
But installing the thermostat is fairly straight forward, requiring knowledge of the HVAC system to determine whether or not the home had gas or electric heat, as well as the kind of electric heat provided. The wiring is a bit tedious.
I was working a larger smart home where the home had a Google Nest installed. The HVAC contractor did not wire the indoor or outdoor unit to accommodate the standard eight wire configuration, and so it was not NEST compatible. The Rheem unit had a $300 programmable thermostat that did not need all of the wires to function. The end result is that it locked the user into the Rheem thermostat, which was not programmable from an outside source and only had day-of-week functions. This was a shame, because a thermostat on a solar home should be able to adjust with solar production to better manage intermittent energy production and consumption. But in my case, I want a thermostat to be programmable by time of day, for each day of the entire year.
This is because my utility has a time-of-day rate structure. Which increases my electricity cost by 400% for 2-3 hours per day. It then decreases the rate for the remaining hours by 50%. So if I keep my peak use to a minimum, I could save a lot of money.
A programmable thermostat can help save money under a time-of-use rate, whereas a non-programmable thermostat cannot. Many programmable thermostats can be programmed by the hour and day of the week. But my summer peaks are from 3pm-6pm whereas my winter peakers are from 6am-8am, with weekends being offpeak. So I’d prefer a thermostat which can be programmed for each hour of the day, each day of the year, to avoid having to reprogram it every six months. But a simple “day of week” “time of day” thermostat could work as well, without being “smart” per se. The most important features are hours of the day and days of the week.
The cheapest programmable thermostat I found was $20. The cheapest smart option was a $40 Zwave plus thermostat and cheapest brand name smart option was $90. Most of the top shelf smart options ranged from $150 on up. I went with the $40 Zwave option.
Here is my thermostat within my home automation software. It has similar functionality to a nest. A wall-mounted tablet could serve as a dedicated controller for the thermostat, while also controlling the media player and lights in the room. To be clear, my Zwave plus thermostat does not have this level of control on its own. The “internet of things” has enabled this software to be applied to my $40 thermostat.
Within my smart home software, I have an automation menu.
I have an automation to turn the thermostat on and off between 6AM-8AM, which prevents my air conditioning system from running during those times.
The thermostat is programmed to turn off at 6AM, wait for two hours, and then turn back on at 8AM.
Smart wall plugs are similarly programmed, allowing me to turn my “always on” dehumidfier off during peak times. My refrigerator only runs 25% of the time. My hot water for winter coffee pre-heats at precisely 5:55AM to avoid peak use. 240V smart relays can similarly control a 40A electric tank water heater.
Controlling energy use in this manner can have substantial savings. By switching to my utility’s time-of-use metering plan, and using load shifting to reduce or eliminate my air conditioning loads, refrigeration load, and use the other 120V devices to assist, I can save about 20% on my electric bill without substantial changes in my lifestyle.
For my home automation platform, I chose Home Assistant. Home Assistant is an open-sourced, hosted on a local computer. It has a tremendous user base that provides active support on Discord. Other smart hubs are more limited in function or easier to use, but I like Home Assistant because it is free and has tremendous product compatibility. While it requires the user to learn some knowledge of computers, the flexibility from its platform means that smart energy controls controls can be economically installed as a retrofit onto any home to take better advantage of time-of-use metering.
But Home Assistant is just software. It needs some hardware to host it. The combination of hardware and software that hosts the smart home is called a hub. Some hubs require internet to function. Other cloud devices may communicate directly with a remote computer and not need a hub. Some hubs that benefit from internet connection can also work locally without internet. Some hubs have backup inernet connections, like security alarm systems. Throughout the entire process, the adage of the cloud device being the easier, cheaper, and more functional device whereas the local device is a more costly technical challenge to implement holds true.
So Abode is a security system and they sell a hub. The hub controls its security devices but does not let in other devices to communicate with it. It sets up its own proprietary wireless signal for device communication, connects with home phones and computers via wifi or hardwired ethernet, sends out alerts to optional third party monitors, has a backup data card for 3rd party monitoring, and can additionally work locally.
Some hubs can plug into other hubs. The Abode hub can plug into Home Assistant. Security sensors in alerts can trigger events in Home Assistant. But Home Assistant events cannot trigger the Abode alarm directly. Afterall, abode is a security hub. So for alarm systems, it can be useful to see which are compatible with popular smart home hubs such as Apple HomeKit, Google Nest, Amazon Ring, or of course Home Assistant.
But what do hubs really do? They manage specific devices and they have the hardware to communicate with specific devices.
I can host Home Assistant on a Raspberry Pi, which has a wifi antennae built into it, as well as a hardwired ethernet connection, hdmi outlet, and a few other useful ports. Raspberry Pi does not have a Zwave antennae, but these can be purchased externally and plugged into the Raspberry Pi.
Is the Raspberry Pi, with its limited computing power, a good hub? I would say that it is good enough for instantaneous monitoring, but there are a few things to consider. First, for energy visualization and data logging, additional hard drive space is needed. It might also benefit from a backup power supply.
So for a little more money, a smart home hub could be a small computer, or even a large media center on a UPS backup.
So some smart home peripherals may require more processing power than what the Raspberry Pi offers, and Home Assistant can be installed a dedicated computer instead. What is more important is how the network is designed, to ensure a system is not overly complicated.
I find the Zwave devices finicky and believe they would benefit from being preprogrammed into the hub offsite. At any rate, Zwave communication is not video or audio communication and so is realitvely easy on its weak modem. It can be overpowered, so it is best to not push Zwave to its limits. But it can network together a large number of devices, without connetion to the home wifi, meaning they can be preprogrammed offsite and ship out programmed with the hub. Wifi devices would then be added onsite.
Let’s talk through device registration within the context of smart plugs. These are power outlets which turn on or off based on a programmed command, such as time of day or as a function of electric load. This can bring smart intelligence to an otherwise dumb device. Sometimes the dumber the better.
My dehumidifier is smart plug is programmed to turn off during my time-of-use metering time frame. But I want coffee in the morning, and coffee requires hot water. My dumb electric kettle can be left unpowered but in the “on” position. This allows me to preheat my hot water at 5:50 AM right before time of use begins. A push button on the side serves as a manual override.
Registering a device to a hub is a common task. The hub is placed in an inclusion mode to accept the device. There is also a secure inclusion mode, which is a more secure communication for devices such as alarm systems or door locks. But the encryption slows down the communication. So I don’t recommend using Zwave devices for security devices and would instead recommend wifi, despit the hacking vulnerabilities.
That said, I have installed a Zwave door lock, and although it required I lug my custom built server up the stairs to do a close proximity secure pairing, the locks work just fine. The smart capability gives me a near infinite number of door lock codes, keys, and secnarios. But that could be done with a wifi door lock. In any event, the Zwave network has a maximum bandwidth and my energy monitors take up a healthy portion of that bandwidth, so I like using other hubs to process other functions such as security. This also means I don’t need to host Home Assistant on a super fast computer.
A Raspberry Pi is sufficient unless you have other computer needs, such as a media center or security server, at which point Home Assistant could be incorporated directly into the build.
Energy monitors are a very interesting space which has as much value at the commercial level as it does residentially. One of the greatest frustrations is how to get energy monitoring data from the monitor into the smart home system. Another frustration is to discover the monitor only transmits and records.
The hub needs additional software to store and display recorded energy data.
Lucky for us there are open source softwares that can expand the ability of the hub which are small enough to run on the Raspberry Pi. I use Grafana and InfluxDB.
The energy monitor itself is installed inside the electric service panel of the home, or adjacent to the panel if there is not enough room. They can be powered by a service panel breaker or a wall plug. As mentioned earlier, getting data from these devices can be a challenge. There are proprietary devices such as Sense which use wifi but are pricey. There are better products more tailored for commercial solar facilities, that are also pricey, and might require a hardwired ethernet connection which is not always readily available.
I like using Zwave for energy monitoring because I can purchase a generic Zwave service panel monitor that isn’t connected to any proprietary platform. In fact, it comes with absolutely no software and so it does not work out of the box. But it is $90 instead of $300. It also allows for wireless communication back to the hub without messing around with the site internet. My entire energy controller will only be connected to the internet system at the hub itself, reducing internet security concerns.
So far as NEC goes on service panel monitors, it’s evolving but the basics are still important. The consumption monitors can only go inside service panels if they do not fill more than 75% of a cross-sectional area of the box, typically a depth constraint. I think its best to plan a power circuit and conduit pathway somewhere near the to the service panel, if possible.
Here is a picture of a popular consumption meter Sense. Home Assistant is compatible with Sense. So the success of the time-of-use metering could be determined with Sense and there is no problem with that, other than it costs $300 and the actual hardware required could be had for 1/3rd of that amount. At the end of the day, end up paying for code or having to figure it out yourself is the choice.
Getting the cheaper device to communicate in a useful manner is another case entirely. It is actually quite easy to pair the energy monitor with Home Assistant.
First, the consumption monitor is installed inside the electric service panel. Because I rent, I am running the power monitor to an external power outlet. But it could just as easily be powered off an available breaker space. The user manual is consulted to confirm the orientation of the current-sensing transducer clamps, and it is noted that the power supply must be from first leg one of power. If the power outlet is powered by leg 2, I would reverse the clamp orientation.
The smart hub is then placed into inclusion mode. I am not using this hub for security devices, and so will not be using the pair secure option.
After inclusion, the device shows up as a “node” in the system.
When the device pairs, the first thing to do is relabel all of the entities which are created along with the node, which relate to the device just paired to the system. A simple “on off” switch like a window sensor might not have too many entities. An energy meter which measures and reports a wide range of data can have quite a few entities to relabel. Failing to relabel the entities results in a messy database.
The entities can be access and relabelled in a couple different menus. In this case, three entities are created. The energy monitor has two clamps. It is likely that one of the three energy meter entities represents the combination of data from the other two. Relabelling the entities to be properly numbered and identified on site eliminates guesswork when using these entity names elsewhere, such as in automations. So while it may seem tedious, relabeling these entities is critical. A nice thing about Z-wave networks is this work can be completed remotely before coming to site, so long as the hardware is staged offsite.
I do not know which of the three meter entities represents the power consumption of the whole house. I’ll create some cards in the user interface to show more information about the home consumption.
In addition to a direct numeric reading of the sensor, Home Assistant has a gauge view built in, which can change color visually as the power consumption rises. While it is not the only way to determine the data, I can easily see that Energy Meter Entity 1 is the whole house consumption, representing the combined data of Energy Meter Entity 2 and Energy Meter Entity 3.
Clicking on the entity, roughly an hour’s worth of real time consumption data is revealed. But I am not able to zoom, or view previous day’s records. Additional software will be needed for that data management. This is more of a real-time sensor read out.
But who cares. Right now the real value is in the available automations, which are fully programmable but also come with helpful suggestions to get started.
For example, to put the dehumidifier on a load-leveling mode, it is simply a matter of telling the smart plug to turn off whenever the whole house energy consumption exceeds 4000 Watts.
The same could be done for any 120V wall plug device. Every plug-in refrigerator, dehumidifier, water hear, and more can be fine tuned to stay within the parameters of a off-grid solar inverter, or a demand-based electric rate structure.
Almost immediately home consumption data is available. Knowing the home consumption is useful for demand management, such as on kW demand charges or off-grid living.
But to get the numbers in a nice display like this, logging to a database, we have to do some hacking. With open source projects, you can do alot of hacking. The end result is something cheaper or nicer than what previously exists. Many share this spirit and publish what code they have developed to assist your efforts. So that InfluxDB and Grafana are free open-sourced software with plenty of online instructions available as to how to set up with a Raspberry Pi.
If the set up is done correctly, then the data available within home Assistant should begin to stream into Grafana.
Now the idea of doing this technical programming may not appeal to you, and the price point of Sense may not appeal to you either. Consumption meters are helpful in visualizing energy use but not actually necessary to save under time-of-use metering. A simple monitor that tells you real time data may be all you need and that is not too complicated to get going without setting up a data base and logger for recording.
Let’s get back into our home energy controller build. There’s a few things we need to add to improve the overall system elegance. First, let’s add the room where the service panel monitor is installed as an area. It’s best to just add these areas as needed.
It’s sometimes nice to restart the home assistant server, from within Home Assistant. Our simplified home assistant installation glazed over a few steps, in an alternate install, the computer would boot to a command line interface and the user would start home assistant by typing in some commands. In this case, I want to populate Grafana with energy data, and read that InfluxDB needed a restart after installation to populate the database with the home assistant device data.
InfluxDB still isn’t working, and I suspect it’s because I skipped an instruction which told me to edit a configuration.yaml file. This is another file which is hidden outside the Home Assistant user interface. However, I installed a Configurator Add-On which allows me to edit the configuration.yaml file from within Home Assistant. I add in the InfluxDB code into the configuration.yaml file and restart the Home Assistant server.
Now that I have given Home Assistant the ability to recoginze InfluxDB by editing the configuration.yaml file, when I go to make a Grafana Query, my home assistant entities are available. What can I do with this information? The obvious choice is to create an energy graph.
Let’s start by graphing the energy meters. I do this by creating a dashboard within Grafana. I need to select the data source for the graph. Home Assistant is an option because of our past efforts.
The query is a formula to display on the graph. I would start by changing nothing about what is presented, but instead adding a variable to the formula, I add the power meter entity for the whole household, which was the primary energy meter entity in Home Assistant from earlier. The data still looks incomplete.
Sometimes, with these devices, things appear to be plug and play, but they still need some slight programming modification to fit a specific need. For example, Zwave is a network that can support a little more than 250 devices, but one energy monitor reporting its data every ten seconds can take up 20% of a Zwave plus bandwidth. But for our needs, we want granular energy data because we can use it to monitor the success of our load controls, as well as implement our own load-based energy control system.
So because something looks amiss, I go into the Zwave configuration panel to inspect my energy monitor device-specific configuration options.
Again, I could get further into the technical detail of what each individual byte of data represents. But to solve this problem, instead, I performed a google search and found the settings of somebody else installing this energy meter onto Home Assistant. The solution was basically to find the reporting settings within the device and set them to a 5 second reporting period. I then set my grafana graph to a 10 second interval. These changes result in a higher resolution energy graph.
I could spend a good bit of time customizing this graph, as well as inputting all of the smart home devices I have which are energy sensing. For example, the wall plug used to control the dehumidifier will often have an energy sensing option associated with it, which might cost a few dollars more than a smart wall plug without such feature.
Finally, I upload my energy graph to the internet to embed onto my website.
Let’s clean up the home assistant view a bit by taking control of the overview page.
I don’t want my media players to be the first thing I want to display with my energy controller, so I create a new tab for my media players, called a new view by Home Assistant, and then select the option to move these entities to the new view.
I also take the web link of my energy monitor graph and embed it as an iframe.
To clean up and remove some of this data, I use the code editor, which gives me a behind the scenes look at some of the code, and is a bit quicker than the visual interface.
My energy controller interface is now complete, with some automations programmed.
Let’s review again the economics of implementing digital load controls onto a home or business. Today we assembled an entry level load controller for a total budget of around $350. So let’s assume a total professional budget of $850 by a licensed contractor, with the understanding that a do-it-yourself project would be much cheaper. Let’s also assume that an entry level commercial project would be twice that at $1700, and imagine a more audacious commercial project at $20,000.
At the residential level, the best step for energy savings is to identify the ability of a time-of-use rate structure. Time-of-use rates will lower your electric rate for most of the week, but increase it significantly for a few peak hours of the day.
My electric cooperative has a good time-of-day rate structure, and even a six month guarantee that any cost increases would be refunded. In the summer between 3 p.m. and 6 p.m. Monday through Friday, I have a peak rate and an off-peak for all other times. In the winter, peak is only a two hour period in the morning, again on weekdays only. Without time of day metering I get a flat rate of nine cents per kilowatt hour, and with time-of-day during the peak period the electric rate quadruples to 36 cents, but during off-peak periods the electric rate is cut in half down to 4.5 cents per kilowatt hour.
So three hours a day, five days per week is nine percent of the year. It’s called peak for a reason, so let’s fudge the numbers a bit and assume that 10 percent of my energy use comes during this peak time. I’d call that a worst case scenario event, for example if the time of use rate extends for a longer period of the day, or certain high energy activities such as intense electric cooking cannot be avoided during a shorter, more expensive peak time.
So if my peak load is a little higher than my average off-peak load, then by increasing my peak rate by 400% and then reducing the off-peak rate by 50% for the remaining for 90 percent of my usage, all of that will ultimately decrease my rate by 5%.
I could achieve greater cost savings by implementing stricter energy controls, such as turning off the thermostat and refrigeration entirely, to see how long existing thermal mass in the home can coast while using the least amount of electricity possible. Filling a freezer or refrigerator up with thermal mass, such as bottles of water, can assist this effort for the so inclined. By implementing the measures discussed in class, such as thermostat controls and shifting the dehumidifier, my electric savings could be 30%, out of a maximum savings of 50%.
Calculating the savings of time-of-use after the fact is simple. The electric bill still contains the total amount of electricity consumed, so it is easy to multiply that amount by the old flat rate to and compare against the current bill.
It is a bit harder to predict load shifting savings in advance, but there is a software which can help. EnergyToolBase is a commercial software, which is essentially a glorified spreadsheet intended to calculate electric bill saving, with an intended audience of solar or batteries. It’s not anything you can’t do on your own, but it is a quick way to graph out the energy use of the system.
For example, in this example below, the building is revealed to have spiky peaks. If this were a commercial building, being billed not based on time of day, but on peak demand, those spiky peaks are perfect times for an automated load-leveling system to take non-critical loads offline. Even expensive lithium ion batteries can be cost effective at this sort of load-leveling, so cheaper digital controls are all the more cost-effective.
I model my time-of-use-rate within EnergyToolBase, because it does not have my rural cooperative’s time-of-use rate in its database. This is unusual, as it is the market leader in electric rate structuring. A similar spreadsheet could be programmed in Excel or Google Sheets.
If I have interval data, such as the data now stored in my home automation data logger, I could upload it to energytoolbase. That would provide greater insight into time-of-use energy usage than guessing the peak use based on monthly electric bills.
If I don’t have access to this data, then I essentially need to guess at how much of my energy is peak verses off-peak.
Now I can select between the flat rate and time-of-use rate to be more accurate with my projected savings.
I opt to model three use cases, the first is my current electric bill under my current rate, the second is the cost savings if I dip get my time-of-use peak to equal my off-use rate, and lastly if I how much I could save with 50% further reduction in my peak load. I found is that by doing basic thermostat controls and energy automations, I could expect to save about three hundred dollars a year, and if I implemented more aggressive digital controls, I save another two hundred dollars. Both models assume some peak energy use, which could only be fully eliminated with a battery and perhaps a solar array.
So that’s that’s kind of interesting. There are many who want solar power, but can’t afford the tens of thousands in investment as well as the long term payback. A smaller investment in smart home energy controls would result in a 1-2 year payback, while adding home automation value beyond electricity controls.
Cost savings of $25-$40 per month on a $160/month electric bill by doing nothing but shaping the home electricity automatically is pretty impressive, I think. The payback on a $350 DIY project could be under one year. On a professional installed project, a 2 to 3 year payback is likely.
On a commercial electric bill, the savings become even greater. A small commercial facility might be incurring a $10/kW demand charge on all power above 50kW.
Imagine the same energy controller, with a few more smart plugs and a small number of three-phase 40A switches, costing $2000 to install.
There are some other energy control devices useful to note. Here is a 40 amp relay, which is perfect for electric water tanks and other 240V double pole breaker loads up to 40 amps.
So far we have been talking about automation for residential energy savings, but now is a good time to consider the merits of heavy amp controllers.
Imagine a hotel owner has a series of ten 240V wall air conditioning units. Let’s imagine that these 5kW units, most of which are running during times of peak demand. Imagine then if we could reduce the load peak load by four units, by installing ten controllers and timing the units to power cycle in an organized manner.
The demand savings of four units at 5kW each is 20kW. At $10 per kW, the demand savings is $200. If each control switch were installed for $200, the project would have a 10 month payback.
If the hotel owner wanted to be more aggressive in his savings, he could turn all the air conditioners off during peak times, resulting in a little more discomfort for the guests but perhaps a windfall of savings. Another 50% increase in cost savings would push the payback down to 5 months.
In other words load digital controls can be the cheapest way to reduce a facility electric bill, regardless of whether it is a residential or commercial customer.
There are a million things left to talk about within low voltage automation, but this program is coming to a close. So I will spend the rest of our time together talking about some smart home products which represent a clear increase in inhabitant health safety and welfare,
Then I will finish with how load control is adding value to owner of the Tesla PowerWall.
Originally, I thought it would be a good idea to fill my smart home with data collectors.
However, smart homes aren’t perfect and it is possible to get carrier away in new construction. A smart home doesn’t do anyone any good if it isn’t functional. I found that many devices capable of sensing multiple inputs such as motion, temperature, and humidity were most often used for one specific purpose. The other sensing portions of the device were an unnecessary drain on the battery. I would not get too carried away with battery powered devices.
Smart Smoke Alarms are interesting because they can alert both the user and the fire or police department to the immediate location of the problem. I have found the carbon monoxide detector in the kitchen to give me air qualify alerts when the oven is being cleaned. This information is fun, but it comes with a cost. As annoying as it is to change smoke alarm batteries, it is even more annoying to reinclude them with changes in home monitoring preferences. Pairing them into the security hub can result in false alarms being phoned into the fire department, But failing to pair them into the security hub means they will only function as a local alert. I recommend a hardwired power supply to these devices if possible.
Actual wall switches, I was less impressed with. My recommendation would be to use full switch substitutes rather than installing the add-on “behind the switch” controllers. Likewise the touch controllers are either quite expensive or somewhat finicky. This wall remote for example, is like a magic wand for the home, capable of being programmed to do anything. But because it is battery powered, it needs to be “woken up” before being used,
so it doesn’t really function as a good light switch. It would be better at initiating modes such as locking up the house for the night.
A few months ago, a company called Span.Io made a splash as advertising itself as a smart electric service panel, staffed up by Tesla alumns. They are not the only ones in this space. Lumin, Levitron, and either more mainstream brands like Schneider and GE have advertised their own forms of smart electric service panels.
Service panels are tricky, because they are not really designed to be fed from multiple services, such as a generator and the grid concurrently. Home loads are tricky because they can be quite spiky. The electric grid itself helps average all our spiky loads together to make a steady, smooth demand curve.
The problem with backup solar batteries is that without managed electricity, the output power necessary to power an entire house is quite large. One heating element inside an otherwise energy efficient air conditioner can carry represent a 15 kilowatt load. A residential electric service panel is rated for nearly 50 kilowatts. Just the control electronics needed to output that much power from a battery can exceed $20k.
In other words, the Tesla PowerWall, at its $14k suggested installation price, is actually too small a battery to power the whole house. And we saw where that can be okay from an economics perspective, such as to take advantage of time-of-use metering or demand management.
But if the grid goes out, and the building has a solar array or Tesla power wall on it, and the building loses power during that grid outage, the inhabitant is going to be aggravated. The industry currently solves this problem by wiring up smaller critical load panels to remain powered up during grid outages. But the best solution would be to install an automatic transfer switch between the home and the grid, and then manage the home’s electrical load such that the entire home can remain powered.
So some of these companies control and monitor every load on the electric service panel, or a portion thereof, and it end result is a very expensive system that might also add value to other very expensive things. But by building a site energy manager, either with expensive or more modest results, the same system that saves money while being connected to the grid can allow for onsite backup power for the whole building during an emergency while the building is powered by an undersized generator, such as an onsite solar battery.
As a final note, there is one Z-wave accessory that might appear optional but I strongly recommend it, which is a range extender. Z-wave does not have the range that is advertised when being used to transmit data-rich signals. A non-critical sensor, such as one located on a mailbox to notify the home when the mail has arrived, might be able to transmit a Z-wave signal over its full range while taking time. Energy signals which need updating every few seconds put more noise into the Z-wave than a simple on/off sensor.
Although Z-wave devices are intended to be repeater stations (and only hard-wired Z-wave devices actually serve as repeater stations), a dedicated Z-wave repeater station reduces the stress of worrying about the quality of the Z-wave network. I strongly recommend using one unless the hub is located in the utility room near the service panel monitor.
If you liked this program and want your own Raspberry Pi energy controller, why not buy one from me? I pre-program these things over at Levll.com .