I'm currently preparing a workshop on home automation, which will focus on Home Assistant and .NET Core. This workshop should teach my attendees how to use Home Assistant, but can they do this without devices? I can't ask them to buy some smart devices just for this workshop, so what could I do? My idea is to have them install Home Assistant, and use the demo platform.
demoplatform allows you to use integrations which are providing a demo of their implementation. The demo entities are dummies but show you how the actual platform looks like. This way you can run own demonstration instance like the online Home Assistant demo or
hass --demo-modebut combined with your own real/functional platforms.
One problem is solved, but this still means that I have to install Home Assistant on each laptop. Fortunately, Home Assistant works on every major operating system, so what's the fastest way to install it? I don't want to waste a lot of time from my workshop with this. I need something that works from the first try, regardless of the OS. So far I tried Windows 10, Ubuntu in a VM, and Raspberry Pi 4. The easiest and fastest way was to use the Docker image on each of them. On Ubuntu and Raspbian it worked flawlessly from the first try, but on Windows... it wasn't that easy.
The installation docs say that on Windows you should use --net=host. Once you have your container, you have to get its IP and add some port proxy rules. That way, it will let you access Home Assistant from localhost:8123. Unfortunately, using --net=host on Windows won't allocate an IP to your container, here's why:
If you use the
hostnetwork mode for a container, that container’s network stack is not isolated from the Docker host (the container shares the host’s networking namespace), and the container does not get its own IP-address allocated. For instance, if you run a container which binds to port 80 and you use
hostnetworking, the container’s application is available on port 80 on the host’s IP address.
I'm no Docker expert, but I think this means that using --net=host should work without the proxy rules. Even if I try to add those rules, I need the IP of the container which is not allocated, so what could I do? My idea was to run the command without using --net=host and instead add a binding for port 8123 like this:
Once I did this, I was able to navigate to http://localhost:8123/ and the Home Assistant instance was there. If there's a Docker guru reading this I'm really curious why the installation steps don't work. Is it something that changed in Docker and the docs weren't updated? Or maybe this doesn't work for a few users but the vast majority can use --net=host? Probably I'll add a PR with my suggestion and then I'll get some answers. Either it gets merged and I'll have my first contribution there, or someone will explain this better to me.
Bonus - using the demo platform
Once I got my instance up and running, I added some demo integrations, and it was really easy. Here's how something basic looks like:
To achieve this, you have to modify configuration.yaml. The file is located in the folder that I specified when I ran the Docker command("d:/hassio" in my case).
These are the few lines that produce the dashboard above:
configuration.yaml with demo platform
If you don't have any smart devices yet, go ahead and play with the demo platform. It will give you an overview of Home Assistant and its features. Probably this is the best way to decide if you want to go with it or try something else.