Table_of_Contents
1 HA Interface Protocol / Devices
1.1 Sonoff Devices
1.1.1 Install Tasmota Firmware
1.1.2 Flash Sonoff Basic Switch
1.3 Zigbee / Z-Wave Interface Gateways / Hubs
1.6 Zigbee / Z-Wave Combination Devices
1.7 Identify USB Interface Devices
List of Figures
Figure 1: Tasmotizer GUI
Figure 2: Tasmotizer Config GUI
Figure 3: Tasmota Web GUI
Figure 4: HA Tasmota Sonoff Switches
Figure 5: HA Tasmota Devices
List of Tables
Table 1: EWeLink Versus Tasmota
Table 2: Zigbee Versus Z-Wave Features
IOT devices such as switches, lights, alarms, sensors are physically distributed and communicate to a central Home Assistant controller using a protocol which may require an interface device.
To get an idea of the vast array of IOT devices available, go to "www.amazon.com" and search "Zigbee" and "Z-Wave". This may also assist in protocol selection, by choosing devices of interest.
If updating an existing home automation system to use Home Assistant, the following considerations apply:
If creating a new installation, the following considerations apply:
Sonoff has a wide variety of inexpensive WiFi IOT devices (search "sonoff" at www.amazon.com). This is a very inexpensive way to start home automation without the necessity of investing in Zigbee or Z-Wave interface devices.
The Sonoff RF Bridge, allows access to many inexpensive 433MHz RF devices.
Two options exist for controlling Sonoff devices, stock firmware which uses the EWeLink protocol or install Tasmota firmware (geeks only) on the device (requires technical skills). EWeLink versus Tasmota features are contrasted in the table below:
Feature | Stock | Tasmota | Notes |
Protocol Interface Required | No, uses WiFi | No, uses WiFi | Major cost advantage. |
Communication Protocol | EWeLink | MQTT, HTTP, Serial or KNX | Choose one. |
Added Functions | Only basic device functions | Protocols, device web UI, sensors, expanded timers, full device control. |
|
Ease of setup | Use EWeLink app to discover and configure devices, config stored on cloud server. | Requires technical skills: soldering, flash firmware and USB / Serial dongle. geeks only. |
|
Firmware Updates | Use EWelink app | OTA, using web interface |
|
Uses Internet | Yes, for device configuration, unless each device manually configured. | No |
|
Device Support | Mainly Sonoff and a few others. Internet search for device compatibility with EWeLink. | Very broad, not just Sonoff. Supported devices. | MQTT appears to be the way Home Assistant and home automation industry is trending due to architectural superiority. |
Supports the Sonoff RF Bridge | Yes | Yes | Allows access to many inexpensive 433MHz RF devices |
Voids Warrantee | No | Yes |
|
Table 1: EWeLink Versus Tasmota
For Sonoff devices, it is suggested that novices start with stock devices and defer upgrading to Tasmota until more experience with Home Assistant is gained and the need arises.
Many users will find that available Sonoff devices meet all their needs at the right price and will choose to not incur the added expense of Zigbee or Z-Wave.
Do not do this until Home Assistant and Mosquitto Broker are installed and working.
There is a wealth of additional HowTo's on the internet for installing Tasmota Firmware on Sonoff and generic ESP82xx based devices. A USB / serial dongle, soldering and flashing firmware skills are required. If not intimidated by this, it is assumed that the following instructions and / or internet HowTo's and research should be enough to proceed.
The following links provide useful Tasmota information and HowTo's:
Tasmota Device Compatibility List
HowTo Flash Tasmota - Using Tasmotizer for flash programming is the easiest option.
Plus internet research for devices of interest.
Flashing a Sonoff Basic switch with Tasmota is used as an example. The procedure for flashing any ESP82xx device will be similar.
Install serial interface pins (soldering required) on Sonoff Basic switch. It also possible (highly technical) to flash Tasmota using Over The Air (OTA) updates without soldering, which may be worthwhile if many devices need to be flashed.
Download Tasmotizer.
Connect a USB / Serial dongle to the Sonoff Basic switch (caution: without AC power connected).
Ensure that:
Hold down the Sonoff button while connecting the serial interface dongle to PC. Release the button after ten seconds. This places the Sonoff device in programming mode.
Start Tasmotizer. You will see the Tasmotizer GUI, as shown below.
Figure 1: Tasmotizer GUI
Figure 2: Tasmotizer Config GUI
Prior to proceeding, to avoid confusion regarding which devices are where and to easily manage your devices, it is best to create an IP device naming plan, to manage device names and IP addresses.
Enter the following values (per figure above unless stated otherwise):
After the device is successfully flashed, configured and power cycled (still using serial dongle), it will be visible on your LAN, with a DHCP assigned IP address. The IP and MAC addresses must be determined to assign the Sonoff device a fixed IP address using dnsmasq (DHCP reservation).
At a SecureOffice command prompt, enter "cat /tmp/dhcp.leases | grep tasmota". You will see entries of the following form: "1582625054 dc:4f:22:29:fb:9b 192.168.1.110 tasmota-7067 *" showing IP and MAC addresses for all Tasmota devices.
If, for some reason the device does not show up, a serial terminal program or PuTTY connected to the USB / Serial port (baud: 115.2K, 8 bits, no parity, 1 stop bit, no flow control) will display diagnostic information.
The device IP address can be entered in a browser to access the Tasmota web GUI, as shown below:
Figure 3: Tasmota Web GUI
The web GUI can be used to set all Tasmota config values. After ANY Tasmota configuration change (such as initial config above), use the Tasmota console to enter the following command: "SetOption19 1". This is required for Home Assistant to auto discover Tasmota devices. After a few minutes, the newly configured devices will show up in the Home Assistant overview, as shown below.
Figure 4: HA Tasmota Sonoff Switches
As a final check, navigate to "Home Assistant -> Configuration -> Devices". You will see the Tasmota devices (with names you assigned), handled by MQTT, as shown below.
Figure 5: HA Tasmota Devices
In choosing a reserved LAN IP address for the device, be aware of and conform to the SecureOffice IP address numbering plan.
Since Tasmota devices cannot be configured for static IP addresses, a reserved address must be assigned by the SecureOffice DHCP server which allows central control of device IP addresses and names.
A static LAN IP address should be assigned for devices, since the address needs to be predictable across boots to access the device web GUI at a known IP address.
The Tasmota device IP address chosen above (numbering plan) and the MAC address are required to assign a reserved IP address and device name.
The device will be accessible by name both locally and using remote VPN. Subsequent configuration instructions depend on this step.
Using the chosen device <LAN IP address>, <MAC address> and <device name> (Use the name assigned for Tasmota Topic above) for hostname, assign a pseudo-static IP address using this method which relates MAC to IP address and DNS name.
After the pseudo-static IP address has been configured, from a SecureOffice console enter: "/etc/init.d/dnsmasq stop; rm -f /tmp/dhcp.leases; /etc/init.d/dnsmasq start" to restart the SecureOffice DHCP server with updated configuration.
The device needs to be power cycled to acquire the new IP address. Confirm the IP address is correct by accessing it using a browser. Fix if not.
You can now "ping <device name>" or use "http://<device name>" rather than remember the IP address.
Instructions regarding using Tasmota flashed devices are in subsequent sections.
After researching Home Assistant and the home automation markets. It became apparent that Zigbee and Z-Wave are the dominant home automation interface protocols. Both together are called "SmartThings" by Samsung.
For documentation / configuration purposes, MQTT and the Mosquitto Broker were chosen as the interface to HA. Mosquitto / MQTT are used to proxy and abstract Zigbee and Z-Wave protocols / devices. The main reason is that MQTT can proxy / abstract many protocols, so adding new protocols (X10, Amazon Web Services, Microsoft Azure, etc, becomes a matter of adding protocols to MQTT code / configuration). This (system design perspective) is the "correct" approach.
There are pro's / cons for each protocol:
Feature | Zigbee | Z-Wave | Notes |
Proprietary | No - International Standard | Yes, patented, adds to cost | Due to higher costs and lack of inexpensive development tools for Z-Wave, innovators are more attracted to Zigbee, which is pulling ahead in popularity. |
Cost | Far Lower | Higher |
|
Product Selection | Vast | Vast | Both protocols well supported by market. |
Interface Device Requires | Yes, Zigbee radio / interface | Yes, Z-Wave radio / interface |
|
Frequency | 2.4GHz (WiFi) | 865.2 to 926 MHz |
|
Global Standard | Yes, shares WiFi frequencies, a global standard | No, operates at 868.42MHz in Europe, at 908.42MHz in North America and uses other frequencies in other countries depending on their regulations | Lack of a global standard makes it harder and adds costs for manufacturers to target variations for various regions. With a global standard, one product for all. |
Competes with WiFi bandwidth, interference | Yes | No | May be performance issues if WiFi crowded and channels not managed. See "Further Reading" |
Transmission Rate | 250 Kbits / second | 40 or 9.6 Kbits / second |
|
Range | 10-20 Meters | 20-30 Meters | Max range between devices in mesh network. Indoors, not line of sight |
Battery Life | Good | Good | Zigbee uses less power due to lower RF power (lower range) |
Mesh Network | yes | yes | AC powered devices act as repeaters, extending range. Battery powered devices do not. |
Secure (encryption) | AES128 | AES128 |
|
Max Devices (nodes) | 65,000 | 232 |
|
Interoperability | Good. Home-assistant developers have added "quirks" to automatically handle devices that are non-compliant. | Guaranteed | Ability of devices from various manufactures to interact. Z-Wave strict compliance testing guarantees. Zigbee had issues in past, now mostly resolved. |
Max Hops | 10-20 (Depends on implementation) | 4 | Maximum number of repeaters messages can be relayed through before lost. |
Table 2: Zigbee Versus Z-Wave Features
There is no compelling reason to choose either protocol unless you already have devices. For new deployments and lower costs, Zigbee is recommended. For geeks, Zigbee has many more hackers creating HowTo's (better support).
A smart home gateway / hub is a standalone unit with integrated radios and controller. Home Assistant is also a smart home gateway / hub with far more features, better user support and broader compatibility than commercial offerings.
This section discusses alternatives to SecureOffice Home Assistant using commercial offerings and hybrid approaches where a commercial hub is integrated with Home Assistant to provide greater functionality.
Tom's Guide has an excellent market overview: Best smart home hubs of 2020.
Only standalone (no cloud server required) hubs are considered. This is due to reliability (doesn't work when internet / cloud server down), privacy (do you really want third parties to snoop on your activities?) and latency (takes longer for devices to respond due to internet / server delays) concerns. Further, the point of SecureOffice and services is "cutting the cord" and securing independence from third party cloud services and all the security / privacy risks they pose.
Standalone gateways / hubs have the following pro's / cons:
The following Gateways / Hubs can integrate with Home Assistant (internet research, to choose one):
Hubitat Elevation - Worst Review, Best Review, Home Assistant Support (geeks only), Discussion Thread
Vera Plus - Worst Review, Best Review, Home Assistant Support
Mixtile Hub - New to market, just started shipping, no useful reviews, looks good for geeks, too new for Home Assistant (yet).Good concept, something to watch.
nCube Smart Hub - Defunct product, customers abandoned.
DIY Home Assistant on Raspberry PI - (geeks only) build your own Home Assistant hub, independent of SecureOffice. This approach will have major reliability issues due to SD card reliability. "Somehow" (device dependent), a way must be found to move the root filesystem to more reliable storage.
Sonoff / eWeLink - Honorable mention since Sonff devices are inexpensive and use standard WiFi for communication. Does not require any interface device (Zigbee / Z-Wave). It is also possible (geeks only) to program sonoff devices to be Zigbee compatible and control with Home Assistant. It is also possible to integrate un-modified sonoff devices with Home Assistant.
Note the list of standalone gateway / hubs is very short. Could not find any more. The Mixtile hub looks promising and further information will be provided as it becomes available.
To control Zigbee devices, a Zigbee controller is required.
Home Assistant has a review and recommendations for Zigbee interface devices.
Inexpensive CC2531 USB Dongle - Technical skills required to flash firmware. May require a programmer.
To control Z-Wave devices, a Z-Wave controller is required.
Home Assistant has a review and recommendations for Z-Wave interface devices.
Choose a combination interface device if you want to control both Zigbee and Z-Wave devices for maximum flexibility.
The Nortek HUSBZB-1 combo device is known to work with Home Assistant and has been verified with SecureOffice / Home Assistant.
Whichever interface device is chosen for Z-Wave and / or Zigbee, it will appear as a tty device in "/dev". The device path must be known to configure HA to use the interface. To find the path of your interface USB stick, connect it (for very first time or after a reboot) to your system and enter:
"ls -la /dev/tty* | grep dialout"
This will output something like below:
crw-rw---- 1 root dialout 4, 64 May 20 14:14 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 May 20 14:14 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 May 20 14:14 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 May 20 14:14 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 May 20 14:14 /dev/ttyS4
crw-rw---- 1 root dialout 188, 1 May 20 15:21 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 2 May 20 15:21 /dev/ttyUSB1
The USB devices with the most recent timestamp were inserted last. The above output is for a Nortek HUSBZB-1 combo device. Trial and error proved that "/dev/ttyUSB0" is Z-Wave, "/dev/ttyUSB1" is Zigbee.
|
Technologies Used: