Skip to content

# Importing ReactorSensors from Vera Reactor

If you're a Vera Reactor plugin user and you want to try or move to Multi-System Reactor, an import tool is provided to the bulk (but not all) of the work of getting your existing automations from one system to the other. If you are not a Vera Reactor user, skip this section.

Attention

The import tool only works with Reactor (for Vera) backup files generated by version 3.6 or higher. Older backup files are not supported. It is recommended that you use a fresh backup from a current version of Vera Reactor for this process.

Vera Reactor uses ReactorSensors as containers for conditions and activities. Since that construct is a side-effect of the close tie between Vera/Luup plugins and devices, there is no such construct in Multi-System Reactor. The importer brings in each ReactorSensor as its own rule set containing, to begin, a single rule that contains all of the condition groups of the ReactorSensor. In a second pass, it finds all condition groups that are referred to by other condition groups or ReactorSensors, and upgrades them to stand-alone rules (so that they can be used in the same way in the Multi-System Reactor data model). The same is done with activities: any activity in a ReactorSensor that is run by another is upgraded to a Global Reaction in Reactor. And finally, expressions are handled in the same manner. As a result, depending on the complexity of your logic and its interdependencies, a single ReactorSensor may turn into several rules and global expressions and Reactions.

When you run the importer, you will also tell it (via the second argument on the command line) which controller ID (in `reactor.yaml`) corresponds to the Vera system from which your backup came. This lets the importer automatically connect and map the devices in the Vera Reactor structures into Reactor entities. So, make sure your Vera is configured in Reactor before running the importer, as the importer will need access to this data.

Note also that all rules created in Multi-system Reactor by the importer will be, by default, disabled. This is intentional, to prevent Reactor from running rules and reactions against your Vera devices when you Vera Reactor is still operating.

Also, just to confirm, the importer does not make any changes to your Vera system. It does not disable or unconfigure or in any other way modify any ReactorSensors on the Vera system. Even if it could, this would violate one of its major design goals: to set you up so that you can switch back and forth between control by Vera and control by Reactor at will.

Now, choose the correct section below for the way you've installed Reactor. Let's do this...

Tip

Read through this procedure and make sure you understand it before proceeding.

## For Reactor Bare Metal Installations

1. Make a fresh backup of your Vera Reactor configuration by going into its master device in the Vera UI, "Backup and Restore" tab, and clicking the "Back Up Now" button. Then download the backup file.
2. Copy the backup file to the system running Reactor. The file can be located anywhere, even `/tmp` or your home directory.
3. If you're not already there, go to the Reactor installation directory, where its `app.js` is located.
4. Make sure Reactor is running.
5. Make sure you are in the `reactor` (install) directory (where `app.js` is located).

6. Run the import script by running the command below. The `<controller-id>` should be `vera`, unless you changed it when editing the entry in the `controllers` section of `reactor.yaml`:

       node tools/import_reactor_backup.js <path-to-your-reactor-backup-file> <controller-id>

7. Restart Reactor.

## For Reactor Docker Installations

1. Make a fresh backup of your Vera Reactor configuration by going into its master device in the Vera UI, "Backup and Restore" tab, and clicking the "Back Up Now" button. Then download the backup file.
2. Copy the backup file (`reactor-config-backup.json`) to the system running Docker, and place the file in the `storage` subdirectory of the data directory you created during initial installation.

3. Attach to your running Reactor Docker container (you need to be logged in to the system running Docker):

       docker exec -it reactor /bin/sh

4. Go to the Reactor installation directory:

       cd /opt/reactor

5. Create a symbolic link:

       ln -sf /var/reactor/storage .

6. Run the import script by running the command below. The `<controller-id>` should be `vera`, unless you changed it when editing the entry in the `controllers` section of `reactor.yaml`:

       node tools/import_reactor_backup.js storage/reactor-config-backup.json <controller-id>

7. Detach from the Reactor Docker container by typing `exit`.

8. Restart Reactor.

## Completing the Install Process

You can now open a browser to the Reactor UI (refresh the UI if you already have it up in a browser), and review your imported rules. Now you may have a little work to do:

- Expressions will be imported, but the expression language is a bit different and you may have to make some adjustments.
- Concepts like house mode and geofencing are handled in Reactor by publishing entities to contain the house mode and geofence data, so House Mode and Geofence condition from Vera Reactor will be translated into Entity conditions against those new entities.
- Some Geofence conditions from Vera, specifically those that test multiple users (anyone is home), are only imported as a single condition for the first listed user; you will need to wrap that condition in an "OR" or "AND" group as appropriate, and duplicate the condition for the other users.
- There is no Run Lua action in Reactor, and there is no analogue for it.

All imported rules are disabled by default. This is intentional, to keep Reactor from suddenly manipulating your Vera devices while your Vera system's Reactor still thinks it is in charge. This also facilitates a gradual cut-over, and a quick way to back out: you can choose whether an automation is controlled by Vera or Reactor by having the automation enabled on one system and disabled on the other. Here's how I recommend you proceed:

- Start checking your imported rules and their Reactions (including any Global Reactions used) one rule set at a time (remember that a rule set contains the logic of one ReactorSensor). Make any necessary fix-ups and changes that the importer could not complete. Start with your simplest ones, just to help familiarize yourself with the new world.
- When all the rules in a rule set look right and ready to go on Reactor, disable the corresponding ReactorSensor on Vera, and then enable all the rules in the rule set on Reactor.
- Let that run, and address any additional changes that need to be made on the Reactor side for proper operation.
- If something goes badly wrong and you can't get it fixed before you are threatened with nights on the couch, simply back off using Reactor for now: disable the Reactor rules and re-enable the ReactorSensor on the Vera side. If it's a bug or something you need help fixing, report it/ask for help.

Eventually, you will have cut over all of your ReactorSensors.

Updated 2022-Aug-31