Comparing different smart home protocols

An AI-generated image of various smart devices connecting to a home

When I started acquiring smart devices for my home, my focus was on those that worked over Wifi (or Ethernet) – I wasn’t really aware of the likes of Zigbee, Z-Wave and other protocols that were out there. In particular, I avoided those that required the purchase of a hub or bridge, due to the higher upfront cost.

Now that I’m further along my smart home journey, I’m more open to considering a range of different protocols. They all have their advantages and disadvantages to consider.

Wifi (and Ethernet)

I’m grouping these together as devices that are visible to a standard home network and have their own IPv4 address. The majority of smart home devices use Wifi, as there’s usually no need to buy an additional hub or bridge. Therefore, set-up is usually easy (sometimes aided by Bluetooth), and their range is fine as long as they can pick up your home’s Wifi signal. It’s also very easy to connect these devices to cloud services.

In terms of disadvantages: Wifi primarily uses the 2.4 GHz frequency band, which is used by lots of things and so there’s a potential for interference. The ease of connecting these devices to the cloud can also be seen as a flaw; they’re more susceptible to being compromised by bad actors, and don’t offer as much privacy. Wifi is also quite power-hungry – devices that don’t plug into the mains will need their batteries changing more frequently.

Bluetooth

As mentioned, Bluetooth is often used with Wifi to initially provision devices, but some Bluetooth-only devices can be used in a smart home. For example, there’s my Bluetooth thermometers, which connect to Home Assistant. Compared to Wifi, power requirements are much lower and so Bluetooth is good for battery-powered devices. They’re also more private, as they can’t easily be connected to from the wider internet.

However, Bluetooth has quite a limited range – it’s designed to be a ‘personal’ area network and won’t reach across large houses. You can use a Bluetooth Proxy in Home Assistant to extend the range, and whilst these devices are cheap, you’ll need to be comfortable flashing custom firmware and will usually need to plug them in as they bridge to Wifi. Like Wifi, it uses the 2.4 GHz band and so interference is possible – especially with the lower signal strength. Bluetooth connections also tend to be between two paired devices.

Zigbee

Zigbee is a mesh protocol, and it’s used by a number of smart home brands such as Philips Hue and Ikea Tradfri, as well as UK smart meters. This means that all devices on the same network talk to each other, and so a network with lots of devices could theoretically be quite strong. Like Bluetooth, there’s additional privacy as these devices aren’t connected directly to the internet like with Wifi. It’s also more energy efficient than Wifi, so battery-powered Zigbee devices will last longer between charges.

The key disadvantage of Zigbee is that you need a bridge to link it to your home network. Manufacturers like the aforementioned Philips and Ikea will sell you a hub that does this, although you can also buy USB dongles. Therefore, there’s a higher initial cost as you have to buy a hub as well as your devices. And it’s another 2.4 GHz protocol, so could have the same interference issues as Bluetooth and Wifi.

Whilst Home Assistant has good Zigbee support, both natively and through the Zigbee2MQTT system, if you don’t have a separate hub then getting these devices into Google Home can be a very involved process. Alexa is a little easier thanks to the Emulated Hue integration.

Thread

Thread is based on the same 802.16 standard as Zigbee, but differs in a couple of ways. Firstly, devices on a Thread network have an IPv6 address. Secondly, Thread is a simpler protocol that focuses just on being a mesh network with Matter taking over the device APIs. The benefit of integrating with Matter is that, unlike Zigbee, you may not need a separate bridge for Thread devices. A number of smart speakers from Google, Amazon Alexa and Apple can also act as Thread Border Routers, so it’s possible that you’ll already have the infrastructure in place in your home for Thread devices. Like Zigbee, Thread is a mesh network, and by using Thread Border Routers, the devices have a degree of separation from the wider internet that should improve privacy and security.

The downside is that Thread is still pretty new, and so there aren’t many Thread devices out there yet. You may also find that each device that incorporates a Thread Border Router creates a separate Thread mesh network. Home Assistant can be configured to join a preferred network, but it can be a bit of a faff. Ideally, they should all make one big, strong mesh network across your home, but we’re not there yet. And, once again, we’re dealing with a 2.4 GHz protocol here.

Z-Wave

Z-Wave sets itself apart from the aforementioned protocols by being on the lower 800-900 MHz frequency range. These lower frequencies have a longer range, and so are more suited to larger homes, but also avoid the interference of the 2.4 GHz band. Like Zigbee, it’s a mesh network, and should have similar privacy and security benefits by not being connected directly to the internet.

