Skip to content

# Installing Reactor on Home Assistant OS

Before following this procedure, you should have Home Assistant OS installed, configured, up and running on your target hardware.

To run Reactor on Home Assistant OS, you will install Portainer, a tool for managing containers via a graphical user interface (GUI). To install Portainer:

1. Log in to your Hass system
2. Go to Supervisor (left margin)
3. Click Add-on Store (top of page)
4. Type `Portainer` in the search field.
5. Click on the Portainer listing.
6. Click on INSTALL.
7. When the install completes, click START.

   > NOTE: I had to turn "Protection Mode" off to get Portainer to start and run on my system.

8. When Portainer has started, click OPEN WEB UI

Now that Portainer is installed and running, let's create and start the Reactor container. Before you dive into this, you'll need to device where you want to store your Reactor data. The Reactor data (which includes configuration, state data, logs, etc.) needs to be stored outside the container, or you'll lose all of your settings and rules every time you upgrade/recreate the container. You have several choices here, including CIFS and NFS volumes that you may have mounted in your HassOS configuration. For this procedure, we'll keep it simple and just store it in your user home directory (in `/home/username`) on the HassOS system.

1. Create your Reactor data directory. You can do this via SSH by logging in and typeing `mkdir -p /home/username/reactor-data` or you can use the XXXX to navigate to your user home directory and create the directory (folder) in the GUI.
2. In the Portainer UI, click on "Primary"
3. Click Volumes
4. Click Add volume
5. Name the volume `reactor-data`
6. If you want your Reactor data stored on a NFS or CIFS share, turn that on and provide the requested configuration. Otherwise, leave both switches off.
7. Click Create the volume. Portainer will show you the location of the container mount point.
8. Click Containers (left margin)
9. Click the Add container button
10. For the container name, enter `Reactor`
11. Make sure DockerHub is the selected registry.
12. In the Image field, type `toggledbits/reactor:tag`, where `tag` is `latest-raspbian-armv7l` for the latest version of Reactor (developer builds), or a released version tag (e.g. `1.0.0-raspbian-armv7l`).
13. Turn the Always pull the image switch on if you want Portainer to download a new image for each startup of the container. This may be useful if you're using `latest` to keep pace with development updates, but you risk downloading a broken/unstable image here, so it may be better to turn it off and upgrade the container manually when changes occur that you think you need. If you've selected a fixed version image (e.g. `toggledbits/reactor:1.0.0-etc`), leave this switch off. POTENTIALLY SLOW: Maybe not recommended to be on?
14. In the Network ports configuration, click public a new network port (button next to Manual network port publishing), and enter 8111 in both fields (and click the TCP button).
15. Under Advanced container settings, click Volumes
16. Next to Volume mapping, click map additional volume
17. Next to container", enter `/var/reactor` and then click the Volume* button.
18. Next to volume, select the volume previously created (`reactor-data`) and then click the Writable button.
19. Click on Env. If `TZ` is not listed, click on add environment variable and add `TZ` with the value set to your local time zone (list of valid time zone names).
20. Click on Restart policy, and choose on On failure from the available options.
21. Click Deploy the container (above the Advanced container settings section). It may take a few minutes to start if the image needs to be downloaded/updated.

If you need to view or change any of the container settings later, stop the container by selecting it in the list and clicking the Stop button. Then click on the container name, and click the Duplicate/Edit button. After editing whatever you need to change, click "Deploy the container*.

> NOTE: There seems to be a bug in Portainer where it changes the volume during editing. Make sure you check that `reactor-data` is the selected volume before you redeploy any edits.

## Upgrading your Container

If you turned on the Always pull the image switch when configuring the container, then:

1. If you are using `latest`, your container automatically updates when you restart it.
2. If you are using a fixed version, update the image tag to the new version you want to run.

If Always pull the image is off:

1. If you are using `latest`, stop the container, and then go to Images (left margin). Find the `toggledbits/reactor` image in the list, and click on the Id link in the row. Under Image tags you'll see the image's tag, and a download icon button (hover the cursor over the button, it should say "Pull from registry"). Click it. When you get a notification that the download has finished, restart the container.
2. If you are using a fixed version (or want to use a fixed version), stop the container, then click its name, then click Duplicate/Edit and change the image tag to that of the new image you want to use. Then start the container.

## Finding Your Configuration and Log Files

## The configuration and log files are stored in the directory listed under Volumes,

Install SSH * Turn on Advanced Mode in your user profile. * Go to Supervisor and choose an SSH tool (the official Terminal & SSH is a good choice if you're not sure). * When the install completes (it takes a couple of minutes), click START. * Go to COnfiguration for the add-on, and either add a password or add an authorized key. *