We will configure the Home Assistant Docker stack and bring the stack up through Portainer. The stack consists of the following container:
- Home Assistant: Home automation engine.
- Run:
./scripts/create_home_assistant_folder.sh
to generate the container directory on the SSD. - Edit the stack file:
nano ./files/home-assistant-stack.yml
. - Replace
TZ=America/New_York
with your system time zone. You can use this list as a reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - If you are not going to expose the server to the internet, remove the
nginx
network. - Set the attribute
ipv4_address
in thehomeassistant
container with an IP in the non-assignable range of the DHCP. For example 192.168.1.11. - Copy all contents of the file to the clipboard. Save and exit with
Ctrl + X, Y, Enter
. - Add stack in Portainer from the browser.
- Access Portainer through https://192.168.1.253:9443. If you get a security alert, you can accept the risk since Portainer uses a self-signed SSL certificate.
- Click "Get Started" and then select "local."
- Select "Stacks" and create a new stack.
- Name it "home-assistant" and paste the content of the home-assistant-stack.yml that you copied to the clipboard and create the stack. From now on, modifications to the stack must be made through Portainer and not in the file.
- Access Home Assistant through http://192.168.1.11:8123.
- Use the wizard to create a user account and password. It is again recommended to use Bitwarden for the same.
- Configure the name of the Home Assistant instance and your data and preferences with the wizard.
- Choose whether you want to send usage data to the Home Assistant page.
- Finish the wizard.
- Configure Webhook for notifications.
- Navigate to "Settings" > "Automations & Scenes".
- Click "Create Automation".
- Click "Create new Automation".
- Click "Add Trigger".
- Search for "Webhook" and select.
- Name the trigger "A Problem is reported".
- Change the webhook id to "notify".
- Click on the configuration gear and enable only "POST" and "Only accessible from the local network".
- Click "Add Action".
- Search for "send persistent notification" and select.
- Click on the Action Menu and select "Edit in YAML" and add the following:
alias: Notify Web service: notify.persistent_notification metadata: {} data: title: Issue found in server! message: "Issue in server: {{trigger.json.problem}}"
- If you want to receive notifications on your cell phone, you must first download the application to your cell phone and log in to Home Assistant from it. Then configure the following:
- Click "Add Action".
- Search for "mobile" and select "Send notification via mobile_app".
- Click on the Action Menu and select "Edit in YAML" and add the following:
alias: Notify Mobile service: notify.mobile_app_{mobile_name} metadata: {} data: title: Issue found in server! message: "Issue in server: {{trigger.json.problem}}"
- Save.