This also means that Z-Wave has the same disadvantage as Zigbee in that you’ll need a bridge to expose these devices to your home network. Furthermore, Z-Wave devices tend to be more expensive, so the upfront cost is usually higher than other protocols mentioned here.

RF and Infrared

I’m including these for the sake of completeness, but they’re not ‘smart home protocols’ in the same way as the above. It’s possible to connect the likes of Home Assistant to bridge devices that can communicate over Wifi and 433 MHz RF or Infrared. These will typically be doorbells or remote controls for devices that don’t connect using any of the above. But setting them up can be trial and error, and involves detecting and interpreting codes to trigger automations.

If you’re building a smart home system, then a bridge may be useful to bring existing devices in that don’t support standard smart home protocols. But if you’re looking to buy new devices, stick with the ones above.

Displaying CPU temperature in Home Assistant

CPU temperature screenshot in Home Assistant

Earlier in the week, I mentioned that I’d bought a new case to keep my Raspberry Pi cool. So that I can keep an eye on the CPU temperature, and hope that it doesn’t overheat again, I’ve added this as a sensor in Home Assistant.

Adding a CPU temperature sensor to Home Assistant isn’t as straightforward as most other integrations. It’s not included in the System monitor integration, for example. When I was searching for solutions, I found all sorts, including one which required installing several packages from Aptitude, a script, and an MQTT broker. To be fair, that was designed to monitor multiple Raspberry Pis remotely; all I needed was just to poll the CPU temperature of the device that Home Assistant was running on.

Command line integration

Whilst not as straightforward as adding an integration, there is a relatively simple way of adding a CPU temperature sensor using the Command line integration. Indeed, it’s one of the given usage examples, which I’ve copied below:

# Example configuration.yaml entry
command_line:
  - sensor:
      name: CPU Temperature
      command: "cat /sys/class/thermal/thermal_zone0/temp"
      # If errors occur, make sure configuration file is encoded as UTF-8
      unit_of_measurement: "°C"
      value_template: "{{ value | multiply(0.001) | round(1) }}"

You’ll need to add this to your configuration.yaml file, and then restart Home Assistant. You should now have a ‘CPU Temperature’ entity, which you can add to a card to display on your home dashboard.

As well as running the command, the example code also adds the relevant units, and also reformats the numbers. If you open a terminal window and run the cat /sys/class/thermal/thermal_zone0/temp command on its own, you’ll get a value like ‘36511’. So, the value_template line divides the number by 1000 (or specifically multiplies it by 0.001, but the result is the same), and rounds it to one decimal place.

Once you’ve got the entity into Home Assistant, you can log your CPU temperature over time, and even display it as a graph if you want. You can also build automations, so that you can receive notifications when your CPU temperature is too high. For a Raspberry Pi, ‘too high’ is 85°C.

A temperature-controlled fan using Generic Thermostat in Home Assistant

A screenshot of the description of the generic thermostat integration in Home Assistant

So earlier this month, in my review of the ThermoPro Bluetooth Thermometer, I mentioned some ‘additional functionality’ in Home Assistant that I would write about. Well, later is now, and I’m going to talk about how I have a temperature-controlled fan in our bedroom, powered by Home Assistant and its Generic Thermostat integration.

Generic Thermostat is one of the older Home Assistant integrations, having been around for several years. It allows you to take any temperature sensor, and any smart switch, and automatically turn the switch on and off in response to temperature fluctuations. In essence, Home Assistant itself provides the thermostat functionality.

The switch should power something that can either heat up or cool down a space – for example, a plug-in heater, or an air-conditioning unit. In my case, I’ve hooked it up to a standard pedestal fan, and used a smart socket to turn the fan on or off at the plug.

Enabling the integration

Note: within days of publishing this blog post, Home Assistant 2024.7.1 was released, which allows you to configure the Generic Thermostat through the Lovelace UI, so you don’t need to add the YAML code anymore.

I mentioned that it’s an old integration, and sadly it’s not one that has been updated much since it was implemented. This means that you can’t add it using the Home Assistant interface (Lovelace), and instead you’ll need to add it to your configuration.yaml file.

Here’s mine:

