Home | Programming Resources |     Share This Page
Home Assistant / Insteon Rescue

How to configure Home Assistant and survive Insteon's collapse

P. Lutus Message Page

Copyright © 2022, P. Lutus

Most recent update:

Update | Introduction | Phase 1: Gather Information | Phase 2: Prepare the Insteon PLM | Phase 3: Install Home Assistant | Phase 4: Configure Home Assistant | Phase 5: Useful Add-Ons | Phase 6: Advanced Topics | Conclusion

(double-click any word to see its definition)

Since writing this article, I have dumped Insteon and installed all Z-Wave equipment instead (a big project). I did this because it looked like no one was going to step up and build new Insteon parts, and I had a few irreplaceable and aging parts that would completely disable my system if they failed. Read the details.

In mid-April 2022 the Insteon company abruptly ceased operations. Without warning the Insteon Website went dark and their customers found themselves cut off from some parts of their Insteon-based home automation systems.

In this article I'll show Insteon system owners how to rescue their systems, either by making their Insteon gear work again, or by transitioning to a different home automation technology, or both at once.

The key to this rescue is called "Home Assistant". It's a free, open-source, widely used environment that can integrate home automation elements from different manufacturers into a coherent system that's easy to use and is much better than the original Insteon software.

A little Background

The home automation business is a bleak landscape with many recent casualties: Charter/Spectrum, Connect, Iris, Revolv, SmartThings, Wink — and now Insteon. It may not be obvious why this business is so lethal to its players, but with a little thought, the reasons become apparent:

  • Home automation's goal is to drag a pre-technological household into the 21st century — automate and control appliances and lights, make them respond to their owner's whims, and maybe provide security as well.
  • This goal would be much better served if different companies' system talked to each other, but that is just not so, in fact it seems the players do all they can to freeze out their competitors, refuse to cooperate by sharing technology or by agreeing on a common communications protocol.
  • This refusal to cooperate results from the famously cutthroat American corporate culture, in which stock market investors see a given market segment as a zero-sum game, in which every Insteon customer is lost to Blink or vice versa.
  • To meet its customers' needs, home automation should have a shared, cooperative communications protocol, but this necessity collides with the equities market, where competition is everything. To date there's no realistic plan to resolve this conflict.
  • This is where Home Assistant steps in. Home Assistant is an application, often run as a separate guest environment running on a host, that allows different technologies to talk to each other in spite of the frankly obstructionist motives of their corporate creators.

My prior Insteon article set

Years ago, when Insteon was the "new thing", I wrote a comprehensive article set that explained how Insteon worked and presented a step-by-step installation tutorial. That earlier article set might be worth reading as this discussion unfolds.

This article assumes its readers have a certain amount of technical knowledge and a willingness to learn more.

Phase 1: Gather Information

Here's a typical (pre-Home Assistant) Insteon home automation diagram to guide this phase:

Figure 1: Insteon System Diagram

Collect Information from the Insteon Hub

Because Insteon's Internet network has gone offline, many Insteon customers report they can no longer access the administrative console part of their hubs and therefore have lost the ability to reconfigure their systems. In this section I'll describe some remedies, with the goal of preserving the information the Insteon hub contains, not to rely on it long-term. One goal of this project is the complete elimination of the Insteon-compatible hub (from all manufacturers), while at the same time recovering control over the Insteon house-wiring network.

This strategy works because Home Assistant can scan, detect and control your Insteon devices using only your Insteon PowerLinc Modem (PLM) (the green rectangle in Figure 1 above), which remains an essential part of the system.

My Insteon-compatible hub is an ISY994i-pro, (made by Universal Devices) a common hub in an Insteon network. It's my hope that these instructions will apply to similar models including those made by Insteon itself.

Why replace a working hub?

Update: readers online have aked me, since (unlike hubs built by Insteon) my specific hub will continue to work after the Insteon collapse, why not continue using it? My reply is that whenever I can replace hardware with software, I leap at the chance. Here are some of the reasons:

