Tag: z-wave

How to add a GE Z-Wave Smart Switch (1 gang) to your Home Assistant system

In this post, I will show you how to install a single GE Z-Wave Smart Switch (1 gang) to your Home Assistant system.

I am not a licensed electrician, so take my advice only as an amateur DIYer. If you are uncomfortable re-wiring a switch in your home, call an electrician to install the switch for you!

There are 2 ways to automate & control the lights in your house. You can either control the lights via the switches or via the bulbs themselves. Controlling the bulbs means buying very expensive replacements like the Phillips Hue. These give you the ability to have hundreds or more colors and lots of different options. However, you must leave the switches for these bulbs on all the time.

However, I prefer to just replace the switches in my house and keep my existing dumb CFL or LED light bulbs. For me, it is very important that lights keep working as normal, even if Home Assistant (or some other automation system) is unavailable. If either Home Assistant or some cloud service is down, I still want my switches to work as they always did. If I have someone over, I don’t want them to have to figure out my smart home system; they should just be able to turn the lights on and off as they always have. In addition, I haven’t seen much use in having the ability to change the colors of my bulbs. This may change in the future, but for now, that’s what I have decided to do.

Here are the tools and devices you will need to do this installation (affiliate links below).

There are 2 primary steps in this installation.

  • Replace the old electric switch with the new smart switch
  • Register your new smart switch with Home Assistant

Replace the old electric switch with the new smart switch

I am not a licensed electrician, so take my advice only as an amateur DIYer. If you are uncomfortable re-wiring a switch in your home, call an electrician to install the switch for you!

I cannot stress this enough. You can absolutely electrocute yourself or start a fire if you don’t do the electrical job correctly.

For simple jobs, I feel confident in my electrical ability to replace outlets, switches, etc. I have absolutely called in a professional electrician for complex jobs (like when I had a short in my bathroom GFCI outlets and they kept tripping). There is no shame in admitting when you need a professional to do a job!

If you are willing to keep going, then you need to turn the power off to the circuit that powers the switch you want to replace. Obviously, you could turn the power off to the whole house, but that would be silly! 🙂

This usually involves turning on the switch you want to replace (so the light is on), then start toggling the breakers one by one until the light turns off. To make this easier, I have found a very useful tool to determine which breaker controls which circuit in my house. I recommend you purchase a Klein Tools Digital Circuit Breaker Finder. You plug this device into an outlet that is on the circuit you want to find, then you use the included tester on each breaker until you find the one that matches. How it works is that it sends out an electrical signal over your internal power wires and it is received by the tester in your breaker box.

This is not a foolproof way of testing electric switches because it is possible your outlets in a given room are not on the same circuit as the lights, but it is a good possibility. As always, your mileage may vary and you should still test the light switch yourself to ensure it does not work anymore after you disable the breaker.

Now that you have disabled the circuit that powers the switch you want to replace, you can remove the old switch. Remove the 2 screws that hold the decorative faceplate on and then the 2 screws that attach the switch to the electrical box. Pull the electric switch out and look at the wires.

At a minimum, you will see 2 wires (usually black, but this is not guaranteed). These are known as the “line” and “load”. The “line” is the wire from your electrical breaker box and supplies the power. The “load” is to the device you want to power (lights, fans, etc). This is important because the smart switches must be installed with the correct wire inserted into the correct receptacle on the smart switch or it will not work.

This next step is where your mileage will vary considerably depending on the age of your home and the quality of the wiring job the contractor did when they built and wired your home. To install the GE Z-Wave Smart Switch (and most other smart switches), you must have 2 other wires. You must have a “neutral” (usually white, but not guaranteed) and a “ground” (usually copper and uninsulated, no plastic insulation around the wire). The colors of the wires are absolutely not guaranteed. Color coding has not always been the standard and there is no guarantee the contractor used the correct colors even if it was code (you must test the wire to be sure which is which). The typical skinny toggle switches many homes have don’t usually require a ground or a neutral to function, so many homes won’t have it. However, in order for the Z-Wave antenna to function, it must be powered at all times. This is the function of the “neutral” wire. It completes the circuit from the “line” so that the Z-Wave antenna is always broadcasting and receiving.