# Generic thermostat
climate:
  - platform: generic_thermostat
    name: Bedroom thermostat
    heater: switch.bedroom_fan_socket
    target_sensor: sensor.tp357s_55ab_temperature
    min_temp: 15
    max_temp: 30
    ac_mode: true
    target_temp: 19
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_cycle_duration:
      minutes: 20
    away_temp: 19
    precision: 0.1

Here’s what each variable refers to:

  • Platform specifies the integration, and the Name is the friendly name of the device.
  • Heater is the name of the entity that controls the smart socket that the fan is attached to.
  • Target_sensor is the name of the thermostat entity that provides the temperature.
  • Min_temp and Max_temp set the minimum and maximum temperatures that you’ll see on the Climate card in Lovelace – I’ve set these to 15°C and 30°C respectively.
  • AC_mode is set to ‘true’ because we’re using a device that’s supposed to cool down the room. If this were a heater, I would leave this line out.
  • Target_temp is the temperature that I want the thermostat to achieve, which is 19°C.
  • Cold_tolerance and Hot_tolerance mean that Home Assistant will only turn on the fan when the room reaches 19.5°C, and will only turn it off when it reaches 18.5°C.
  • Min_cycle_duration means that if Home Assistant turns the fan on, it should stay on for at least 20 minutes, and vice-versa, so it’s not constantly cycling on and off.
  • Precision is how much precision I want when setting the temperature; at 0.1, this means I can set it to 1/10th a degree.

Once you’ve added or amended the settings for your thermostat, you’ll need restart Home Assistant.

How it works in practice

So, once set up, if the temperature in our bedroom reaches 19.5°C, the fan will come on. It’ll then stay on until the room reaches 18.5°C, or 20 minutes, whichever happens first.

You can also control the thermostat like you would with, say, a Nest thermostat through Home Assistant. It will create an entity which you can add a card for on your dashboard. So, although you may have set a target temperature in the initial configuration, you can change this without editing your configuration file. However, if you re-start Home Assistant, it may forget this.

If you also use Google Assistant or Alexa, then you can also make them see and interact with your generic thermostat, if you have integrated these with Home Assistant.

Whilst I use a fan and a smart switch, if you have an air conditioning unit with an RF control, you could use an RF bridge to allow General Thermostat to control it.

Fans vs air conditioning

If you do use a fan with Generic Thermostat, you’ll notice that your fan may stay on for a long time. That’s because fans don’t actually cool the air; they move air around which helps sweat evaporate more quickly. That makes you cooler, but not the air around you. It’s a bit like a hot day at the seaside, where the breeze takes the edge off the heat.

Air conditioning systems actually cool the air down, but are much more expensive and need an outlet for the hot air to be pumped out. Most British homes don’t have air conditioning, including ours – most of the year, it’s too cold, and our houses are designed to retain heat.

ThermoPro TP357 Bluetooth thermometer review

A photo of a ThermoPro TP357 thermometer showing the current temperature of 17.5℃ and humidity of 59% on a LCD display.

I have an upcoming project for Home Assistant which means that I need to be able to measure the temperature in our bedroom. As part of this, I’ve bought a couple of ThermoPro TP357 Bluetooth thermometers from Amazon (sponsored link). One is for our bedroom, and the other is for our eight-year-old’s bedroom which tends to get a bit cold in winter.

I specifically went for these thermometers because they’re:

  • Cheap – I paid £19 for the pair last week, but they’re £16 for the pair as I write this.
  • Supported by Home Assistantthere’s an official integration.
  • No extra hardware required – because they’re Bluetooth, and I run Home Assistant on a Raspberry Pi with a supported Bluetooth chip, there’s no additional hardware required to get the two to talk to each other.
  • Probably good battery life – Bluetooth is quite energy efficient when compared with, say, Wifi, and so the batteries should last longer.
  • No need to use the cloud – all the data can be stored locally on Home Assistant.

ThermoPro TP357 look and feel

The ThermoPro units are smaller than I expected. They’re about as tall as a credit card but roughly square, so they’re narrower than a credit card. Each one runs on one AAA battery which is provided. On the back is a flip out kick-stand, a magnet and a hook, so you can wall-mount it, stick it to your fridge or have it free-standing on a shelf like I do. There’s also a button on the back that switches it between Fahrenheit and Celsius.

On the front, there’s an LCD screen which shows the current temperature and humidity level. There’s also a face pictogram – it’ll smile when the humidity is between 30-60%, frown when it’s less than 30% or show a neutral expression if it’s over 60%.

