Skip to content

Container image creates the environment for HomeSeer software to run

License

Notifications You must be signed in to change notification settings

erkerb4/container-homeseer4

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Docker Repository on Quay

HomeSeer HS4 Container Image

This image containerizes the HomeSeer HS4 home automation software.

Here are few changes/additions to this container image:

  • You can set a specific version of HS4
  • Mono patch could be applied to help loading ASPX pages on Linux
  • Latest version of S6 layer is pulled during build time
  • Ability to run HomeSeer with unpriviledged account in the container
  • HS is configured to run on a unpriv port within container
  • Take a tar backup of homeseer prior to upgrade

Running the HomeSeer Container

Running with docker/podman run

docker/podman run -d \
    --name homeseer \
    --hostname homeseer \
    -e LINUX_ASPX=true \
    -e HOMESEER_VERSION=4_1_15_0 \
    -e HS_RUNASUSER=true \ ## optional, explanation below
    -e USER_NAME=homeseer \ ## optional, explanation below
    -e HS_PORT_OVRD=true \ ## optional, explanation below
    -e PUID=1001 \ ## optional, explanation below
    -e PGID=1001 \ ## optional, explanation below
    -v /opt/homeseer:/homeseer \
    -v /opt/backup:/backup \  ## recommended, explanation below
    -v /etc/localtime:/etc/localtime:ro \
    -p 1080:1080 \  ## WebUI will respond on 1080
    -p 10200:10200 \
    -p 10300:10300 \
    -p 10401:10401 \
    -p 11000:11000 \
    --device /dev/ttyACM0 \ ## Your USB mount may differ
    --log-opt max-size=50mb \ ## Set stdout logging to 50mb, otherwise it will fill your partition
    quay.io/erkerb4/homeseer4:latest

Running with docker/podman run w/ host-networking

If you use the host network mode for a container, that container’s network stack is not isolated from the host (container shares the host/s networking namespace) and the container does not get its own IP. Running the container with host-networking will resolve issues connecting HomeSeer locally using HomeSeer app, and connecting to speaker-clients on start.

docker/podman run -d \
    --name homeseer \
    --hostname homeseer \
    -e LINUX_ASPX=true \
    -e HOMESEER_VERSION=4_1_15_0 \
    -e HS_RUNASUSER=true \ ## optional, explanation below
    -e USER_NAME=homeseer \ ## optional, explanation below
    -e HS_PORT_OVRD=true \ ## optional, explanation below
    -e PUID=1001 \ ## optional, explanation below
    -e PGID=1001 \ ## optional, explanation below
    -v /opt/homeseer:/homeseer \
    -v /opt/backup:/backup \  ## recommended, explanation below
    -v /etc/localtime:/etc/localtime:ro \
    --net=host \
    --device /dev/ttyACM0 \ ## Your USB mount may differ
    --log-opt max-size=50mb \ ## Set stdout logging to 50mb, otherwise it will fill your partition
    quay.io/erkerb4/homeseer4:latest

Options:

--name homeseer: Names the container "homeseer"
--hostname homeseer: Configures the hostname of the container instance to "homeseer"
-e LINUX_ASPX : Applies the mono fix to help load ASPX pages in Linux documented in HomeSeer Forums. Accepted values are true/false
-e HOMESEER_VERSION : Downloads the desired version of HomeSeer4 release to run in the container
-e HS_RUNASUSER : This parameter configures a regular user account in the container, and runs HomeSeer software with that user. It is enabled by default. Accepts true/false. Make sure to follow "Setting udev rule for USB Device for homeseer" section
-e PUID : for UserID, used if HS_RUNASUSER flag is set to true
-e PUID : for GroupID, used if HS_RUNASUSER flag is set to true
-e USER_NAME : Configures the name of the user account in the container. Used if HS_RUNASUSER flag is set to true and defaults to username homeseer
-e HS_PORT_OVRD : If set true, it will set the WEBUI port to 1080. Default is false. -v /opt/homeseer:/homeseer: Mount /opt/homeseer (or the directory of your choice on your house) to /homeseer in container to persistent state. This directory on the host will contain the complete HomeSeer installation and could be moved between systems if necessary (be sure to shutdown HomeSeer cleanly first, via Tools - System - Shutdown HomeSeer)
-v /opt/backup:/backup: Backup of the homeseer directory will be taken prior to upgrade. Highly recommended
-v /etc/localtime:/etc/localtime:ro: Ensure the container has the correct localtime
-p 1080:1080: Port 1080, used by the HomeSeer web user interface (specify a different WebUI listen port by changing the first number, e.g.)
-p 10200:10200: Port 10200, used by HSTouch
-p 10300:10300: Port 10300, used by myHS
-p 10401:10401: Port 10401, used by speaker clients
--device /dev/ttyACM0: Pass a USB device at /dev/ttyACM0 (i.e. a USB Zwave interface) into the container; replace ttyACM0 with the actual name of your device (e.g. ttyUSB1, ttyACM0, etc.)
erkerb4/homeseer4:latest: See below for descriptions of available image tags