If your electrical box doesn’t contain a neutral wire, you cannot install this smart switch. There are certain kinds of switches that don’t require a neutral, but I have never tested them, so I can’t make recommendations at this time (however, my attic switch doesn’t have a neutral, even though the rest of my house’s switches do, so I will eventually find out).

Take a picture with your phone right now so you know how it was originally installed (both to make it easier to identify the various wires and so that you can restore it the original condition if you need to give up for whatever reason).

Remove each wire from the old light switch and separate them carefully so none of them are touching each other or anything else.

You need to identify which wire is the “line” and the “load”. This can be done using a Klein Tools Electric Voltage Tester. This will let you know which of the wires is “hot”. The “hot” wire is the “line” because it comes directly from the breaker box and always has electricity flowing through it.

Go back to the breaker box and turn the power back on. Now go back to the exposed wires and begin “testing” each one with the leads from the voltage tester. Put one of the leads on the “ground” (exposed copper) wire and begin testing each of the other wires (probably black) to determine which one is “hot”. The tool will flash 120 and buzz when it detects electricity in the line. This will be the “line”.

Turn the breaker for this circuit back off so you don’t electrocute yourself before continuing!

Take the “line” wire (probably black) and plug it into the “line” receptacle on the smart switch (probably in the bottom left-hand side when looking at the back of the switch). Tighten the screw on the side tightly to ensure the wire can’t fall out (tug on it lightly to ensure it is firmly held in place).

Take the other wire that was originally plugged into the switch, the “load” (probably black), and plug it into the “load” receptacle on the smart switch (probably in the upper left-hand side when looking at the back of the switch). Tighten the screw.

Now insert the “neutral” wire (probably white) into the “neutral” receptacle and tighten the wire. In my case, there was a pigtail with the neutral wires, so I removed it and plugged both of the neutral wires into the switch to complete the circuit.

Now you need to plug the “ground” into the switch. The ground wire protects you from electrical shorts by providing a path of least resistance to the “ground”. In my case, my ground wire was twisted together, so I needed to add a “jumper” wire (14 gauge) to make it easier to ground the switch (otherwise, the wire would have been very short and it would be too easy to pull out).

Now you can test the switch to see if you did the wiring correctly. Go turn the breaker back on. Begin toggling the switch. If you have wired everything correctly, toggling the switch up will turn on your lights. Toggling the switch down will turn the lights off. You will also see a small blue LED light when the switch is off. If you don’t see the blue light and the switch doesn’t turn on the lights, go back and carefully check which wires are plugged into which ports on the switch. If you hear crackling or popping, turn the breaker off and tighten all of your wire connections.

Now carefully push the switch back into the electrical box and replace the screws that hold it to the box. Then, put the new decorative faceplate on and tighten down the screws.

Congratulations, you have now installed the switch and can use it as a normal light switch.

Add the Z-Wave switch to Home Assistant

Link to Home Assistant documentation.

  • Navigate to your Home Assistant GUI in the browser
  • Click on Configuration
  • Click on Z-Wave
  • Click on Add node
  • On the Z-Wave smart switch, press up or down to put it in “pairing” mode
  • Click the Heal Network button. This will cause all of the Z-Wave switches to “report in” with the controller and it will optimize the routing of Z-Wave signals through your Z-Wave network.
  • Your Z-Wave switch is now added to Home Assistant

The next step is highly dependent on your individual configuration. If you are just starting out, you should see the switch added to the home page. If you have started enabling groups, you may not see new entities that have never been added before.

  • Click on the Unused entities button in the upper-right hand corner of the home screen (in the hamburger menu)
  • Toggle the switch to see if everything is set up correctly
  • Click on the name of the switch to rename it
  • Click on the gear
  • Click on the name override and give it a descriptive name
  • Click on the entity ID and give the name you will use to refer to it in the YAML files
  • Click Save, then click on the back arrow, then X

Now you need to add it to a group so it will show up in Home Assistant (this step may not be required for your setup)

  • Connect to your Raspberry Pi using Putty
  • Open the configuration.yaml file
  • Check to see if you have groups enabled