Home Assistant integration

If you have Bluetooth enabled on your Home Assistant device, then a few minutes after you put the battery in, Home Assistant should pop up a notification to say it’s discovered a new ThermoPro device. You’ll just need to confirm that you want to set it up and allocate it to an area, and you’re done.

As you would expect, the ThemoPro integration reveals entities for temperature and humidity, but also the battery level. I’m not sure how accurate this is, as both provided AAA batteries just show 50%. I’ve added these to my Home Assistant dashboard, and have set up some additional functionality that I’ll blog about later. Mainly because, despite allegedly being ‘summer’ in the UK right now, it’s not been warm enough for me to test.

The range seems quite good on these. ThermoPro claim that there’s an 80 metre range in direct line of sight. There’s a few thick walls between my Home Assistant device and the thermostats, and one that is around 5 metres away doesn’t have great signal strength but it’s enough.

ThermoPro app

Of course, ThermoPro expect you to use their app for iOS and Android. This includes logging of up to a year’s data, and you can set notifications based on events related to the humidity and temperature. Well, that’s what it says – I haven’t actually installed the app. I’m not yet sure if it’s possible to have the app and Home Assistant communicate with the thermostat at the same time. But theoretically, anything the app can do, Home Assistant can do too.

Alternatives

I’ve had various Facebook adverts for alternatives to these. Some have e-ink displays, which are more readable at a distance, or use different protocols to Bluetooth. But they’re all more expensive. These two seem to do the job well and are small and cheap. Plus, it should be quite a while until I need to replace the batteries.

Home Assistant and Google Home broadcasts

Screenshot of Home Assistant showing a script to broadcast a message via Google Home when my washing machine finishes

We have six Google Home Mini devices around our home, and now I can get Home Assistant to automatically deliver broadcast messages. Here’s how I did it.

Broadcast messages

When you have more than one Google Home device, you can say ‘Okay Google, broadcast [message]’, and it will relay that message to all of the other Google Home devices in your home. It’s useful for announcing that dinner’s ready, for example. Our house is long, rather than square, and I’m hard of hearing, so we use this quite a lot.

What I wanted to achieve was automation of these broadcasts, so that a broadcast was triggered by an event. This is possible thanks to the Google Assistant SDK integration. It’s a bit of a faff to set up – I recommend following this guide or watching the video embedded below:

Call the service

Once it’s set up, you can test it by opening Home Assistant’s Developer Tools. Click the ‘Service’ tab, and choose the ‘Google Assistant SDK: Send text command’ service. In the command, type something like ‘broadcast "This is a test"‘ and click ‘Call Service’. If you’ve set everything up correctly, your Google Home devices should all say something like “Incoming broadcast; it says: This is a test”.

Create a script

As I write this, the latest version of Home Assistant (2024.4.x) doesn’t allow automations to call services directly. So, to be able to trigger the broadcast, we’ll first need to create a Script in Home Assistant. In my example, I have a script called ‘Washing machine finished broadcast’. The ‘mode’ is left at the default setting of ‘Single’, and then I’ve created an Action which is to Call a Service. As above, I have selected ‘Google Assistant SDK: Send text command’ as the service to call, and then entered ‘broadcast "The washing machine has finished"‘ as the command, which I have ticked. I’ve left the rest blank.

Whilst here, I’ve also added a time condition. As this will be triggered when the washing machine finishes, I don’t want it to run when we might be asleep. We have Google Home devices in each of the bedrooms, and we sometimes run the washing machine overnight.

Home Assistant runs script actions in order. So, if you also want to add a time condition, you’ll need to add this before the Google Assistant SDK service call, or re-order the actions. In this example, I have created a Test action, where the current time is between 8am and 8pm. Outside of those times, the script will fail and not process the next command, so the broadcast action won’t be executed.

Link it to an automation

Now that we have a script, we can integrate this with an automation. I’m using my existing automation that sends a phone notification when my washing machine finishes. In my case, this is triggered using Meross energy monitoring smart plugs (sponsored link).

So now, as well as sending a notification, it also triggers a broadcast (within the time constraints).

Other things you can do with Google Home

Once you have the Google Asssistant SDK integration installed in Home Assistant, you can use scripts to run any other command that you would say to Google Home. You could, for example, create a button on your Home Assistant dashboard, which triggers the text command ‘play Never Going To Give You Up by Rick Astley on Spotify‘ if you want to automatically rickroll the other occupants of your house. It can also control smart home devices which work with Google Assistant, but do not yet have a Home Assistant integration.