Property Dedicated hardware hub Home Assistant running on a Raspberry Pi
Cost US$250.00 US$42.00 (Home Assistant is free)
Software quality very low excellent
Critical failure modes numerous nonexistent

The reason the failure possibility is rated as nonexistent for the Raspberry Pi running Home Assistant is because (a) reliable backup is child's play, and (b) the Raspberry Pi approach doesn't rely on cloud resources, the vulnerability that doomed all Insteon hubs in mid-April 2022.

Typical hubs in this class provide a local Web page for everyday control and (in the case of the ISY994i-pro) an administrative console that relies on a Java applet for its functioning (for security reasons modern browsers will refuse to display Java applets). The administrative console may be accessible in some cases, but for this process I'll assume it has become inaccessible because of the collapse of Insteon, and as many Insteon users have reported. We can get the information we need just from the Web page, which in most cases remains accessible post-Insteon collapse.

The purpose of this section is to collect the names and addresses of each Insteon control in your network, so you can identify and label those controls in Home Assistant later on. Each Insteon control has a three-part hexadecimal address that looks like this: 0B.CA.55. By collecting a list of these codes in advance, the reader should be able to track and name each control in Home Assistant without guesswork.

For best results, make an organized list of each control and its hexadecimal address, so later on, when Home Assistant detects that control, you can use the hexadecimal address to locate and relabel the control with its everyday name. I recommend creating a spreadsheet with separate columns for everyday name and address, but a plain-text list will work.

Make a list of friendly names and Insteon addresses