When you start using groups, you need to add every device to a group for it to show up on the home screen.

  • Open the groups.yaml file
  • Create a new group kitchen_hidden and list your outlet using the name you defined above. This is needed because the Home Assistant GUI will not show nested groups together in the same page if they are both shown. Note the control flag is set to hidden to hide the group from the GUI
  • Create a new group kitchen that you will use to create a new page in the Home Assistant GUI. Note the view flag is set to yes to show the group in the GUI
  • Optional, add your master_bedroom_hidden group to a “downstairs” group
    (mine will have more entries than yours, customize as needed)
downstairs:
  name: Downstairs
  entities:
    - group.lamps_hidden
    - group.kitchen_hidden
    - group.master_bedroom_hidden
    - switch.front_door_outdoor_lights
    - switch.front_door_entryway_lights
  view: yes
kitchen_hidden:
  name: Kitchen
  entities:
    - switch.kitchen_table_light
  control: hidden
kitchen:
  name: Kitchen
  entities:
    - group.kitchen_hidden
  view: yes
  • Save and close the file
  • Go to the Configurations tab in Home Assistant and click General
  • Click Check Config to ensure you didn’t make a mistake in the yaml files
  • Click Restart to update the running Home Assistant with your new groups
  • Refresh and go to the home screen
  • You will see your new tab at the top with the switch inside it
  • You will also see the new group added to the Downstairs tab as well.

That’s it! You have now successfully added a Z-Wave switch to Home Assistant.

How to set up a Z-Wave network for your home automation

If you have been following along, you now have a Hass.io installation setup up and ready to begin creating automations.

As I said in my article about deciding on your home automation setup, you now need to set up the Z-Wave antenna so your various home automation equipment can talk to your Raspberry Pi and the Home Assistant software.

I recommend the Aeotec Z-Stick Gen5, Z-Wave Plus USB (affiliate link), but you theoretically can get any Z-Wave antenna and it will work.

  • Plug this USB device into your Raspberry Pi (and restart just to be safe).
  • Login to the Hass.io configuration using Putty
  • You need to figure out what the USB drive is called on your installation. Run the following command.
ls /dev/ttyACM*
/dev/ttyACM0     <-- this is the most common name, but yours may differ
  • You need to tell Home Assistant that it should expect to see Z-Wave communication on this device.
  • Open the configuration.yaml file using vim
vim configuration.yaml
  • Scroll down to the bottom of the file and enter the following command. Save and close vim (:wq)
zwave: !include zwave.yaml

This command will tell Home Assistant to look enable the Z-Wave component and to look for its configuration in a separate file in the same directory as configuration.yaml called zwave.yaml.

  • Create a new file using vim and enter the name of the Z-Wave USB stick you found before. Save and close vim.
vim zwave.yaml
usb_path: /dev/ttyACM0

Now, you will begin to “test” your configuration before actually running it. It is very easy to mess up the format of the .yaml files and cause Home Assistant to not start.

Luckily, Home Assistant has an easy way to check to see if configuration files are valid.

hass --script check_config -c /config

This tells Home Assistant to scan all of the .yaml files and see if there are any configuration issues that would cause it to not be able to restart and load. In typical Linux philosophy, if it reports no status, everything is good. This is because Linux “pipes” the output from one command to another and “chatty” output messages make it harder to pipe commands together.

You can also do this in the Home Assistant web portal.

  • Navigate to the web portal
  • Click on Configuration
  • Click on General
  • Click on Check Config
  • You will get

If everything is good, you will see a green “Configuration valid” message.

You can either reboot the Docker container or use the GUI. Note, as you add more and more automations, this will slow down (several minutes to reboot). This is why the GUI has options for just reloading pieces of the system.

exit            
whoami <-- make sure you are the "pi" user outside the Docker container
pi
sudo docker restart homeassistant
homeassistant

After Docker reports success (by printing out homeassistant), you will have to wait a few minutes for Home Assistant to finish loading.

  • You need to push you new changes to Github so they are saved. Log back into the Docker container and check the status of the files
sudo docker exec -it homeassistant /bin/bash
  • Check the status of your modified configuration files.
git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
        modified:   configuration.yaml
        modified:   zwave.yaml
no changes added to commit (use "git add" and/or "git commit -a")
  • Add these files (stage them) to your git changset so you can commit them.
git add *
git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        modified:   configuration.yaml
        modified:   zwave.yaml
  • Commit the changes
git commit -m "Added zwave"
  • Push your changes to Github
git push

You are now finally ready to begin adding devices to your home automation!

Deciding on a home automation system

The first step to building your own home automation system is deciding what the major components will be. There are so many choices and so many different vendors that it can be overwhelming to decide what to do first.

I believe the right philosophy is to standardize of a few key technologies and build out using those. I have included affiliate links to the various pieces of hardware I have purchased and am using in my own home.

Some of the major technologies you need to decide on are:

  • What hardware will I use?
  • What hub will I use to control “all the things”?
  • What wireless communication protocol will I use?

Summary (i.e. get this)

Hub

The most important decision is what hub you will use to control your home automation. This is the most important decision because it will drive every other decision. You will have to decide what your goals are, how flexible the hub software is, how many integrations the hub has with 3rd party components and what kind of support you expect from the vendor.

Some of the major hubs are:

There are some additional hubs out there, but a key issue with them is the lack of integrations or lack of long term sustainability. A key place this could bite you is if the vendor decides to shut down support for their hub. This will kill future integrations and may completely shut down your home automation (if the hub depends on services the vendor must provide, like a cloud-based server). An example of this is the Lowe’s Iris system.

In my case, I wanted an open source system that was not dependent on any one vendor. This is mostly because I am software developer, so I have no fear of having to dig into the guts of the software and make tweaks (just ask my wife how many times I have had to dive into the PHP of her WordPress site to fix some odd bug!). The open source model helps ensure that the platform has long-term staying power because it is maintained by deeply interested people who work on it out of their free time. This also increases the likelihood of integrations working no matter what vendor is involved. Naturally, Amazon, Google & Apple don’t really want integrations between their various ecosystems because it is in their interest to keep you locked into their platform.

Therefore, for the ability to tinker with and see the source code, to increase the likelihood of long-term sustainability and have maximum integrations, I choose Home Assistant.

Hardware

You will have to decide what hardware you want to use to host your hub. In many cases, this will be decided for you (Alexa runs on an Alexa device like Echo). For Home Assistant, you will have to decide what hardware to run your hub on. The most common configuration is to run it on a Raspberry Pi. You can easily buy any number of Raspberry Pi kits, I choose a kit made by Canakit, which makes many different kits for different use cases. I ended up buying a kit on Amazon, since I already had a Prime membership

Wireless communication

Finally, you will have to decide what wireless communications protocol you will want to use for your home automation equipment. Unless you are doing new construction, running lots of wires throughout your walls is probably not in the cards. Therefore, you will need wireless communication.

Many of the smart home devices you can buy tout their WiFi capabilities. This is supposed to be seen as a feature. I see this as a bug. WiFi was not meant to be used to handle the dozens of wireless communications of simple home automation equipment. Most people’s home routers cannot handle more than a few dozen clients (Linksys actually sets this at 50). You typically don’t want that many clients anyway, not without more substantial wireless hardware (Ubiquiti is my preferred home networking system and I will write a later blog post explaining why and how I have their equipment set up in my house).

Obviously, the industry has been dealing with this for a lot longer than the recent Smart Home craze, so there are 2 primary wireless protocols that are used, Z-Wave and Zigbee. Both of these are low power, wireless protocols that can be used to control smart home devices. Many vendors, in fact, sell different versions of their products that support one or the other. In general, I don’t see a compelling reason to choose one over the other; you can decide which one you prefer based upon the devices you would like to control. Z-Wave, in my mind, has better industry support and standardization, so that is the protocol I chose for my smart home devices. This is not to say that I won’t ever use Zigbee. I may eventually come up with a compelling use case or device, but I haven’t had to yet.

Therefore, you must have an antenna connected to your hub that can send and receive your given protocol. Many of the commercial hubs have this antenna already built in. In my case, since I went with the open-source Home Assistant system, I had to buy a separate Z-Wave USB stick to plug into my Raspberry Pi. I choose the Aeotec Z-Wave Gen 5 USB stick.