The advantages of a smart home

An AI generated image of a house, with a giant light bulb floating above it that has a depiction of Albert Einstein

Okay, so it’s fair to say that I write a lot about Home Assistant and the smart home – I have a whole category of blog posts about it. Whilst it’s probably a sign of a mid-life crisis project, I thought I would set out the advantages of having smart devices at home, as a justification of why I spend so much time setting and configuring devices.

Delayed start

Many devices, like washing machines, dishwashers and the like, offer a delayed start facility. If you need to wash clothes, but are out at work all day, you probably want your washing machine to finish just before you get home. Otherwise, you’ll have wet clothes sat there for several hours. Similarly, we have a bread maker that we set to finish at around 4am, so that the bread is still fresh but not too hot when we need it.

I also use a delayed start on our dishwasher, so that, in winter, it runs during the middle of the day when there’s more sunlight. That allows us to make the best use of the cheap energy from our solar panels. This may also be useful for people whose electricity tariffs vary at different times, such as the Octopus Agile tariff.

Not all devices offer a delayed start feature as standard, so smart plugs can fill this role. I also use a smart plug to turn off a device that lacks a timer.

Remote control

The first smart device that we got in our house was a Nest thermostat, and this allows us to control our heating whilst outside the home. That means that we can ensure the heating is off when we’re away, saving money, but also ensure that it comes back on before we get back home.

Even when we’re at home, we have a couple of standing lamps in hard-to-reach places – smart plugs allow us to use voice control to turn these on and off.

Dashboard overview

As Home Assistant supports more devices than most other platforms, I can have a very powerful dashboard that brings in data from every smart device in the home (and some outside data too). That way, I can see at a glance whether the TV, dishwasher, washing machine and tumble dryer are on, as well as control several lights and the various Google Home speakers around the house. This is also possible in other apps like the Google Home app, but with a more limited range of devices.

Notifications

Through Home Assistant’s automations, I can create notifications for things happening in my home. For example, although our washing machine beeps loudly when done, it’s in the cellar. Combined with my hearing loss, I might not hear it when in another part of the house. So having a message pop on my phone to say that the washing is done is very helpful.

Logging

Home Assistant in particular has a useful logging feature, so it can automatically log when devices are turned on/off or change state. So if you can’t remember when a device was last used, Home Assistant can tell you.

Quick access to information

We have Google Home smart speakers in almost every room (not the bathrooms). They’re great for asking quick questions about things like the weather, without needing to look it up on a phone or computer. We also use them extensively for setting timers and alarms, and for playing music. And having them across the house means that we can use broadcast messages – again, better than shouting for someone like me who sometimes struggles to hear.

There are other advantages that I don’t have personal experience of; a colleague has a smart doorbell and smart lock, so that if someone tries to deliver a package and no-one’s home, it’s possible to remotely open a door into the porch to allow the delivery driver to leave it securely. We don’t have a smart doorbell or smart lock – or a porch for that matter. We also don’t have a garage, but having a smart garage door opener would be good if we did have one.

Meross energy monitoring smart plugs

A photo of a Meross energy monitoring smart plug in a UK plug socket

I’ve recently bought a pair of Meross energy monitoring smart plugs (sponsored link), and by integrating these with Home Assistant, I now get notifications when the washing machine and tumble dryer have finished.

Previously, I’ve used Tuya smart plugs. Which are fine, but these ones don’t do energy monitoring, don’t work with Apple HomeKit and I have some privacy concerns. The Meross plugs, on the other hand, do offer energy monitoring, can be used with 13 Amp devices, and also work with Matter. They’re also smaller, and feel more solidly built than the older Tuya plugs.

Matter support

These smart plugs also support Matter, the open smart home standard. This should mean that you can use them with any smart home ecosystem, whether that’s Amazon, Google, Apple HomeKit, Samsung SmartThings or Home Assistant. I was able to get them to pair with Home Assistant, but not with HomeKit. It turns out I need a device that can act as a HomeKit hub, which can be a permanently plugged-in iPad, Apple TV or Apple HomePod. It won’t just use any other Matter server on my home network. This is ironic as the Home Assistant app uses the same Matter provisioning process on iOS devices.

