99 lines
2.9 KiB
Markdown
99 lines
2.9 KiB
Markdown
# Home Assistant Installation
|
||
|
||
These files allow you to deploy a Home Assistant OS virtual machine on Proxmox using Terraform.
|
||
|
||
Terraform handles the creation of the VM based on the pre-built `.qcow2` image of Home Assistant OS.
|
||
All further configuration (such as the proxy settings) is done directly from the Home Assistant web interface.
|
||
|
||
## Terraform Execution
|
||
|
||
To create the VM with Terraform, the configuration must be defined in the `terraform.tfvars` file.
|
||
You can use `terraform.tfvars.example` as a base.
|
||
|
||
Then run the following commands:
|
||
|
||
1. Initialize Terraform:
|
||
```bash
|
||
terraform init
|
||
```
|
||
|
||
2. Review the plan:
|
||
```bash
|
||
terraform plan
|
||
```
|
||
|
||
3. Apply the plan:
|
||
```bash
|
||
terraform apply
|
||
```
|
||
|
||
The process will create a new VM on the configured Proxmox node using the uploaded `.qcow2` image.
|
||
Once created, Home Assistant OS will boot automatically and obtain an IP via DHCP.
|
||
|
||
Access the web interface at:
|
||
[http://homeassistant.local:8123](http://homeassistant.local:8123)
|
||
|
||
That should work given that Pi-hole is already runing on the network
|
||
|
||
## Home Assistant Configuration
|
||
|
||
After the initial setup (creating your user and restoring backups if applicable),
|
||
you must adjust the HTTP configuration to properly support a reverse proxy such as Traefik.
|
||
|
||
To edit Home Assistant’s configuration file `configuration.yaml`, first install the File Editor add-on:
|
||
|
||
1. Open the Home Assistant web interface.
|
||
2. Go to `Settings` -> `Add-ons` -> `Add-on Store`.
|
||
3. Search for File Editor and click Install.
|
||
4. Once installed, click Start and optionally enable Show in sidebar.
|
||
|
||
Then use the File Editor to open `/config/configuration.yaml`
|
||
|
||
Add the following section
|
||
|
||
```yaml
|
||
http:
|
||
use_x_forwarded_for: true
|
||
trusted_proxies:
|
||
- "192.168.0.0/16"
|
||
```
|
||
|
||
Finally:
|
||
|
||
1. Go to `Settings` -> `System` -> `Check configuration` to validate the file.
|
||
2. Restart Home Assistant Core via `Settings` -> `System` -> `Restart`.
|
||
|
||
This ensures Home Assistant correctly interprets requests forwarded through your proxy, preserving real client IPs and maintaining secure access.
|
||
|
||
## AC Integraion
|
||
|
||
To control the air conditioner that uses the NetHome Plus app, install HACS (Home Assistant Community Store) and the Midea AC LAN integration.
|
||
|
||
### Step 1 - Install HACS
|
||
|
||
Follow the documentation at [HACS](https://hacs.xyz/docs/use/)
|
||
|
||
### Step 2 — Install Midea AC LAN Integration
|
||
|
||
Follow the documentation at [midea_ac_lan](https://github.com/wuwentao/midea_ac_lan/tree/master)
|
||
|
||
> Important: recent Midea / NetHome Plus API changes limit how tokens can be obtained.
|
||
> Keep a backup file containing your current tokens — it will be necessary if API access becomes restricted in the future.
|
||
> Tokens can be found via SSH at: `/config/.storage/midea_ac_lan`
|
||
|
||
|
||
## Reinstallation
|
||
|
||
If a full reinstall is needed, simply destroy and recreate the Terraform resources:
|
||
|
||
```bash
|
||
terraform destroy
|
||
```
|
||
|
||
Then run:
|
||
```bash
|
||
terraform apply
|
||
```
|
||
|
||
to provision a clean instance again.
|