Here are step-by-step instructions for this information-collecting task:

  • Access the Web page of your Insteon-compatible hub as you have done in the past (this Web page should remain accessible in spite of Insteon's collapse). It should look more or less like this (image from my Universal Devices ISY-994i-pro):

  • Click on the "My Devices" link. This will show a list of named devices in your network.

  • Now hover your pointing device over each name in the list and notice the information at the lower left of your browser's display — example:

  • See the characters "C BF 84 1" in the image above? (This is just an example, your data will be different.) For similar numbers you find on your network, ignore the "1" and add the "C BF 84" part to your list along with the friendly name of the control. Be sure to add a leading zero to address numbers that have only one digit — in this case you would enter "0C BF 84".

  • Each list entry should look more or less like this:

    Control Name Address
    Lower Staircase 1 0C.BF.84
  • Do the same for each Insteon control in the Web page list. This list will help you identify your controls in Home Assistant after it automatically scans your network and detects Insteon controls. The point is that Home Assistant can only identify Insteon controls by their addresses, not their names — you need to tell Home Assistant the names you prefer.

  • The not-recommended and hard way to get this information is to remove the switch plates from every control in your house and read the original Insteon label that has the control's address. This is a bad idea, lots more work, even risky if you're not familiar with precautions around electrical equipment, and only necessary if for some reason you can no longer access your Insteon hub at all.

Phase 2: Prepare the Insteon PLM

This section's purpose is to eliminate the now-disabled Insteon-compatible hub (the orange rectangle in Figure 1 above) from your home network. The goal is to connect the existing Insteon PLM (the green rectangle in Figure 1 above) directly to a computer running Home Assistant.

For those with an Insteon 2413U:

You're in luck — with little effort, the 2413U model PLM can be directly connected to a computer for use with Home Assistant. The 2413U looks like this:

The connector at the bottom of this PLM is a standard USB connection, so an ordinary USB cable is all that's required to connect to a computer:

For those with an Insteon 2413S:

This task is only necessary if you have the Insteon 2413S, a serial PLM with a network-style RJ45 connector — it looks like this:

The connector at the bottom is a network-style RJ45 with eight conductors. To connect this PLM to a computer without an Insteon-compatible hub, you need to create a somewhat complex cable adaptor that allows connection to a USB serial adaptor. You will need:

  • Any convenient length of RJ45 network cable:

  • A special RJ45 to DB9 serial adaptor (StarTech GC98FF — Amazon link):

    Here's the wiring pinout table for this adaptor:

    RJ45 DB9 Color
    1 2 Blue
    7 5 Brown
    8 3 White
  • A USB-serial adaptor:

I just built this adaptor setup for my Insteon 2413S for use with Home Assistant, so I know it works.

Insteon Parts Shortage

Some readers may ask, "Wait, is all this engineering necessary? Can't we just buy the much-preferred Insteon 2413U that connects directly to a computer?" The answer, unfortunately, is no — on the news of Insteon's collapse, people quickly bought up all the remaining Insteon PLMs of both kinds, to avoid the parts vacuum we're now facing.

But other players may step in and fill this vacuum ...

Role of Universal Devices

Update: It's been reported that Michel Kohanim, president of Universal Devices (the original maker of my old ISY994i-pro network interface), is in talks with the current Insteon rights holders with the intention of "buying the license or perhaps the whole thing ..." and become a source for Insteon equipment. Kohanim estimates that there are 100,000 Insteon system users out there, a non-trivial marketing oportunity (direct link to the conversation). This is a new event, unfolding at I write, so expect changes and updates.

Phase 3: Install Home Assistant

After Home Assistant has been integrated into the reader's network, it will look more or less like this:

Figure 2: Insteon network plus Home Assistant

The goal in this phase is to create as little disruption as possible. If this phase is carried out correctly, everything in your Insteon network should function as it did before, but with a much better, more comprehensive control system and user interface provided by Home Assistant.

Prepare a tiny computer to host Home Assistant

The best, most reliable way to proceed is this:

  • Acquire one of the popular, inexpensive Raspberry Pi tiny computers — should be a Pi 3 or 4 model. It would be wise to also acquire a plastic case for it, for protection. This computer and its case should cost much less than the original Insteon hub it replaces.
  • Dowload a copy of the Home Assistant software suitable for your Raspberry Pi, from this page. Be sure to choose a 64-bit version of the software — both the Raspberry Pi 3 and 4 models are 64-bit.
  • Using the instructions on this page, flash the software onto a micro USB (preferred) device, or a USB stick, of adequate size (32 GB or larger).
  • Plug the micro USB device or USB stick into your Raspberry Pi computer.
  • Connect your Insteon PLM to the Pi using the instructions from the prior section.
  • Make a network connection:
    • Preferred: connect the Pi to your home network using an Ethernet cable (faster and more efficient during the lengthy automatic setup process).
    • Alternate: rely on your home wireless network to communicate with the Pi (slower during setup). This approach may require that you connect a keyboard and display to the Pi to be able to enter a WiFi access password if one exists on your network (as it should).
  • Power up the Raspberry Pi.
  • After 20-30 minutes of automatic setup/configuration, Home Assistant should appear on your home network with the default URL http://homeassistant.local:8123, and you can begin detailed setup and customization. In fact, if all necessary steps have been taken and enough setup time has elapsed, clicking this link should connect you to your local instance of Home Assistant.

Other Options

An alternative install path for Home Assistant is to download a custom virtual machine (VM) version tailored to one of several existing VM manager programs, and install Home Assistant into a user-created VM using VirtualBox, Vmware or Hyper-V, using the instructions on this page. However, the Raspberry Pi install method is easier, more reliable and is much preferred.

Phase 4: Configure Home Assistant

Home Assistant works with home automation products from many different manufacturers, which is one reason I chose it for this project. If parts of your Insteon network fail, if replacement parts become unavailable over time, you can add components from other manufacturers incrementally while retaining some Insteon elements, rather than having to completely dismantle your Insteon network in one go.

At the end of the prior section's activities, plus some time delay for automatic setup activities, your Home Assistant install will become available using this link. This Home Assistant Web page explains the first steps in configuring your Home Assistant. Briefly, the program will ask you to set up a user and password, then establish your location and time zone.

Then the program will list any non-Insteon home automation devices it has automatically detected. If your home network is entirely Insteon-based, the program won't detect any devices yet — for that we need to install a Home Assistant add-on meant for Insteon devices.

Install Insteon integration

Click here for the Home Assistant Insteon instruction page (my instructions below are clearer and easier to follow).

After the preliminaries are complete and you have clicked "Finish", you will see the default Home Assistant home page. To detect your Insteon devices and make them accessible to Home Assistant, you need to install what is called an "integration" meant for Insteon devices:

  • Click "Settings", a gear icon at the lower left.
  • From the list that will appear, click "Devices & Services" (or click this link).
  • You will see a list of currently-installed integrations plus a button at the lower right labeled "Add Integration". Click that button.
  • A search dialog will appear that allows you to enter a partial search string to whittle down what will otherwise be a very long list of available integrations. Enter "insteon" as a search term.
  • This search should produce a single result named "Insteon". Click that choice and the Insteon integration will be installed.
  • Once installed, the Insteon module will search your network for Insteon devices. This is why it's important to have the Insteon PLM connected to the computer running Home Assistant in advance of this step (as shown in Figure 2 above). But don't worry — you can re-scan your network later.

Insteon networks have some quirks. One is that battery-operated Insteon devices (motion devices, remote controls, etc.) need to be put in "pairing mode" (details in each device's literature) in order for the Insteon integration to find and list them. Devices connected to power — switches etc. — don't need this step, but battery-operated devices do.

Force a network re-scan

The Insteon integration will periodically but randomly re-scan your network on an arbitrary schedule, but there's a way to force an immediate rescan. This allows a battery-operated Insteon device to be prepared for detection, followed by an immediate network re-scan. Here's how to do it:

  • Click the "Developer Tools" icon (a hammer in recent Home Assistant versions) at the lower left.
  • Click the "Services" tab at the top of the display.
  • In the "Service" search window, enter "insteon".
  • From the resulting list, select "Insteon: Load all link database". This is a manual re-scan that tries to locate any Insteon devices in your network. Warning — this scan can be slow, be prepared to wait a significant amount of time for results.
  • Prepare any battery-operated devices for detection, usually by putting them into "linking mode", using the instructions specific to the devices.
  • You have the option of deleting and reloading all records, by clicking the "Reload All Records" checkbox. This is useful if a prior scan misidentified one or more Insteon controls.
  • Under the "Entity" entry window, type "all". This will scan for any and all Insteon devices — the most productive, but the slowest, scan mode.
  • Once you have entered "all" as an entity identifier, the activation button at the lower left labeled "Call Service" will become active.
  • Click the "Call Service" button, then walk your dog, or read "War & Peace", something that requires patience.

Give devices friendly names

Once Home Assistant has a list of local network Insteon devices (which Home Assistant called "entities"), you can use them for your home automation activities. But first you should give the entities useful names:

  • Click the "Settings" icon (a gear in recent Home Assistant versions) at the lower left.
  • Click "Device & Services".
  • The Insteon integration will show two links, named "(number) devices" and "(number) entities".
  • Click the "(number) entities" link, which will show a list of entities the Insteon integration detected in its searches.
  • In this step you will use the list of addresses and friendly names you created earlier, to make the entities easier to recognize and use.
  • For each entity in the list, click its row and use your previously compiled cross-reference table to give it a friendly name.
  • Each entity will have a device identifier and address, example "switch.on_off_module_2d_33_7a". The device address is the group at the right — in this hypothetical example, "2d_33_7a" would correspond to "2D.33.7A" in your list.
  • Find the corresponding address in your list and enter the friendly name you chose in the "Name" entry.

This step is needed because Home Assistant can find Insteon devices, but the devices only have hexadecimal addresses, not the friendly names you gave them in the old Insteon hub software — you must restore that lost information.

Phase 5: Useful Add-Ons

At this point your home automation network should be reasonably integrated with the general Home Assistant environment, so most of the methods common to all home automation devices (not specific to Insteon) should work as expected. This means you may benefit from visiting and reading the main Home Assistant documentation pages for configuration tips and methods.

This section describes some Home Assistant add-ons/changes the reader may find useful in advanced configuration and programming activities.

Terminal & SSH Add-On

For those who want to customize and control Home Assistant in detail, the most important addition is a way to remotely access its configuration and programming files. For this we need a Secure Shell server, and as it happens, one is available and easily installed.

  • Click the "Settings icon (a gear at the lower left).
  • Click the "Add-Ons" list item (or click this link).
  • At the lower right you will see a button: "Add-On Store". Click it.
  • In the search dialog that will appear, enter "terminal & ssh".
  • This entry should produce one result: "Terminal & SSH — Allow logging in remotely to Home Assistant using SSH". Click that result.
  • A detailed page will open up including an "Install" link. Click the link to install this add-on.
  • After the install is complete, an item named "Terminal & SSH" will appear on the "Add-Ons" page. Click the "Terminal & SSH" item to reveal its options.
  • Among the selectors on this page will be one called "Show in Sidebar." Select that option.
  • At the top of the "Terminal & SSH" display you will see a row of options including "Configuration". Click that option (this gives you easy access to a command-line terminal).
  • Among the available configurations are:
    • Options/Password: choose a suitable password to access your Home Assistant server on your local network.
    • Network/SSH Port: For local network access, enter port number 22 unless you have a compelling reason to use another port.
  • Having made these entries, click "Save" at the lower right.
  • Now return to the main "Terminal & SSH" access page and click "Restart". This action will make a Secure Shell server available on your local network.
  • Let's test this plugin by accessing the Secure Shell server and the Home Assistant instance:
    • From Linux (wait ... you're not running Linux?):
      • Open a terminal and enter:
      • ssh root@homeassistant.local
      • (When accessing Home Assistant by Secure Shell, you're always root, so be careful.)
      • Enter the password you chose for access.
      • At this point you should see a terminal-based Home Assistant welcoming page:
        username@servername:~$ ssh root@homeassistant.local
        | |  | |                          /\           (_)   | |            | |  
        | |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_ 
        |  __  |/ _ \| '_ \ _ \ / _ \   / /\ \ / __/ __| / __| __/ _\ | '_ \| __|
        | |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_ 
        |_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|
        Welcome to the Home Assistant command line.
        System information
          IPv4 addresses for eth0:  xxx.xxx.xxx.xxx/24
          IPv6 addresses for eth0:  xxxx:xxxx:xxxx:xxxx/64
          IPv4 addresses for wlan0: 
          OS Version:               Home Assistant OS 7.6
          Home Assistant Core:      2022.5.1
          Home Assistant URL:       http://homeassistant.local:8123
          Observer URL:             http://homeassistant.local:4357
          [core-ssh ~]$ |
      • To avoid having to enter a password for local logins, log out and issue this command:
      • ssh-copy-id root@homeassistant.local
      • This command copies your public authorization key onto the server and eliminates the password requirement for future logins.
    • From Windows 10/11 (it's okay, you'll figure out why Linux is better):
      • Windows doesn't have any built-in Secure Shell abilities or applications. The explanation is simple — Microsoft doesn't own it, it's open-source, so ... forget it.
      • But intense user pressure has compelled Microsoft to allow Secure Shell as an optional user-installed component.
      • Follow this guide to install Secure Shell on Windows 10. For this specific task, you only need the client component (but a Secure Shell server is a very nice addition to Windows).
      • When the install is complete, open a PowerShell instance.
      • Enter this Secure Shell login command:
      • ssh root@homeassistant.local
      • Enter the password you chose for Home Assistant Secure Shell access.
      • This login should produce a terminal-based Home Assistant welcoming page in your Windows PowerShell session:
        PS C:\Users\username> ssh root@homeassistant.local
        | |  | |                          /\           (_)   | |            | |  
        | |__| | ___  _ __ ___   ___     /  \   ___ ___ _ ___| |_ __ _ _ __ | |_ 
        |  __  |/ _ \| '_ \ _ \ / _ \   / /\ \ / __/ __| / __| __/ _\ | '_ \| __|
        | |  | | (_) | | | | | |  __/  / ____ \\__ \__ \ \__ \ || (_| | | | | |_ 
        |_|  |_|\___/|_| |_| |_|\___| /_/    \_\___/___/_|___/\__\__,_|_| |_|\__|
        Welcome to the Home Assistant command line.
        System information
          IPv4 addresses for eth0:  xxx.xxx.xxx.xxx/24
          IPv6 addresses for eth0:  xxxx:xxxx:xxxx:xxxx/64
          IPv4 addresses for wlan0: 
          OS Version:               Home Assistant OS 7.6
          Home Assistant Core:      2022.5.1
          Home Assistant URL:       http://homeassistant.local:8123
          Observer URL:             http://homeassistant.local:4357
          [core-ssh ~]$ |
  • If this login should fail, re-check that you have selected a password and specified port 22 for access, and restarted the Home Assistant Secure Shell server.
  • Be careful with this root login — learn what purposes it serves and what can go wrong.
  • There are many applications for this direct terminal access, to be covered later.

Backing up the Home Assistant configuration

An important advantage to running a Secure Shell server on Home Assistant is that you can make a copy of the current system configuration for safekeeping. Home Assistant has an integrated backup utility, but I prefer to make a separate backup of the configuration against the possibility of a serious failure (example, a failed/failing micro USB storage device on the Raspberry Pi) that might make both the original and any backups inaccessible and require reinstalling Home Assistant from scratch.

As before, there are two approaches to getting GUI file explorer access to Home Assistant, one for Linux, one for Windows:

  • From Linux:
    • Open a file explorer that has an address bar option for direct user entry of an URL (in Nautilus, a.k.a. Files, press Ctrl+L to show the address bar) and make this entry:
    • sftp://homeassistant.local
    • If all prior configuration steps have been taken and if Linux has been configured correctly, this should produce a list of the Home Assistant root directory with some identifying directory names: /addons, /backup, /config, and many others, clear indications that you're looking at the Home Assistant filesystem.
    • To make a backup of your Home Assistant configuration that will survive even a complete failure of the micro USB card (yes, they do fail), copy the /config directory to another location. This can be accomplished by simply dragging the folder name /config to a suitable backup location.
    • Make sure you're making a copy of this important directory, not moving the directory itself or creating a symbolic link, the two other common actions resulting from a drag gesture in a Linux file explorer.
  • From Windows 10/11:
    • Windows doesn't have any built-in Secure Shell abilities or applications. The explanation is simple — Microsoft doesn't own it, it's open-source, so ... forget it.
    • But you can install a third-party Secure Shell-aware file explorer to allow easy file/folder transfers and backups. The best-known is WinSCP — download and install it.
    • Having install WinSCP, open the application and enter your login information:
      • For host name, enter homeassistant.local.
      • For user name, enter root.
      • Enter the password you chose for the Terminal & SSH plugin of Home Assistant.
      • Click the "Login" button and you should see a list of Home Assistant directories including /config.
    • Now you can make a copy of the Home Assistant /config directory to one or more backup locations.
Phase 6: Advanced Topics

YAML Issues

Most advanced Home Assistant programming is accomplished by way of YAML ("Yet Another Markup Language") files. YAML files are very tricky to get right, even for seasoned programmers, so the Home Assistant automation management module hides the underlying YAML syntax with a "Visual Editor" that allows the user to make simple entries that create many kinds of home automation.

That's fine, until you try to do something that Home Assistant can't do. One of those things is join several house controls into a group that, when any one of the controls is activated, all the others respond in kind. This makes it possible to turn one switch on or off, and the other controls that are members of the group turn on or off also.

Those familiar with Home Assistant may object that Home Assistant can do that — from the Home Assistant user interface. From the user interface, if you activate a control that has been made a member of a group-entity card, all the other controls will respond in kind. That's true, but if you switch one of the controls directly (not by way of the Home Assistant user interface), it won't work.

To address this problem, I wrote the following YAML script. It's the first of several YAML script examples that provide missing abilities and useful functions, things one can't create through the visual editor.

Remember about these script examples that to use them, you need to replace my example entity_id list with entity identifiers acquired from your own Home Automation configuration.

YAML Example 1: Joining Controls

The original Insteon hub administration console had a way to join controls together to make controls function in unison (something called "scenes"), but when I retired my Insteon hub I intentionally erased all links between controls, scenes and all other associations, realizing that if I didn't do it then, I would have to manually clear each control later on in order to change their relationships. I took this step because I knew I would be able to create software associations between controls, which is a much better, more flexible control method than physically programming devices to force a particular relationship.

After some programming and testing I now have a way to join sets of controls using a YAML script that responds to the physical activation of any particular control in a defined group, so the other group members automatically respond in the same way — without needing to do this by way of the Home Assistant user interface. Here's an example automation script that joins controls so they act in concert if any one of them is turned on or off:

alias: join trigger living room
description: ''
  - platform: state
      - switch.switchlinc_relay_0b_ba_1d
      - switch.togglelinc_on_off_56_0f_2f
      - switch.togglelinc_on_off_58_20_91
  - delay: 00:00:01
  - service: "switch.turn_{{ trigger.to_state.state }}"
        - switch.switchlinc_relay_0b_ba_1d
        - switch.togglelinc_on_off_56_0f_2f
        - switch.togglelinc_on_off_58_20_91
mode: single

NOTE: After some testing, I edited the above YAML script to include a one-second delay between state detection and activation. Because Insteon networks aren't protected against packet collisions, this delay produced a significant reliability improvement.

Remember again that to use this script you need to replace the entity_id lists with entity identifiers from your own Home Asistant configuration. Also, you need to create a separate automation for each control group you want to act in concert (I have 9 separate control joining scripts in my somewhat complicated home automation setup). And see below for a way to create individual YAML scripts for each automation, which is a way to simplify the management of complex configurations like mine.

This method works and doesn't require the user to activate the control from the Home Assistant user interface (but that remains an option). It responds more slowly than the old Insteon hardware-linking method, but it's a pure software solution, which means no more manual linking of Insteon controls, and easy reconfiguration with a keyboard instead of a screwdriver. It should work with other kinds of home automation controls, not just those from Insteon.

Even though it solves the issue I wanted addressed, this script shows one of the many drawbacks to YAML as a scripting language. Obviously it would be better to list the grouped controls just once and use a variable to refer to them, to avoid having to list them twice, but to date (May 2022) there's nothing like this in Home Assistant.

YAML Example 2: Lights On, Lights Off.

These two scripts turn user-selected lights on around sunset, then turns all lights off at a user-specificed time. This has many practical applications including making your house look occupied when you're traveling.

Lights On

alias: 'Chosen Lights On Near Sunset'
description: Automatically turn on selected lights/devices at a time near sunset
  - platform: sun
    event: sunset
    offset: '-00:30:00'
  - service: switch.turn_on
      - switch.switchlinc_relay_0b_ba_1d
      - switch.switchlinc_relay_0b_ca_55
mode: single

A simple script, very reliable. Choose any time offset that suits your needs. Now for its partner:

Lights Off

alias: 'All Lights Off At Defined Time'
description: Automatically turn off all lights/devices at a user-specified time
  - platform: time
    at: '02:00:00'
  - service: switch.turn_off
    entity_id: all
mode: single

This script uses a special argument 'all' instead of an entity_id list. This special argument applies the defined action to all lights and devices in your network. If all you have are lights and switches that control other similar devices, then 'all' will work, but if you have devices that must run 24/7, you'll need to make a detailed list of entities to which the command applies.

YAML Example 3: Motion Sensor Actions

I have an Insteon motion sensor, battery operated, model 2842-222, looks like this:

Insteon 2842-222 Motion Sensor

This device includes three sensors, separately identified and usable by Home Assistant -- motion, light/dark and low battery. Each of them can be made to trigger a separate action. So you can activate exterior lights for a specified time interval if motion is detected --

alias: Motion Detector Exterior Lights
description: Activate a specified light on detected motion, after sunset
  - platform: state
    entity_id: binary_sensor.motion_sensor_37_b7_82_motion
    to: 'on'
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  - service: switch.turn_on
      entity_id: switch.switchlinc_relay_dual_band_23_f3_cb
    data: {}
  - delay: '00:05:00'
  - service: switch.turn_off
      entity_id: switch.switchlinc_relay_dual_band_23_f3_cb
    data: {}
mode: restart

-- and you can alert the Home Assistant operator if the battery is getting weak:

alias: Motion Detector Low Battery Alert
description: Create a persistent alert when the motion detector's battery is low
  - platform: state
    entity_id: binary_sensor.motion_sensor_37_b7_82_battery
    to: 'on'
  - service: persistent_notification.create
      title: 'Home Assistant: Motion Sensor Battery Monitor'
      message: 'Low battery detected in motion sensor.'
mode: single

This script creates a Home Assistant alert that would be difficult to miss, upon detecting a low battery condition.

Module Detection Issues

The only problem with the motion sensor module is that it's battery operated, so it's difficult to make Home Assistant detect it. Forcing a detection involves removing the device's battery cover, pressing a button to put the device in pairing mode, then running a Home Assistant Insteon scan for new devices immediately afterward as explained here.

Separate YAML automation scripts

By default Home Assistant uses a single script file for all its automations. This single file is located in the Home Assistant filesystem at /config/automations.yaml. In the file, each automation is separated by a unique identifier number. The file looks more or less like this:

- id: '1651435471354'            
alias: Example automation
# remainder of script
- id: '1651520849957'
alias: Another example
# remainder of script

This is acceptable if you have only a few automations and don't need to edit them outside Home Assistant, but as the number of automations increases, and in particular if you have script content that the visual editor can't handle, this single-file scheme quickly becomes unworkable. Here's a way to create one file per automation, stored in a separate directory:

  • Log into Home Assistant using the Secure Shell access method described in a prior section.
  • Move to the /config subdirectory:  cd /config
  • Create a new subdirectory:  mkdir automations
  • Now edit the configuration.yaml file:  nano configuration.yaml
  • Go to the line that will originally either (a) be not be present or (b) look like this:
    automation: !include automations.yaml
  • Edit (or add) the line so it looks like this:
    automation: !include_dir_list automations
  • Save the edited result.
  • Create as many individual automation files you want and put them in the new automation directory. You can do this by editing the original automations.yaml file and extracting individual automations (without their ID numbers) and placing them in separate files, each of which should be stored in the new automations directory.
  • When you have made these changes and created the new files, reload the automation configuration:
    • Click the "Developer Tools" icon (a hammer) at the lower left -- or click this link.
    • Under Developer Tools, choose the YAML tab -- or click this link.
    • Under the YAML configuration list, reloading, click the "automations" link.
    • This action reloads the automations configuration and (in this case) will read the files in the new automations directory.
    • If while reading your scripts Home Assistant detects any syntax or other errors, it will provide an alert dialog.
    • The new automations should be listed here, each with an activation/deactivation control.
  • For an installation with a large number of automations these changes represent a better way to organize them, but it prevents use of the automation visual editor. From this point onward you'll be editing the automation files directly using the rules of YAML syntax. But at the point where you need to have individual automation files, the visual editor will likely have become more a hindrance than a help.

My goals in this article are to:

  • Minimize the harm done by the collapse of Insteon.
  • Allow Insteon network owners to transition away from their dependence on Insteon while keeping their existing hardware.
  • Show a way to incrementally move toward newer home automation devices/methods and eventually retire the original Insteon devices as they wear out.
  • Introduce Home Assistant to people who might not be aware of it.

I hope I've succeeded in some of these goals. Thanks for reading!

Home | Programming Resources |     Share This Page