It’s also worth noting that Matter support is limited to turning the smart plugs on and off. I’m guessing the Matter specification doesn’t include energy monitoring as yet. Also, these smart plugs connect over 2.4 Ghz Wifi, which is worth noting if you’ve configured your Wifi network to only use 5 GHz. They don’t use Thread.

Screenshot of the hassio_appliance-status-monitor Blueprint being configured as an automation in Home Assistant

Making use of energy monitoring

If you want to take advantage of the energy monitoring capabilities of the smart plugs, you’ll either need the official Meross app (for iOS and Android), or use Home Assistant. Whilst I have installed the Meross app, I’ve set up the automations in Home Assistant. There isn’t an official Home Assistant integration for Meross, so you’ll need to install the Meross LAN custom integration which is available through HACS.

Once you’ve set it up and added your devices, you’ll need to set up the energy monitoring automation. By far the easiest way is to use this BlueprintBlueprints are essentially templates for automations that you can download and configure. Make sure you follow the instructions, as you’ll need to create four Helpers for each smart plug, and give them specific names.

You can then define actions to take when the energy monitoring detects the appliance has started and ended. In my case, I’ve told it to send a notification to my phone when the device has finished. In the case of my tumble dryer, this includes a 15 minute delay as it uses less power towards the end (and otherwise results in notification spam). You may need to tweak the power thresholds as well. If all goes well, then you’ll get a notification like the one in the screenshot below.

A screenshot of a notification from Home Assistant stating that the washing machine has finished, triggered by the energy monitoring smart plugs

Doing this means that you can get one of the key features of a smart device, without paying a significant premium. I paid £25 for the two plugs from Amazon, whereas it would have cost at least another £100 to buy a smart tumble dryer. Our washing machine is 9 years old and I’m not even sure that smart washing machines were on the market at the time.

CarPlay with Home Assistant

A screenshot of the CarPlay home screen showing the Home Assistant icon

There’s now a CarPlay app for the Home Assistant Companion app on iOS. This means that it’s possible to control (some) of your devices connected to Home Assistant whilst driving.

I like CarPlay, and have a standalone unit in my car. Most CarPlay apps are designed for either navigation or for listening to audio content whilst driving, but Apple has allowed some other apps more recently. For example, the RingGo parking app is now available in CarPlay; I wish the same could be said for the four other parking apps I have installed.

The Home Assistant app has four tabs: Actions, Areas, Control and Servers. Areas gives you the list of rooms that you have defined, and from there you can access some of your devices. Control gives you a big list of all of the devices that have a function that can be controlled whilst using CarPlay – mainly buttons and switches. Meanwhile the Servers tab is there in case you’re able to log in to more than one Home Assistant instance.

Actions are unique to the Home Assistant Companion app. They link to automations, but have a specific trigger. At the moment, I’m only really using actions to control my Nest thermostat as this is usually the only thing I want to control outside the home. Actions are also used by widgets on iOS, and by the Apple Watch integration. They’re a bit of a faff to set up at present; this video seems to be the best guide to setting them up.

It should be noted that Home Assistant also supports Android Auto, and indeed has done for longer. CarPlay support was new in January but it’s taken me until now to get it set up and remember to take some screenshots.

I’m really happy about this new feature, as being able to safely control my heating whilst driving isn’t something I’ve been able to do before. It makes the time that I’ve spent setting up and tweaking my Home Assistant server worthwhile.

Nginx Proxy Manager

A screenshot of nginx proxy manager

I’ve recently started using Nginx Proxy Manager to act as a reverse proxy for the various web services that I have running on my Raspberry Pi. It’s a frontend to the nginx web server and makes setting up reverse proxies and SSL access really easy.

You may remember that I’ve used SWAG for this before, to enable HTTPS access to my Home Assistant installation. SWAG is find if you’re using Home Assistant Core or Container, but having switched to Home Assistant Supervised recently, I needed a new solution. Like SWAG, Nginx Proxy Manager can be run in Docker, but it’s also available as a Home Assistant addon.

The main benefit of Nginx Proxy Manager over SWAG is that it has a web-based UI, shown in the screenshot above. This makes setting up new proxy hosts really easy, as it has a nice and simple interface. Whilst SWAG includes pre-built configuration files for many services, there’s no interface available other than editing text files.

Nginx Proxy Manager will also manage SSL certificates. You can either import ones that you purchase yourself, or it will manage the process of acquiring and renewing Let’s Encrypt certificates.

