I bought a Tesla Model 3 last year and it has been the best car I’ve ever owned, by far! Feel free to use my referral link if you want to purchase one also and get 1000 free Supercharger miles.
One of the best parts of owning it is that it never needs to be filled up for most daily driving. I don’t have to wonder if I have enough gas to go do daily chores. It charges up every night and is ready to go every morning.
This means that you have to remember to plug the car in every night. Normally, I plug it in when I get home from work (even though it is not scheduled to charge until later in the night). However, there are times when it doesn’t get plugged in for whatever reason (kids throwing a fit as soon as we get home, for instance).
I needed a way to make sure I always plugged the car in so it would charge during the night. Luckily, this is a simple automation in Home Assistant.
First, you need to configure the Tesla integration. This will give Home Assistant the ability to query your car to see if it is plugged in. It also gives you a lots of useful metrics about your car in the dashboard. Fun aside, my kids were so impressed with the speed of the car compared to my truck that they named my car Red Rocket! Therefore, lots of the entities have some reference to that name.
You can add the Tesla integration by clicking on Configuration then Integrations.
Click on the Add button in the lower right-hand side and search for Tesla.
Enter your Tesla.com username and password. Ensure the integration is able to successfully login to your Tesla account.
After the Tesla integration is finished configuring, you will see a large number of new entities. You can view them by searching for the Tesla integration in the Integrations page and clicking on Entities (I have renamed some of mine to make it more obvious what they were, so your entity names will vary).
The most important one for our purposes is the binary_sensor.red_charger_sensor as this one indicates whether or not the car is plugged into the charger.
Now that we have Home Assistant configured to communicate with your Tesla, the automation code is easy to write. In your automations.yaml file (or the GUI if you are so inclined), you will need to add the following code.
- alias: Notify if Tesla not plugged in at night
initial_state: True
trigger:
- platform: time
at: "19:30:00"
condition:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.red_charger_sensor
state: 'off'
- condition: template
value_template: "{{ is_state_attr('binary_sensor.red_parking_brake_sensor', 'shift_state', 'P')}}"
action:
service: notify.notify
data:
message: "Tesla Model 3 not plugged in!"
title: "Alarm"
trigger – This automation will fire at 7:30 PM every night (if I am still at the office by this time, I am working too hard!).
condition – I need to both check both that the Tesla is not plugged in (by virtue of the binary_sensor.red_charger_sensor being in the off state) and that the car is in Park (as indicated by the binary_sensor.red_parking_brake_sensor.shift_state being equal to P). I don’t want this automation to go off if I am driving.
I could have added a check to make sure I am home, but I still wanted the reminder in case I am traveling and need to ensure the car is plugged in.
action – I use the default notify.notify since this will send a notification to both my phone as well as my wife’s phone.
As you can see, this is a simple automation to add, but it has saved me from not having a charged car many times.
A common request is to be able to monitor your home computers using Home Assistant. It is easy to monitor basic machine information on the machine that you have installed Home Assistant on (using System Monitor).
A much more powerful way is to use Glances. Glances is a cross-platform system monitoring tool written in Python.
There is already a pre-built addin to make it easy to monitor the machine Home Assistant is running on. However, this doesn’t let you monitor a remote machine (not the same machine your Home Assistant is running on).
I have a Windows PC on my home network (to play games do work on). I would like to monitor this machine from Home Assistant.
Here are the high level steps we will go through.
Install Glances on the remote Windows PC with pip
Test Glances locally
Create a Windows Scheduled Task to run Glances on login
Open the Windows Firewall port so Home Assistant can communicate with the local Glances service
Add a new Glances Integration in Home Assistant
Add new Glances sensors to UI
Install Glances on the remote Windows PC with pip
You will need to install the Glances Python program onto your Windows PC. The easiest way to do this is via the command line. You can easily install the Glances application using the Python package manager called pip.
Follow the instructions on the Glances GitHub page for your platform. Since I am running Windows on the machine I would like to monitor, I can run the following command. Obviously, you must have Python & pip installed on your Windows PC.
NOTE: You must install Glances as Administrator. Open the Windows Powershell command prompt as Administrator.
pip install glances
Test Glances locally
Now that you have installed Glances, we need to ensure it is working. In the same Administrator command prompt you just opened, run the following command to start up Glances manually.
glances -w
This will start the local instance of Glances so you can test it. You should see a window that looks like this.
You can now open a local browser and see the Glances GUI. Navigate to the following URL.
http://localhost:61208
Create a Windows Scheduled Task to run Glances on login
Now that you have installed Glances & tested it, you can create a Windows Scheduled Task to run it. This is needed because you want Glances to always be running in the background, no matter who is logged into the PC.
Open the “Task Scheduler” as Administrator by searching for it on the Start Menu.
In the Task Scheduler GUI, on the right-hand side, click on “Create Task…”
On the General tab, set the Name to “Glances” and set the Configure for to “Windows 10”
On the Trigger tab, click New. Set the Begin the task to “At log on” and set the Delay task for to “15 minutes” (customize as needed). Click OK.
On the Actions tab, click on New. Set the Action to “Start a Program”. The most likely location for Glances to be installed is “C:\Python27\Scripts\glances.exe” (your mileage may vary). Make sure to add the “-w” argument so it starts in “web server” mode. Click OK.
You can set any other settings you want to or your can just click OK to finish. You will now see the “Glances” task in the Task list.
Click on the Run button on the right-hand side of the window to force it to run now. Close the Task Scheduler.
Open the Windows Firewall port so Home Assistant can communicate with the local Glances service
Most likely, you will need to open a Windows Firewall port in order to allow Home Assistant running on another computer (a Raspberry Pi, for instance) to communicate with the locally running instance of Glances.
Open the “Windows Defender Firewall with Advanced Security” as Administrator by searching for it on the Start Menu.
Click on Inbound Rules on the left-hand side of the window. Click on New Rule… on the right-hand side of the window.
Set the Rule Type to “Port”. Click Next.
Set the Protocol to “TCP” and the Specific local ports to “61208”. This will allow incoming requests to be received by your local instance of Glances on this port only. Click Next.
Set the Action to “Allow the connection”. Click Next.
Make sure the Profile is set to only allow Domain and Private, not Public. This is because you don’t want Glances to respond to requests when you are not connected to your home network (since why would a public network (like a coffee shop WiFi) be trying to communicate with your computer over this port. This would most likely be a hacker scanning all available ports to see what responds. Click Next.
Ensure local network is Private (Optional, may not be needed for your network)
An issue I had was my home network was not set to Private for some reason. I was able to fix this by opening the Registry and setting the appropriate network to be Private instead of Public.
Note: there are ways to set this via the Control Panel Network settings, but these GUIs never worked for me. Therefore, I fell back to modifying the Registry. Use at your own risk!!!
Open “Regedit” as Adminstrator and navigate to the following key.
Under the Profiles key, click on each one in turn until you find the one that is your home connection (look at the ProfileName key). When you find it, double-click on the Category key and change the value to 1 (meaning Private). Close Regedit.
Give the new Inbound Firewall rule a Name “Glances” and click Finish. Close the Windows Firewall GUI.
Add a new Glances Integration in Home Assistant
Now that we have installed Glances, set it up to run automatically (and forced it to run now) and opened the Windows Firewall, we can set up Home Assistant.
Navigate to your Home Assistant home page and click on Configuration then Integrations.
Click on the orange New button at the bottom-right side of the page.
Search for Glances and click on the item.
Change the Host to the IP Address of your Windows PC (you can get this by running ipconfig from the Windows command line). My local address is blanked out in this screenshot. Click Submit.
Assuming a connection is made, you will see the new Glances integration in the list. Click on it. You will see all the new sensors that have been added to Home Assistant.
Add new Glances sensors to UI
Finally, we need to add these sensors to the Home Assistant UI so we can see the results. I am going to add them as simple badges.
Open up your lovelace YAML file (mine is broken up into different pages per tab) and add the following code.
In this post, I will show you how to install a GE Z-Wave Smart Switch & a GE Z-Wave Fan Control Switch (2 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!
Here are the tools and devices you will need to do this installation (affiliate links below).
Replace the old electric switches with the new smart switch
Register your new smart switch & fan switch with Home Assistant
Replace the old electric switches 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 3.5 wires (usually black & red, but this is not guaranteed). These are known as the “line” (black), “light” (red) & “fan” (black). The “line” is the wire from your electrical breaker box and supplies the power. 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. The 0.5 wire you see in my picture provides power to both switches (line) with a single wire (instead of 2 separate wires linked together with a wire nut).
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 these smart switches. 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.
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” since this wire has power from the breaker box. 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!
Because of the complexity of this box (so many wires!) you will likely need “jumper” wires to complete the circuit. These can be either 12 or 14 gauge wire. Buy a spool, cut off about 3 inches and strip the ends.
In hindsight, I should have used the correct color for the jumper wires so it would be obvious which was which. I didn’t have the right colors and worked with what I had. The colors of the wires in the box are correct, just the jumper wires are all white.
You will probably need to break off the “tabs” on the side of each switch to make the 2 switches fit in the existing box next to each other. Break off the “right tabs” for the left-hand switch and vice versa.
Obviously, you need to make careful note of which switch is the fan and which one is the regular switch and wire them appropriately. In my case, the fan is on the left-hand side and the regular switch is on the right to control the light.
Now insert the “neutral” wire (probably white) into the “neutral” receptacle, add the jumper and tighten the wire. In my case, there was a pigtail with the neutral wires, so I removed it and stripped a jumper wire out of either 12 or 14 gauge wire to pigtail together later to complete the circuit. An alternative would have been to tie one of the neutral wires into the screw on the side of the switch, run a jumper to the other switch and tie off the other neutral to the other switch. This would be useful if the electrical box is too cramped to fit all the wires and switches.
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). Add the jumper and 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 “fan” (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). Add the jumper and tighten the screw.
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”. Add the jumper wire 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) and tighten the screw.
Now do the same thing to the other switch, plug in the neutral, light, line and associated jumper wires.
Now you need to screw together all of the jumper wires with the remaining neutral, ground & line wires. It is very important to get a tight twist on all of the wires to ensure they don’t work themselves 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.
Register your new smart switch & fan switch with Home Assistant
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 fan 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 fan switch is now added to Home Assistant
Click on the Nodes combobox and look for your new fan switch (it will likely be called Jasco Products 14287 Fan Control Switch (Node: # Complete)). The Node number will vary based upon how many Z-Wave devices you have.
Click on the Node Information button
Click on the name of the fan Z-Wave entry 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
The other place to make these edits is the States page.
From the States page, we can add a descriptive name to the fan.
What’s really cool about the fan control is that it will detect that it can set the speed.
Do all of the same steps for the regular light switch.
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 groups.yaml file
Create a new group master_bedroom_lights to store the lamps & light switches, but not the fan. 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 master_bedroom_hidden and list your group using the name you defined above and add your new fan.
Create a new group master_bedroom 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
For even more fun, let’s add the lights to the Bedtime scene we created in the Bedtime scene blog post.
Open the scenes.yaml file
Add your new group to the scene and what command to run.
- name: Bedtime
entities:
group.downstairs_welcome_home_lights: off
group.all_locks: locked
group.pc: off
group.kitchen: off
group.master_bedroom_lights: off
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
That’s it! You have now successfully added a Z-Wave switch & a fan control to Home Assistant.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptRead More
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.