User / Group Identifiers

When using volumes (-v flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id user as below:

  $ id username
    uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)

Setting udev rule for USB Device for homeseer

If you are setting HS_RUNASUSER to true, you will need to configure this. By default, serial devices are mounted so that only root users can access the device. We need to add a udev rule to make them readable by non-root users. In this case, when homeseer runs as non-root user in the container, it is not be able to access the USB device (it'll get Permission Denied, because homeseer user is a regular user, and won't be able to access device that requires root).

Create a file named /etc/udev/rules.d/99-zwavestick.rules on the host. Add the following line to that file:

KERNEL=="ttyACM0",MODE="0666"

MODE="0666" will give all users read/write (but not execute) permissions to your ttyUSB devices. This is the most permissive option, and you may want to restrict this further depending on your security requirements. You can read up on udev to learn more about controlling what happens when a device is plugged into a Linux gateway.

WebUI Port Changes

To make it easier to run the container rootless, I've changed to port to listen to 1080.

You can create a UFW rules to forward 80-->1080, so that you can get to it without specifying a port number with your browser.

Available Image Tags

Tag Description
latest The latest version of container environment to run HomeSeer4 software
develop Tag used for experimentation, or updating logic/configuration. Changes will eventually get merged to master/latest branch

Updating HomeSeer

You can control the version of HS4 running with the container. Container is just the environment that HS4 needs to run. It makes it easier to control/maintain all the dependencies. When container runs for the first time, it will download and install desired version of HomeSeer4. When you update the version of HS4, it will download the desired version, and update the instance. Container is merely a shell for HS4, and I will update it regularly to ensure environment is up-to-date. To update HS4, do the following

docker/podman stop homeseer [or, whatever name you gave to the container via the --name parameter]
docker/podman rm homeseer [or, whatever name you gave to the container via the --name parameter]
Take the docker/podman run command above, and update -e HOMESEER_VERSION= parameter

...then re-create your container using the same command-line parameters used at first run. The new HomeSeer version will be downloaded and installed when the container is run. Your existing user data, plugins, etc., will be preserved.

Updating Container

docker/podman stop homeseer [or, whatever name you gave to the container via the --name parameter]
docker/podman rm homeseer [or, whatever name you gave to the container via the --name parameter]
docker/podman pull quay.io/erkerb4/homeseer4:latest Take the docker/podman run command above, and update -e HOMESEER_VERSION= parameter

Gotchas / Known Issues

HomeSeer is fundamentally a Windows program that runs under the Mono framework on Linux. As such, it does not correctly respond to Unix signals (e.g. SIGTERM, SIGKILL, etc. ). For this reason, the docker/podman stop command does not cleanly shutdown HomeSeer. Instead, shutdown HomeSeer cleanly via Tools - System - Shutdown HomeSeer, which will also stop the container.

HomeSeer will be installed when container is started for the first time. Starting/restarting the container will not trigger reinstallation. The only time HS is downloaded is when you update the HS4 release version.

This image currently only runs on amd64/x86_64.

When you run the container without host-networking devices, you may experience difficulties automatically connecting to speaker clients on your network (such as Google Hub/Home devices). Manual connection would work, but it's not ideal. If you have Google Hub devices, it will b better to use host-networking. (unless there is another way..)

Running HomeSeer locally/from home

When you are running the container, you will notice that MyHS service may not correctly identify the local IP when you are connecting locally with HomeSeer App. This is because, MyHS registers the container IP as local, which will not be routable from your home network. There seem to be two possible way to address this:

  1. When using HomeSeer app locally, logout from your system and manually connect using IP/hostname. Remote connection, and local seem to work. OR
  2. Use host networking when running the container. (remove the ports and run the container with --network host). For more information host networking

Acknowledgments

This is a fork from E1iTeDa357/docker-homeseer4 image with few changes.

This image was inspired by @marthoc's HomeSeer image (on Docker Hub at marthoc/homeseer), and E1iTeDa357/docker-homeseer4. Thanks to @luck-y13 for updating DockerFile to latest version.

Wish-List

  • Find a dynamic way to find the latest stable version of HomeSeer4
  • Figure out a way to properly shutdown?
  • Find a better way for setting udev rule for USB Device for homeseer

About

Container image creates the environment for HomeSeer software to run

Resources

License

Stars

Watchers

Forks

Languages

  • Dockerfile 89.3%
  • Smarty 10.7%