As well as managing Home Assistant, I have Nginx Proxy Manager looking after Calibre-web and Nextcloud.

A brief explanation of reverse proxies

Apparently, you’re supposed to ensure that blog posts are at least 300 words nowadays, otherwise Google ignores it. So, here’s an explanation of why you should set up a reverse proxy server if you’re hosting services like Home Assistant at home:

  1. No port numbers. When you set up something like Home Assistant, you’ll end up with an address like http://192.168.0.1:8123. A reverse proxy will allow web browsers to connect on the standard web ports (80 for HTTP, 443 for HTTPS), which looks nicer and is more predictable. It also means you don’t have to forward lots of arbitrary ports on your router.
  2. SSL certificates. If you’re running a device on your home network, then ideally you only want to allow secure connections to reduce the risk of your personal data being intercepted. Self-signed SSL certificates are not ideal, as most web browsers issue dire warnings for web sites that use them. As not all web applications support SSL certificates natively, a reverse proxy can handle this for you.
  3. Web application firewall. By making all requests go via a proxy, the proxy server can filter out malicious traffic. Nginx Proxy Manager includes a ‘block common exploits’ mode, and you can also filter IP addresses. For example, you may wish to only allow access to certain IP addresses.

Installing in Home Assistant

If you’re running Home Assistant Supervised or Operating System, then you’ll need to install the Nginx Proxy Manager addon. It’s available from the Community Addons repository, which should already be available to you – you won’t need to add it separately. It’s not to be confused with the official ‘NGINX Home Assistant SSL proxy’ addon; this doesn’t include an interface and only enables a proxy for Home Assistant, and not for any other services. Indeed, if you’re already using this official addon, you’ll need to stop it from running first, as otherwise you’ll have a port conflict.

Once set up, you can access the web interface at http://[your IP]:81 . I suppose I could probably set up a reverse proxy host to get rid of the port number, but I don’t see a good reason to enable remote access to it.

One final thing to add is that the user guide for Nginx Proxy Manager isn’t great. It covers setup, but there’s very little help for configuring proxy hosts. The web interface is pretty straightforward so arguably detailed instructions aren’t necessary, but a little more help would be good.

A basic Home Assistant automation

A screenshot of Home Assistant showing an automation to turn off a smart plug after 18 hours

One of the biggest benefits of running Home Assistant in your home is its powerful automation tools for controlling your smart devices. In this example, I have a smart plug socket which I want to run for 18 hours, and then automatically switch off. This is the smart plug that we use for our heated drying rack, and it ensures that the rack doesn’t continue heating for longer than necessary, to save energy. As I run Home Assistant on a Raspberry Pi 4, it only uses 15 watts of power, compared to the few hundred watts that the drying rack requires.

Automations in Home Assistant have become much easier in recent releases. In times gone by, you’d have to write YAML scripts to automate your devices, but now there’s a relatively straightforward interface. Generally, automations work on the principal of ‘if this, then that’ – a bit like IFTTT, but it runs in your own home.

Tuya me, to you

For my automation, I use the trigger of the smart socket being turned on. In my case, this is a Tuya wifi-enabled smart plug, which I’ve called ‘Cuthbert’. We have four Tuya plugs, all with silly names like Cuthbert, just because. Tuya are a white label manufacturer, and so the brand names on the plugs vary despite them being exactly the same. I wouldn’t necessarily recommend them, as presumably every time you turn them on and off, your request goes via Chinese-controlled servers. I would probably buy Matter-enabled plugs instead now but they work fine. Plus, the recent 2024.02 release of Home Assistant massively improves Tuya support and no longer requires you to create a developer account, which is nice.

Automation actions

Anyway, having selected the ‘When’ event, we now need to specify the ‘Then do’ actions to take. First of all, we need a time delay, otherwise as soon as the socket is turned on, Home Assistant will turn it off again. The ordering of actions is important, as I found out the hard way; I originally had the delay after the command which meant that the socket just turned off straight-away. So, we specify a delay and then the action to turn the socket off.

The third action is optional, but it just sends a notification to my phone to tell me that the automation has completed. I’m using the Home Assistant Companion app but you could use an app like Pushover, or trigger an email.

This is a really simple automation, but you can create more complex ones. I’m hoping that, at some point in the future, we’ll have some smart blinds in our kitchen, and I’ll be able to use Home Assistant’s sun integration to open and close them at sunrise and sunset.