Jump to content

SENSBLUE ATLAS/Home Assistant: Difference between revisions

From ATRONIA Wiki
No edit summary
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Home Assistant}}
{{DISPLAYTITLE:Home Assistant}}[[File:Home Assistant Logo.png|frameless|150x150px]]
 
== Fast installation script ==
== Fast installation script ==
(If u are feeling lazy)
(If you are feeling lazy)
<table style="border: none; background: transparent; margin: 15px 0; border-collapse: collapse;">
<table style="border: none; background: transparent; margin: 15px 0; border-collapse: collapse;">
     <td style="padding: 0 0 0 10px; border: none; background: transparent;">
     <td style="padding: 0 0 0 10px; border: none; background: transparent;">
         <span class="atlas-btn">[[Media:Atlas-ha-install-v1.zip|Atlas-ha-install-v1.zip]]</span>
         <span class="atlas-btn">[[Media:Atlas-ha-install-v1.zip|Download Script]]</span>
     </td>
     </td>
</table>
</table>The package is a copy of the reference installation. It includes the same version of Home Assistant (2026.8.0), the YAML files, HACS, themes, images, dashboards, and helpers.
 
Package structure: <syntaxhighlight lang="bash">
atlas-ha-installer/
├── docker-compose.yml        # imagem fixa: home-assistant:2026.8.0
├── install.sh
├── README.md
├── provision_areas.py
└── ha-config/
    ├── configuration.yaml
    ├── mqtt.yaml
    ├── automations.yaml
    ├── scripts.yaml
    ├── scenes.yaml
    ├── secrets.yaml          # vazio
    ├── custom_components/    # inclui HACS
    ├── www/
    ├── themes/
    ├── image/
    ├── blueprints/           # se existir
    └── .storage/             # apenas lovelace* (dashboards) e input_* (helpers)
 
</syntaxhighlight>
 
=== 1. What the script does ===
The <code>install.sh</code> doesn't need any arguments.
{| class="wikitable mix-table"
!Stage
!Action
|-
|1–3. Docker
|Installs Docker Engine and the Docker Compose plugin from the official Docker repository. If Docker already exists, skips this step.
|-
|4. Create folders
|Creates <code>/opt/atlas-ha</code> and <code>/opt/atlas-ha/ha-config</code>.
|-
|5. Copy compose
|Copies the <code>docker-compose.yml</code>, with the fixed HA version.
|-
|6. Copy configuration
|Copies the entire <code>ha-config</code> folder (<code>cp -a</code>) and creates empty <code>automations.yaml</code>, <code>scripts.yaml</code>, and <code>scenes.yaml</code> if they do not exist.
|-
|7. Permissions
|Runs <code>chown -R root:root /opt/atlas-ha</code>.
|-
|8. Start HA
|Runs <code>docker compose up -d</code>.
|-
|9. Validate
|Runs <code>check_config</code> inside the container and restarts HA.
|}
 
=== 2. What is not included in the package: ===
The following data remains in <code>.storage</code> and is '''not''' copied, for security reasons and because they are different on each unit:
 
* users and tokens;
* database and history;
* device and entity registry;
* MQTT broker connection (integration);
* HACS authentication (GitHub).
 
Therefore, on each new unit, it is necessary to configure the MQTT integration and HACS (see 16.6).
 
If you rename entities through the HA interface, those changes are not carried over to the package. Names must be defined in <code>mqtt.yaml</code>.
 
=== 3. Prepare Device ===
Transfer the package to ATLAS, for example using [https://winscp.net/eng/index.php <u>WinSCP</u>]:
 
# Open the connection to ATLAS using WinSCP.
# Copy <code>atlas-ha-installer.zip</code> to <code>/home/pi</code>.
# Establish an SSH connection to ATLAS.
 
'''Note:''' If you need help installing WinSCP, '''''<u>[[SENSBLUE ATLAS/Putty & WinSCP#Install WinSCP|click here]]</u>'''''.
 
Alternatively, from another ATLAS:<syntaxhighlight lang="bash">
scp ~/atlas-ha-installer.zip pi@<ip-do-atlas>:~
</syntaxhighlight>On ATLAS, extract the package:<syntaxhighlight lang="bash">
sudo apt-get update
sudo apt-get install -y unzip
cd /home/pi
rm -rf atlas-ha-installer
unzip atlas-ha-installer.zip
cd atlas-ha-installer
chmod +x install.sh
</syntaxhighlight>
 
=== 4. Run the installation: ===
<syntaxhighlight lang="bash">sudo ./install.sh</syntaxhighlight>Na primeira execução, o script demora alguns minutos por causa do download da imagem do Home Assistant.
 
Depois da instalação, deve existir:<syntaxhighlight lang="bash">
/opt/atlas-ha/
├── docker-compose.yml
└── ha-config/
    ├── configuration.yaml
    ├── mqtt.yaml
    ├── automations.yaml
    ├── scripts.yaml
    ├── scenes.yaml
    ├── custom_components/
    ├── www/
    ├── themes/
    ├── image/
    └── .storage/
</syntaxhighlight>
 
=== 5. Post-script validation ===
<syntaxhighlight lang="bash">
sudo docker ps
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123
</syntaxhighlight>
{| class="wikitable mix-table"
!Code
!Meaning
|-
|200
|Home Assistant accessible
|-
|302
|Home Assistant accessible, with redirection
|-
|000 or connection refused
|May be normal in the first 1–2 minutes; wait and try again
|}
To view the logs:<syntaxhighlight>
sudo docker logs -f homeassistant
</syntaxhighlight>
 
=== 6.  Initial configuration in the browser ===
Open <code>http://<ip-of-atlas>:8123</code>:
 
# '''Create the administrator account.''' It should not be the same across all units (see section 15).
# '''Configure the location, time zone, and units.'''
# '''Add the MQTT integration:''' <code>Settings → Devices & services → Add integration → MQTT</code>  - Broker: 127.0.0.1  - Port: 1883  - Username/password: according to the Mosquitto configuration
# '''Add the HACS integration:''' <code>Settings → Devices & services → Add integration → HACS</code> and authorize with GitHub.
# '''Restart Home Assistant:''' <code>Settings → System → Restart.</code>
 
=== 7. Validate the installation ===
{| class="wikitable mix-table"
!Verification
!Where
!Expected result
|-
|Version
|<code>Settings → About</code>
|<code>2026.8.0</code>
|-
|ATLAS Device
|<code>Settings → Devices & services → MQTT</code>
|Device with entities
|-
|Analog Inputs (AI1..AI4)
|'''Analog''' Dashboard
|Values updating
|-
|Analog Outputs (AO1..AO2)
|'''Analog''' Dashboard
|Correct values and control working
|-
|Digital Inputs (DI1..DI4)
|'''Digital''' Dashboard
|States updating
|-
|Digital Outputs (DO1..DO8)
|'''Digital''' Dashboard
|Correct state and control working
|-
|System Health
|'''System''' Dashboard
|CPU, RAM, disk, and eMMC with values
|-
|Automations
|<code>Settings → Automations</code>
|"ATLAS Read …" automations active
|-
|Themes and images
|Profile / dashboards
|Identical to the reference unit
|}
 
=== 8. Troubleshooting ===
{| class="wikitable mix-table"
!Problem
!Probable cause / solution
|-
|<code>curl</code> devolve <code>000</code>
|O HA ainda está a arrancar. Ver <code>sudo docker logs -f homeassistant</code>.
|-
|<code>check_config</code> error
|YAML error; the log indicates the file and line. Fix in <code>/opt/atlas-ha/ha-config/</code> and run <code>sudo docker compose restart</code>.
|-
|Entities without data
|The MQTT integration is not configured (16.6) or Mosquitto is not responding on port <code>1883</code>.
|-
|Missing dashboards
|Confirm that <code>/opt/atlas-ha/ha-config/.storage/lovelace*</code> exists.
|-
|Missing themes or cards
|Confirm the <code>themes</code> and <code>www</code> folders exist; clear your browser cache.
|-
|<code>apt-get update</code> gives a <code>404</code> error on the Docker repository
|See the note about Debian 13 <code>Trixie</code> in section 3.
|}
 
=== 9. Updating the installer package (maintenance) ===
Use this procedure when changes are made to the reference unit's Home Assistant and the package needs to reflect them. Run on the '''reference unit:'''
 
'''1. Make a backup of the current installer:'''<syntaxhighlight lang="bash">cd ~
   cp -r atlas-ha-installer atlas-ha-installer.bak-$(date +%F)</syntaxhighlight>'''2. Synchronize the running configuration, excluding sensitive data:'''<syntaxhighlight lang="bash">
sudo rsync -av --delete \
  --exclude '.storage' --exclude '*.db*' --exclude '*.log*' \
  --exclude 'secrets.yaml' --exclude '.HA_VERSION' --exclude '.cloud' \
  --exclude 'deps' --exclude 'tts' --exclude 'backups' --exclude '__pycache__' \
  /opt/atlas-ha/ha-config/ ~/atlas-ha-installer/ha-config/
</syntaxhighlight>'''3. Copy dashboards and helpers:'''<syntaxhighlight lang="bash">
mkdir -p ~/atlas-ha-installer/ha-config/.storage
sudo bash -c 'cp /opt/atlas-ha/ha-config/.storage/lovelace* /home/pi/atlas-ha-installer/ha-config/.storage/ 2>/dev/null'
sudo bash -c 'cp /opt/atlas-ha/ha-config/.storage/input_* /home/pi/atlas-ha-installer/ha-config/.storage/ 2>/dev/null'
sudo chown -R pi:pi ~/atlas-ha-installer
</syntaxhighlight>'''4. Pin the running HA version:'''<syntaxhighlight lang="bash">
cp /opt/atlas-ha/docker-compose.yml ~/atlas-ha-installer/docker-compose.yml
sed -i "s|home-assistant:stable|home-assistant:$(cat /opt/atlas-ha/ha-config/.HA_VERSION)|" ~/atlas-ha-installer/docker-compose.yml
grep image ~/atlas-ha-installer/docker-compose.yml
</syntaxhighlight>If <code>docker-compose.yml</code> already has a fixed version instead of <code>stable</code>, manually edit the <code>image:</code> line to the current version.
 
'''5. Confirm that no sensitive data is included. The command should return nothing:'''<syntaxhighlight lang="bash">
find ~/atlas-ha-installer -type f | grep -E 'auth|token|onboarding|core\.|\.db|\.log|cloud'
</syntaxhighlight>'''6. Generate the package:'''<syntaxhighlight lang="bash">
cd ~
rm -f atlas-ha-installer.zip
zip -r atlas-ha-installer.zip atlas-ha-installer
unzip -l atlas-ha-installer.zip | grep -E "install.sh|docker-compose|storage|configuration.yaml"
</syntaxhighlight>'''7. Test the package''' on a clean unit (16.3 to 16.7) and only then replace the <code>atlas-ha-installer.zip</code> attachment on this page.
 
=== 10. Uninstall / Revert ===
Run on the unit to be cleaned. Confirm beforehand with <code>hostname</code>. The <code>rm -rf</code> steps cannot be undone.
 
Before removing:<syntaxhighlight lang="bash">
hostname
sudo docker ps -a
</syntaxhighlight>'''1. Remove only Home Assistant (keeps Docker)'''
 
Optionally, make a backup first:<syntaxhighlight lang="bash">
sudo tar -czf ~/atlas-ha-backup-$(date +%F).tar.gz -C /opt/atlas-ha .
</syntaxhighlight>Stop and remove the container, image, and configuration:<syntaxhighlight lang="bash">
cd /opt/atlas-ha
sudo docker compose down
sudo docker image rm ghcr.io/home-assistant/home-assistant:2026.8.0
cd ~
sudo rm -rf /opt/atlas-ha
rm -rf ~/atlas-ha-installer ~/atlas-ha-installer.zip
</syntaxhighlight>'''2. Also remove Docker (optional)'''
 
Only remove Docker if <code>docker ps -a</code> does not show other necessary containers.<syntaxhighlight lang="bash">
sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo apt autoremove -y
sudo rm -rf /var/lib/docker /var/lib/containerd
sudo rm -f /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.asc /etc/apt/keyrings/docker.gpg
sudo apt update
</syntaxhighlight>'''3. Confirm'''<syntaxhighlight lang="bash">ls /opt/atlas-ha 2>/dev/null || echo "Home Assistant removed"
command -v docker || echo "Docker removed"</syntaxhighlight>The native ATLAS stack (Node-RED, Grafana, InfluxDB, and Mosquitto) is not removed by these steps.


= Home Assistant integration =
= Home Assistant integration =
'''Installing Home Assistant on the SENSBLUE ATLAS / i.Cee²'''
'''Installing Home Assistant on the SENSBLUE ATLAS'''


'''Objective'''
'''Objective'''
Line 30: Line 290:
|-
|-
|Device
|Device
|SENSBLUE ATLAS / i.Cee²
|SENSBLUE ATLAS
|-
|-
|Platform
|Platform
Line 37: Line 297:
|System
|System
|Debian GNU/Linux 13 trixie
|Debian GNU/Linux 13 trixie
|-
|Terminal emulator
|i.e. PuTTY - '''<u>https://putty.org/index.html</u>'''
|-
|-
|Access
|Access
Line 53: Line 316:
|Local Mosquitto on 127.0.0.1:1883
|Local Mosquitto on 127.0.0.1:1883
|}
|}
Check the system:<syntaxhighlight lang="bash">cat /etc/os-release | grep PRETTY_NAME
To locate the IP address of the ATLAS device, '''toggle the joystick to the right''' to navigate to the '''<nowiki/>'Network'''' screen, where the '''eth1''' address is displayed.
 
 
[[File:Front Screen.svg|center|frameless|566x566px]]
 
 
 
Once your preferred terminal application (e.g., PuTTY) is installed, initiate an SSH session using the ATLAS IP address and execute the following command to verify the system:
 
'''Note:''' If you need help installing PuTTY, [[SENSBLUE ATLAS/Putty & WinSCP#Install PuTTY|'''''<u>click here</u>''''']].
[[File:Image.png|center|frameless|448x448px]]
 
'''Note:''' SSH access to the ATLAS device requires authentication.
 
* '''Username:''' pi
* '''Password:''' atlas2026
<syntaxhighlight lang="bash">cat /etc/os-release | grep PRETTY_NAME
uname -m
uname -m
df -h /</syntaxhighlight>
df -h /</syntaxhighlight>'''Expected output:'''<syntaxhighlight lang="bash">
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
aarch64
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2  29G  5.5G  23G  20% /
</syntaxhighlight>


=== 2. Ports used on ATLAS ===
=== 2. Ports used on ATLAS ===
Line 78: Line 362:
|8123
|8123
|}
|}
Check the stack's ports:<syntaxhighlight lang="bash">
'''Check the stack's ports:'''<syntaxhighlight lang="bash">
for p in 1880 1883 3000 8086; do
for p in 1880 1883 3000 8086; do
ss -tlnp | grep ":$p " && echo "port $p OK"
ss -tlnp | grep ":$p " && echo "port $p OK"
done
done
</syntaxhighlight>'''Expected output:'''<syntaxhighlight lang="bash">
LISTEN 0      511          0.0.0.0:1880      0.0.0.0:*    users:(("node-red",pid=614,fd=19))
porta 1880 OK
LISTEN 0      100          0.0.0.0:1883      0.0.0.0:*                                   
LISTEN 0      100            [::]:1883          [::]:*                                   
porta 1883 OK
LISTEN 0      4096              *:3000            *:*                                   
porta 3000 OK
LISTEN 0      4096              *:8086            *:* 
porta 8086 OK                                 
</syntaxhighlight>
</syntaxhighlight>


Line 96: Line 390:
# Test with hello-world.
# Test with hello-world.


==== 3.1 Update packages ====
<syntaxhighlight lang="bash">
sudo apt-get update
</syntaxhighlight>
==== 3.2 Install dependencies ====
<syntaxhighlight lang="bash">
sudo apt-get install -y ca-certificate curl
sudo install -m 0755 -d /etc/apt/keyrings
</syntaxhighlight>
==== 3.3 Add Docker GPG key ====
<syntaxhighlight lang="bash">
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
</syntaxhighlight>
==== 3.4 Add Docker repository ====
<syntaxhighlight lang="bash">
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \ https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
</syntaxhighlight>
==== 3.5 Install Docker Engine and Docker Compose plugin ====
<syntaxhighlight lang="bash">
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
</syntaxhighlight>


Check that Docker is operational:<syntaxhighlight lang="bash">
==== 3.6 Verify if Docker is operational ====
<syntaxhighlight lang="bash">
sudo docker run --rm hello-world
sudo docker run --rm hello-world
</syntaxhighlight>If <code>apt-get update</code> returns a 404 error for the Docker repository, temporarily use the bookworm line for the Docker repository and repeat the update/installation.
</syntaxhighlight>


Example alternative line:<syntaxhighlight lang="bash">deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable</syntaxhighlight>
==== '''Note on Debian 13 (Trixie)''' ====
If <code>apt-get update</code> returns a <code>404</code> error for the Docker repository on <code>trixie</code>, temporarily use <code>bookworm</code> in the Docker repository line and re-run the update/installation.
 
Example of the alternative line:<syntaxhighlight lang="bash">deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable</syntaxhighlight>


=== 4. Create the Home Assistant project ===
=== 4. Create the Home Assistant project ===
Line 195: Line 523:
Configure the broker as:
Configure the broker as:


'''127.0.0.1:1883'''
'''127.0.0.1'''


After adding the MQTT integration, create the following YAML files to declare the entities used in the current installation.
After adding the MQTT integration, create the following YAML files to declare the entities used in the current installation.
Line 222: Line 550:


sudo tee mqtt.yaml > /dev/null << 'EOF'
sudo tee mqtt.yaml > /dev/null << 'EOF'
sensor:
sensor:
   - name: "ATLAS AI1"
   - name: "ATLAS AI1"
     unique_id: atlas_ai1
     unique_id: atlas_ai1
     state_topic: "analogInputs/runtime/out"
     state_topic: "analogInputs/runtime/out"
     value_template: "{{ value_json.task.taskResult.AI1.result | float(0) }}"
     value_template: "{{ value_json.task.taskResult.AI1.result }}"
     unit_of_measurement: "V"
     unit_of_measurement: "V"
     device_class: voltage
     device_class: voltage
Line 234: Line 563:
     unique_id: atlas_ai2
     unique_id: atlas_ai2
     state_topic: "analogInputs/runtime/out"
     state_topic: "analogInputs/runtime/out"
     value_template: "{{ value_json.task.taskResult.AI2.result | float(0) }}"
     value_template: "{{ value_json.task.taskResult.AI2.result }}"
     unit_of_measurement: "V"
     unit_of_measurement: "V"
     device_class: voltage
     device_class: voltage
Line 242: Line 571:
     unique_id: atlas_ai3
     unique_id: atlas_ai3
     state_topic: "analogInputs/runtime/out"
     state_topic: "analogInputs/runtime/out"
     value_template: "{{ value_json.task.taskResult.AI3.result | float(0) }}"
     value_template: "{{ value_json.task.taskResult.AI3.result }}"
     unit_of_measurement: "V"
     unit_of_measurement: "V"
     device_class: voltage
     device_class: voltage
Line 250: Line 579:
     unique_id: atlas_ai4
     unique_id: atlas_ai4
     state_topic: "analogInputs/runtime/out"
     state_topic: "analogInputs/runtime/out"
     value_template: "{{ value_json.task.taskResult.AI4.result | float(0) }}"
     value_template: "{{ value_json.task.taskResult.AI4.result }}"
     unit_of_measurement: "V"
     unit_of_measurement: "V"
     device_class: voltage
     device_class: voltage
     state_class: measurement
     state_class: measurement
  - name: "ATLAS CPU Usage"
    unique_id: atlas_cpu_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_percent }}"
    unit_of_measurement: "%"
    device_class: power_factor
    state_class: measurement
  - name: "ATLAS CPU Temperature"
    unique_id: atlas_cpu_temperature
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_tempC }}"
    unit_of_measurement: "°C"
    device_class: temperature
    state_class: measurement
  - name: "ATLAS CPU0 Frequency"
    unique_id: atlas_cpu0_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu0.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement
  - name: "ATLAS CPU1 Frequency"
    unique_id: atlas_cpu1_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu1.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement
  - name: "ATLAS CPU2 Frequency"
    unique_id: atlas_cpu2_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu2.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement
  - name: "ATLAS CPU3 Frequency"
    unique_id: atlas_cpu3_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu3.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement
  - name: "ATLAS CPU Throttle"
    unique_id: atlas_cpu_throttle
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.cpu_throttle == "0x0" %}
        No
      {% else %}
        Yes
      {% endif %}
  - name: "ATLAS RAM Usage"
    unique_id: atlas_ram_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_percent }}"
    unit_of_measurement: "%"
    state_class: measurement
  - name: "ATLAS RAM Total"
    unique_id: atlas_ram_total
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_total_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement
  - name: "ATLAS RAM Used"
    unique_id: atlas_ram_used
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_used_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement
  - name: "ATLAS RAM Available"
    unique_id: atlas_ram_available
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_available_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement
  - name: "ATLAS Disk Usage"
    unique_id: atlas_disk_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_percent }}"
    unit_of_measurement: "%"
    state_class: measurement
  - name: "ATLAS Disk Total"
    unique_id: atlas_disk_total
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_total_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement
  - name: "ATLAS Disk Used"
    unique_id: atlas_disk_used
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_used_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement
  - name: "ATLAS Disk Free"
    unique_id: atlas_disk_free
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_free_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement
  - name: "ATLAS eMMC RUL State"
    unique_id: atlas_emmc_rul_state
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.emmc_rul.state }}"
  - name: "ATLAS eMMC RUL Reason"
    unique_id: atlas_emmc_rul_reason
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.emmc_rul.reason }}"
  - name: "ATLAS Uptime"
    unique_id: atlas_uptime_seconds
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.uptime_sec }}"
    unit_of_measurement: "s"
    device_class: duration
    state_class: measurement


binary_sensor:
binary_sensor:
Line 259: Line 721:
     unique_id: atlas_di1
     unique_id: atlas_di1
     state_topic: "digitalInputs/runtime/out"
     state_topic: "digitalInputs/runtime/out"
     value_template: >-
     value_template: >
       {% set di = value_json.task.taskResult.DI1 %}
       {% if value_json.task.taskResult.DI1.result == true %}
      {% if di.result is defined %}
         ON
         {{ 'ON' if di.result == true else 'OFF' }}
       {% else %}
       {% else %}
         {{ 'ON' if di.state == 'high' else 'OFF' }}
         OFF
       {% endif %}
       {% endif %}
     payload_on: "ON"
     payload_on: "ON"
Line 272: Line 733:
     unique_id: atlas_di2
     unique_id: atlas_di2
     state_topic: "digitalInputs/runtime/out"
     state_topic: "digitalInputs/runtime/out"
     value_template: >-
     value_template: >
       {% set di = value_json.task.taskResult.DI2 %}
       {% if value_json.task.taskResult.DI2.result == true %}
      {% if di.result is defined %}
         ON
         {{ 'ON' if di.result == true else 'OFF' }}
       {% else %}
       {% else %}
         {{ 'ON' if di.state == 'high' else 'OFF' }}
         OFF
       {% endif %}
       {% endif %}
     payload_on: "ON"
     payload_on: "ON"
Line 285: Line 745:
     unique_id: atlas_di3
     unique_id: atlas_di3
     state_topic: "digitalInputs/runtime/out"
     state_topic: "digitalInputs/runtime/out"
     value_template: >-
     value_template: >
       {% set di = value_json.task.taskResult.DI3 %}
       {% if value_json.task.taskResult.DI3.result == true %}
      {% if di.result is defined %}
         ON
         {{ 'ON' if di.result == true else 'OFF' }}
       {% else %}
       {% else %}
         {{ 'ON' if di.state == 'high' else 'OFF' }}
         OFF
       {% endif %}
       {% endif %}
     payload_on: "ON"
     payload_on: "ON"
Line 298: Line 757:
     unique_id: atlas_di4
     unique_id: atlas_di4
     state_topic: "digitalInputs/runtime/out"
     state_topic: "digitalInputs/runtime/out"
     value_template: >-
     value_template: >
       {% set di = value_json.task.taskResult.DI4 %}
       {% if value_json.task.taskResult.DI4.result == true %}
       {% if di.result is defined %}
        ON
         {{ 'ON' if di.result == true else 'OFF' }}
       {% else %}
         OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"
 
  - name: "ATLAS eMMC RUL OK"
    unique_id: atlas_emmc_rul_ok
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.emmc_rul.ok == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"
    device_class: problem
 
  - name: "ATLAS eMMC RUL Problem"
    unique_id: atlas_emmc_rul_problem
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.emmc_rul.ok == false %}
        ON
       {% else %}
       {% else %}
         {{ 'ON' if di.state == 'high' else 'OFF' }}
         OFF
       {% endif %}
       {% endif %}
     payload_on: "ON"
     payload_on: "ON"
     payload_off: "OFF"
     payload_off: "OFF"
    device_class: problem


switch:
switch:
   - name: "ATLAS DO1"
   - name: "ATLAS DO1"
     unique_id: atlas_do1
     unique_id: atlas_do1
    state_topic: "digitalOutputs/runtime/out"
     command_topic: "digitalOutputs/runtime/in"
     command_topic: "digitalOutputs/runtime/in"
     state_topic: "digitalOutputs/runtime/out"
     value_template: >
     payload_on: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO1":{"state":"high"}}}}'
      {% if value_json.task.taskResult.DO1.result == true %}
     payload_off: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO1":{"state":"low"}}}}'
        ON
    value_template: "{{ value_json.task.taskResult.DO1.state }}"
      {% else %}
     state_on: "high"
        OFF
     state_off: "low"
      {% endif %}
    optimistic: false
     payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO1":true}}}'
     payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO1":false}}}'
     state_on: "ON"
     state_off: "OFF"


   - name: "ATLAS DO2"
   - name: "ATLAS DO2"
     unique_id: atlas_do2
     unique_id: atlas_do2
    state_topic: "digitalOutputs/runtime/out"
     command_topic: "digitalOutputs/runtime/in"
     command_topic: "digitalOutputs/runtime/in"
     state_topic: "digitalOutputs/runtime/out"
     value_template: >
     payload_on: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO2":{"state":"high"}}}}'
      {% if value_json.task.taskResult.DO2.result == true %}
     payload_off: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO2":{"state":"low"}}}}'
        ON
    value_template: "{{ value_json.task.taskResult.DO2.state }}"
      {% else %}
     state_on: "high"
        OFF
     state_off: "low"
      {% endif %}
    optimistic: false
     payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO2":true}}}'
     payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO2":false}}}'
     state_on: "ON"
     state_off: "OFF"


   - name: "ATLAS DO3"
   - name: "ATLAS DO3"
     unique_id: atlas_do3
     unique_id: atlas_do3
    state_topic: "digitalOutputs/runtime/out"
     command_topic: "digitalOutputs/runtime/in"
     command_topic: "digitalOutputs/runtime/in"
     state_topic: "digitalOutputs/runtime/out"
     value_template: >
     payload_on: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO3":{"state":"high"}}}}'
      {% if value_json.task.taskResult.DO3.result == true %}
     payload_off: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO3":{"state":"low"}}}}'
        ON
    value_template: "{{ value_json.task.taskResult.DO3.state }}"
      {% else %}
     state_on: "high"
        OFF
     state_off: "low"
      {% endif %}
    optimistic: false
     payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO3":true}}}'
     payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO3":false}}}'
     state_on: "ON"
     state_off: "OFF"


   - name: "ATLAS DO4"
   - name: "ATLAS DO4"
     unique_id: atlas_do4
     unique_id: atlas_do4
    state_topic: "digitalOutputs/runtime/out"
     command_topic: "digitalOutputs/runtime/in"
     command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO4.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO4":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO4":false}}}'
    state_on: "ON"
    state_off: "OFF"
 
  - name: "ATLAS DO5"
    unique_id: atlas_do5
     state_topic: "digitalOutputs/runtime/out"
     state_topic: "digitalOutputs/runtime/out"
     payload_on: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO4":{"state":"high"}}}}'
    command_topic: "digitalOutputs/runtime/in"
     payload_off: '{"id":0,"origin":"HA","task":{"action":"SET","taskParams":{"DO4":{"state":"low"}}}}'
    value_template: >
     value_template: "{{ value_json.task.taskResult.DO4.state }}"
      {% if value_json.task.taskResult.DO5.result == true %}
     state_on: "high"
        ON
     state_off: "low"
      {% else %}
     optimistic: false
        OFF
      {% endif %}
     payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO5":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO5":false}}}'
    state_on: "ON"
    state_off: "OFF"
 
  - name: "ATLAS DO6"
    unique_id: atlas_do6
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO6.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO6":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO6":false}}}'
    state_on: "ON"
    state_off: "OFF"
 
  - name: "ATLAS DO7"
    unique_id: atlas_do7
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO7.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO7":true}}}'
     payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO7":false}}}'
    state_on: "ON"
    state_off: "OFF"
 
  - name: "ATLAS DO8"
    unique_id: atlas_do8
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO8.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO8":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO8":false}}}'
    state_on: "ON"
    state_off: "OFF"
 
number:
  - name: "ATLAS AO1"
    unique_id: atlas_ao1
    state_topic: "analogOutputs/runtime/out"
    command_topic: "analogOutputs/runtime/in"
    value_template: "{{ value_json.task.taskResult.AO1.result }}"
    command_template: >
      {"origin":"HA","task":{"alias":"SET_AO","taskParams":{"AO1":{{ value | float }}}}}
    min: 4
    max: 20
    step: 0.1
    unit_of_measurement: "mA"
    mode: slider
 
  - name: "ATLAS AO2"
    unique_id: atlas_ao2
    state_topic: "analogOutputs/runtime/out"
    command_topic: "analogOutputs/runtime/in"
     value_template: "{{ value_json.task.taskResult.AO2.result }}"
     command_template: >
      {"origin":"HA","task":{"alias":"SET_AO","taskParams":{"AO2":{{ value | float }}}}}
     min: 4
    max: 20
    step: 0.1
    unit_of_measurement: "mA"
     mode: slider
EOF
EOF
</syntaxhighlight>'''Notes about this mqtt.yaml'''
</syntaxhighlight>'''Notes about this mqtt.yaml'''
Line 505: Line 1,092:
</syntaxhighlight>
</syntaxhighlight>


=== 15. Production notes ===
=== 15. Automatic installation with script ===
Before sending a unit to a client, review the following points:
{| class="wikitable mix-table"
!Point
!Note
|-
|MQTT Broker
|Mosquitto may be unauthenticated and listening on 0.0.0.0; secure before exposing the unit
|-
|Grafana
|Change default credentials, e.g., admin/admin
|-
|Access Point
|If ATLAS routes traffic via wlan0, validate FORWARD, DOCKER-USER, nftables rules and persistence
|-
|Initial HA account
|The admin account should not be the same on all units
|-
|Network
|Validate port exposure when the unit has a routable IP via Ethernet/LTE
|}
 
=== 16. Automatic installation with script ===
The current installation can be performed using the script:<syntaxhighlight lang="bash">
The current installation can be performed using the script:<syntaxhighlight lang="bash">
install-atlas-ha.sh
install-atlas-ha.sh
Line 534: Line 1,099:
</syntaxhighlight>
</syntaxhighlight>


==== 16.1 Script used ====
==== 15.1 Script used ====
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#!/bin/bash
#!/bin/bash
Line 570: Line 1,135:
</syntaxhighlight>
</syntaxhighlight>


==== 16.2 What the script does ====
==== 15.2 What the script does ====
{| class="wikitable mix-table"
{| class="wikitable mix-table"
!Step
!Step
Line 597: Line 1,162:
|}
|}


==== 16.3 Prepare files ====
==== 15.3 Prepare files ====
Copy to ATLAS:<syntaxhighlight lang="bash">
Copy to ATLAS:<syntaxhighlight lang="bash">
install-atlas-ha.sh
install-atlas-ha.sh
Line 608: Line 1,173:
</syntaxhighlight>
</syntaxhighlight>


==== 16.4 Run installation ====
==== 15.4 Run installation ====
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo ./install-atlas-ha.sh atlas-ha-backup.tar.gz
sudo ./install-atlas-ha.sh atlas-ha-backup.tar.gz
Line 615: Line 1,180:
</syntaxhighlight>
</syntaxhighlight>


==== 16.5 Expected backup structure ====
==== 15.5 Expected backup structure ====
The backup should contain the necessary structure so that, after extraction in <code>/opt/atlas-ha</code>, at least the following exists:
The backup should contain the necessary structure so that, after extraction in <code>/opt/atlas-ha</code>, at least the following exists:


Line 636: Line 1,201:
If the backup does not contain <code>docker-compose.yml</code>, the command <code>sudo docker compose up -d</code> will not be able to start Home Assistant.
If the backup does not contain <code>docker-compose.yml</code>, the command <code>sudo docker compose up -d</code> will not be able to start Home Assistant.


==== 16.6 Validation after the script ====
==== 15.6 Validation after the script ====
Check if the container is active:<syntaxhighlight lang="bash">
Check if the container is active:<syntaxhighlight lang="bash">
sudo docker ps
sudo docker ps
Line 662: Line 1,227:
http://&#x3C;atlas-ip&#x3E;:8123
http://&#x3C;atlas-ip&#x3E;:8123


=== 17. Uninstall / revert ===
=== 16. Uninstall / revert ===
Stop and remove the container:<syntaxhighlight lang="bash">
Stop and remove the container:<syntaxhighlight lang="bash">
cd /opt/atlas-ha
cd /opt/atlas-ha
Line 672: Line 1,237:
</syntaxhighlight>The native ATLAS stack, including Node-RED, Grafana, InfluxDB, and Mosquitto, is not removed by these steps.
</syntaxhighlight>The native ATLAS stack, including Node-RED, Grafana, InfluxDB, and Mosquitto, is not removed by these steps.


=== 18. Summary ===
=== 17. Summary ===
{| class="wikitable mix-table"
{| class="wikitable mix-table"
!Step
!Step
Line 687: Line 1,252:
|-
|-
|Access
|Access
|[http://&#x3C;ip-do-atlas&#x3E;:8123 http://<atlas-ip>:8123]
|[http://&#x3C;ip-do-atlas&#x3E;:8123 '''<u>http://<atlas-ip>:8123</u>''']
|-
|-
|Configure MQTT
|Configure MQTT

Latest revision as of 15:35, 9 November 2026

Fast installation script

(If you are feeling lazy)

       Download Script

The package is a copy of the reference installation. It includes the same version of Home Assistant (2026.8.0), the YAML files, HACS, themes, images, dashboards, and helpers. Package structure:

atlas-ha-installer/
├── docker-compose.yml        # imagem fixa: home-assistant:2026.8.0
├── install.sh
├── README.md
├── provision_areas.py
└── ha-config/
    ├── configuration.yaml
    ├── mqtt.yaml
    ├── automations.yaml
    ├── scripts.yaml
    ├── scenes.yaml
    ├── secrets.yaml          # vazio
    ├── custom_components/    # inclui HACS
    ├── www/
    ├── themes/
    ├── image/
    ├── blueprints/           # se existir
    └── .storage/             # apenas lovelace* (dashboards) e input_* (helpers)

1. What the script does

The install.sh doesn't need any arguments.

Stage Action
1–3. Docker Installs Docker Engine and the Docker Compose plugin from the official Docker repository. If Docker already exists, skips this step.
4. Create folders Creates /opt/atlas-ha and /opt/atlas-ha/ha-config.
5. Copy compose Copies the docker-compose.yml, with the fixed HA version.
6. Copy configuration Copies the entire ha-config folder (cp -a) and creates empty automations.yaml, scripts.yaml, and scenes.yaml if they do not exist.
7. Permissions Runs chown -R root:root /opt/atlas-ha.
8. Start HA Runs docker compose up -d.
9. Validate Runs check_config inside the container and restarts HA.

2. What is not included in the package:

The following data remains in .storage and is not copied, for security reasons and because they are different on each unit:

  • users and tokens;
  • database and history;
  • device and entity registry;
  • MQTT broker connection (integration);
  • HACS authentication (GitHub).

Therefore, on each new unit, it is necessary to configure the MQTT integration and HACS (see 16.6).

If you rename entities through the HA interface, those changes are not carried over to the package. Names must be defined in mqtt.yaml.

3. Prepare Device

Transfer the package to ATLAS, for example using WinSCP:

  1. Open the connection to ATLAS using WinSCP.
  2. Copy atlas-ha-installer.zip to /home/pi.
  3. Establish an SSH connection to ATLAS.

Note: If you need help installing WinSCP, click here.

Alternatively, from another ATLAS:

scp ~/atlas-ha-installer.zip pi@<ip-do-atlas>:~

On ATLAS, extract the package:

sudo apt-get update
sudo apt-get install -y unzip
cd /home/pi
rm -rf atlas-ha-installer
unzip atlas-ha-installer.zip
cd atlas-ha-installer
chmod +x install.sh

4. Run the installation:

sudo ./install.sh

Na primeira execução, o script demora alguns minutos por causa do download da imagem do Home Assistant. Depois da instalação, deve existir:

/opt/atlas-ha/
├── docker-compose.yml
└── ha-config/
    ├── configuration.yaml
    ├── mqtt.yaml
    ├── automations.yaml
    ├── scripts.yaml
    ├── scenes.yaml
    ├── custom_components/
    ├── www/
    ├── themes/
    ├── image/
    └── .storage/

5. Post-script validation

sudo docker ps
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123
Code Meaning
200 Home Assistant accessible
302 Home Assistant accessible, with redirection
000 or connection refused May be normal in the first 1–2 minutes; wait and try again

To view the logs:

sudo docker logs -f homeassistant

6. Initial configuration in the browser

Open http://<ip-of-atlas>:8123:

  1. Create the administrator account. It should not be the same across all units (see section 15).
  2. Configure the location, time zone, and units.
  3. Add the MQTT integration: Settings → Devices & services → Add integration → MQTT - Broker: 127.0.0.1 - Port: 1883 - Username/password: according to the Mosquitto configuration
  4. Add the HACS integration: Settings → Devices & services → Add integration → HACS and authorize with GitHub.
  5. Restart Home Assistant: Settings → System → Restart.

7. Validate the installation

Verification Where Expected result
Version Settings → About 2026.8.0
ATLAS Device Settings → Devices & services → MQTT Device with entities
Analog Inputs (AI1..AI4) Analog Dashboard Values updating
Analog Outputs (AO1..AO2) Analog Dashboard Correct values and control working
Digital Inputs (DI1..DI4) Digital Dashboard States updating
Digital Outputs (DO1..DO8) Digital Dashboard Correct state and control working
System Health System Dashboard CPU, RAM, disk, and eMMC with values
Automations Settings → Automations "ATLAS Read …" automations active
Themes and images Profile / dashboards Identical to the reference unit

8. Troubleshooting

Problem Probable cause / solution
curl devolve 000 O HA ainda está a arrancar. Ver sudo docker logs -f homeassistant.
check_config error YAML error; the log indicates the file and line. Fix in /opt/atlas-ha/ha-config/ and run sudo docker compose restart.
Entities without data The MQTT integration is not configured (16.6) or Mosquitto is not responding on port 1883.
Missing dashboards Confirm that /opt/atlas-ha/ha-config/.storage/lovelace* exists.
Missing themes or cards Confirm the themes and www folders exist; clear your browser cache.
apt-get update gives a 404 error on the Docker repository See the note about Debian 13 Trixie in section 3.

9. Updating the installer package (maintenance)

Use this procedure when changes are made to the reference unit's Home Assistant and the package needs to reflect them. Run on the reference unit:

1. Make a backup of the current installer:

cd ~
   cp -r atlas-ha-installer atlas-ha-installer.bak-$(date +%F)

2. Synchronize the running configuration, excluding sensitive data:

sudo rsync -av --delete \
  --exclude '.storage' --exclude '*.db*' --exclude '*.log*' \
  --exclude 'secrets.yaml' --exclude '.HA_VERSION' --exclude '.cloud' \
  --exclude 'deps' --exclude 'tts' --exclude 'backups' --exclude '__pycache__' \
  /opt/atlas-ha/ha-config/ ~/atlas-ha-installer/ha-config/

3. Copy dashboards and helpers:

mkdir -p ~/atlas-ha-installer/ha-config/.storage
sudo bash -c 'cp /opt/atlas-ha/ha-config/.storage/lovelace* /home/pi/atlas-ha-installer/ha-config/.storage/ 2>/dev/null'
sudo bash -c 'cp /opt/atlas-ha/ha-config/.storage/input_* /home/pi/atlas-ha-installer/ha-config/.storage/ 2>/dev/null'
sudo chown -R pi:pi ~/atlas-ha-installer

4. Pin the running HA version:

cp /opt/atlas-ha/docker-compose.yml ~/atlas-ha-installer/docker-compose.yml
sed -i "s|home-assistant:stable|home-assistant:$(cat /opt/atlas-ha/ha-config/.HA_VERSION)|" ~/atlas-ha-installer/docker-compose.yml
grep image ~/atlas-ha-installer/docker-compose.yml

If docker-compose.yml already has a fixed version instead of stable, manually edit the image: line to the current version. 5. Confirm that no sensitive data is included. The command should return nothing:

find ~/atlas-ha-installer -type f | grep -E 'auth|token|onboarding|core\.|\.db|\.log|cloud'

6. Generate the package:

cd ~
rm -f atlas-ha-installer.zip
zip -r atlas-ha-installer.zip atlas-ha-installer
unzip -l atlas-ha-installer.zip | grep -E "install.sh|docker-compose|storage|configuration.yaml"

7. Test the package on a clean unit (16.3 to 16.7) and only then replace the atlas-ha-installer.zip attachment on this page.

10. Uninstall / Revert

Run on the unit to be cleaned. Confirm beforehand with hostname. The rm -rf steps cannot be undone.

Before removing:

hostname
sudo docker ps -a

1. Remove only Home Assistant (keeps Docker) Optionally, make a backup first:

sudo tar -czf ~/atlas-ha-backup-$(date +%F).tar.gz -C /opt/atlas-ha .

Stop and remove the container, image, and configuration:

cd /opt/atlas-ha
sudo docker compose down
sudo docker image rm ghcr.io/home-assistant/home-assistant:2026.8.0
cd ~
sudo rm -rf /opt/atlas-ha
rm -rf ~/atlas-ha-installer ~/atlas-ha-installer.zip

2. Also remove Docker (optional) Only remove Docker if docker ps -a does not show other necessary containers.

sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo apt autoremove -y
sudo rm -rf /var/lib/docker /var/lib/containerd
sudo rm -f /etc/apt/sources.list.d/docker.list /etc/apt/keyrings/docker.asc /etc/apt/keyrings/docker.gpg
sudo apt update

3. Confirm

ls /opt/atlas-ha 2>/dev/null || echo "Home Assistant removed"
command -v docker || echo "Docker removed"

The native ATLAS stack (Node-RED, Grafana, InfluxDB, and Mosquitto) is not removed by these steps.

Home Assistant integration

Installing Home Assistant on the SENSBLUE ATLAS

Objective Install Home Assistant in a Docker container, running alongside the stack already present on the ATLAS:

  • Node-RED
  • Mosquitto MQTT
  • Grafana
  • InfluxDB

Home Assistant does not replace the native stack. It only adds an extra interface/integration layer.

Scope: base installation of Home Assistant, creation of the initial account, and MQTT configuration compatible with the current ATLAS installation.

1. Prerequisites

Item Value / check
Device SENSBLUE ATLAS
Platform Raspberry Pi CM4 / aarch64
System Debian GNU/Linux 13 trixie
Terminal emulator i.e. PuTTY - https://putty.org/index.html
Access SSH with a user account that has sudo permissions
Disk space At least 1 GB free on the eMMC
Network ATLAS with internet access
Required port 8123 free for Home Assistant
MQTT Local Mosquitto on 127.0.0.1:1883

To locate the IP address of the ATLAS device, toggle the joystick to the right to navigate to the 'Network' screen, where the eth1 address is displayed.



Once your preferred terminal application (e.g., PuTTY) is installed, initiate an SSH session using the ATLAS IP address and execute the following command to verify the system:

Note: If you need help installing PuTTY, click here.

Note: SSH access to the ATLAS device requires authentication.

  • Username: pi
  • Password: atlas2026
cat /etc/os-release | grep PRETTY_NAME
uname -m
df -h /

Expected output:

PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
aarch64
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2   29G  5.5G   23G  20% /

2. Ports used on ATLAS

Before and after installation, confirm that the existing stack continues to respond.

Service Port
Node-RED 1880
Mosquitto MQTT 1883
Grafana 3000
InfluxDB 8086
Home Assistant 8123

Check the stack's ports:

for p in 1880 1883 3000 8086; do
ss -tlnp | grep ":$p " && echo "port $p OK"
done

Expected output:

LISTEN 0      511          0.0.0.0:1880       0.0.0.0:*    users:(("node-red",pid=614,fd=19))
porta 1880 OK
LISTEN 0      100          0.0.0.0:1883       0.0.0.0:*                                    
LISTEN 0      100             [::]:1883          [::]:*                                    
porta 1883 OK
LISTEN 0      4096               *:3000             *:*                                    
porta 3000 OK
LISTEN 0      4096               *:8086             *:*  
porta 8086 OK

3. Installing Docker

Install Docker Engine and the Docker Compose plugin through Docker's official Debian repository.

Summary of the process:

  1. Update packages.
  2. Install dependencies.
  3. Add the Docker GPG key.
  4. Add the Docker repository.
  5. Install Docker Engine and the Docker Compose plugin.
  6. Test with hello-world.

3.1 Update packages

sudo apt-get update

3.2 Install dependencies

sudo apt-get install -y ca-certificate curl
sudo install -m 0755 -d /etc/apt/keyrings

3.3 Add Docker GPG key

sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

3.4 Add Docker repository

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \ https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

3.5 Install Docker Engine and Docker Compose plugin

sudo apt-get update 
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

3.6 Verify if Docker is operational

sudo docker run --rm hello-world

Note on Debian 13 (Trixie)

If apt-get update returns a 404 error for the Docker repository on trixie, temporarily use bookworm in the Docker repository line and re-run the update/installation.

Example of the alternative line:

deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable

4. Create the Home Assistant project

Create the project folder:

sudo mkdir -p /opt/atlas-ha
cd /opt/atlas-ha

Create the docker-compose.yml file:

sudo tee docker-compose.yml > /dev/null << 'EOF'
services:
    homeassistant:
      container_name: homeassistant
      image: ghcr.io/home-assistant/home-assistant:stable
      network_mode: host
      volumes:
        - ./ha-config:/config
        - /etc/localtime:/etc/localtime:ro
      environment:
        - TZ=Europe/Lisbon
      restart: unless-stopped
EOF

Important notes:

Option Reason
network_mode: host Allows direct access to the port and local Mosquitto at 127.0.0.1:1883
./ha-config:/config Stores Home Assistant configuration in /opt/atlas-ha/ha-config
restart: unless-stopped Automatically restarts Home Assistant after reboot or failure
TZ=Europe/Lisbon Sets the correct time zone

5. Start Home Assistant

From the /opt/atlas-ha folder:

sudo docker compose up -d

The first start may take a few minutes as the image is downloaded and Home Assistant initialises the configuration. Check container status:

sudo docker ps

Check HTTP response:

curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123

Expected result:

Code Meaning
200 Home Assistant accessible
302 Home Assistant accessible, with redirection
000 connection refused May be normal in the first 1-2 minutes; wait and retry

6. Initial onboarding

Open in a browser on a PC on the same network:

http://<atlas-ip>:8123

Then:

  1. Create the administrator account.
  2. Set the location, e.g., Portugal, or skip.
  3. Complete until you reach the main dashboard.

From this point, Home Assistant is installed and operational.

7. Configure MQTT integration in Home Assistant

Since the container uses network_mode: host, Home Assistant can access the local Mosquitto via:

Field Value
Broker 127.0.0.1
Port 1883
User/password As per Mosquitto configuration; blank if no authentication

In Home Assistant:

Settings → Devices & services → Add integration → MQTT

Configure the broker as:

127.0.0.1

After adding the MQTT integration, create the following YAML files to declare the entities used in the current installation.

8. Create configuration.yaml

Enter the Home Assistant configuration folder:

cd /opt/atlas-ha/ha-config

Create or replace the configuration.yaml file:

sudo tee configuration.yaml > /dev/null << 'EOF'
default_config:
frontend:
  themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt: !include mqtt.yaml
EOF

Create the included files if they do not already exist:

sudo touch automations.yaml scripts.yaml scenes.yaml
sudo mkdir -p themes

9. Create mqtt.yaml

Create the file:

cd /opt/atlas-ha/ha-config

sudo tee mqtt.yaml > /dev/null << 'EOF'

sensor:
  - name: "ATLAS AI1"
    unique_id: atlas_ai1
    state_topic: "analogInputs/runtime/out"
    value_template: "{{ value_json.task.taskResult.AI1.result }}"
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement

  - name: "ATLAS AI2"
    unique_id: atlas_ai2
    state_topic: "analogInputs/runtime/out"
    value_template: "{{ value_json.task.taskResult.AI2.result }}"
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement

  - name: "ATLAS AI3"
    unique_id: atlas_ai3
    state_topic: "analogInputs/runtime/out"
    value_template: "{{ value_json.task.taskResult.AI3.result }}"
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement

  - name: "ATLAS AI4"
    unique_id: atlas_ai4
    state_topic: "analogInputs/runtime/out"
    value_template: "{{ value_json.task.taskResult.AI4.result }}"
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement


  - name: "ATLAS CPU Usage"
    unique_id: atlas_cpu_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_percent }}"
    unit_of_measurement: "%"
    device_class: power_factor
    state_class: measurement

  - name: "ATLAS CPU Temperature"
    unique_id: atlas_cpu_temperature
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_tempC }}"
    unit_of_measurement: "°C"
    device_class: temperature
    state_class: measurement

  - name: "ATLAS CPU0 Frequency"
    unique_id: atlas_cpu0_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu0.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement

  - name: "ATLAS CPU1 Frequency"
    unique_id: atlas_cpu1_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu1.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement

  - name: "ATLAS CPU2 Frequency"
    unique_id: atlas_cpu2_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu2.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement

  - name: "ATLAS CPU3 Frequency"
    unique_id: atlas_cpu3_frequency
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.cpu_freqs.cpu3.frequency_mhz }}"
    unit_of_measurement: "MHz"
    state_class: measurement

  - name: "ATLAS CPU Throttle"
    unique_id: atlas_cpu_throttle
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.cpu_throttle == "0x0" %}
        No
      {% else %}
        Yes
      {% endif %}

  - name: "ATLAS RAM Usage"
    unique_id: atlas_ram_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_percent }}"
    unit_of_measurement: "%"
    state_class: measurement

  - name: "ATLAS RAM Total"
    unique_id: atlas_ram_total
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_total_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement

  - name: "ATLAS RAM Used"
    unique_id: atlas_ram_used
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_used_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement

  - name: "ATLAS RAM Available"
    unique_id: atlas_ram_available
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.ram_available_mb }}"
    unit_of_measurement: "GB"
    state_class: measurement

  - name: "ATLAS Disk Usage"
    unique_id: atlas_disk_usage
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_percent }}"
    unit_of_measurement: "%"
    state_class: measurement

  - name: "ATLAS Disk Total"
    unique_id: atlas_disk_total
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_total_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement

  - name: "ATLAS Disk Used"
    unique_id: atlas_disk_used
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_used_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement

  - name: "ATLAS Disk Free"
    unique_id: atlas_disk_free
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.disk_free_gb }}"
    unit_of_measurement: "GB"
    device_class: data_size
    state_class: measurement

  - name: "ATLAS eMMC RUL State"
    unique_id: atlas_emmc_rul_state
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.emmc_rul.state }}"

  - name: "ATLAS eMMC RUL Reason"
    unique_id: atlas_emmc_rul_reason
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.emmc_rul.reason }}"

  - name: "ATLAS Uptime"
    unique_id: atlas_uptime_seconds
    state_topic: "systemHealth/runtime/out"
    value_template: "{{ value_json.task.taskResult.uptime_sec }}"
    unit_of_measurement: "s"
    device_class: duration
    state_class: measurement


binary_sensor:
  - name: "ATLAS DI1"
    unique_id: atlas_di1
    state_topic: "digitalInputs/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.DI1.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"

  - name: "ATLAS DI2"
    unique_id: atlas_di2
    state_topic: "digitalInputs/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.DI2.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"

  - name: "ATLAS DI3"
    unique_id: atlas_di3
    state_topic: "digitalInputs/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.DI3.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"

  - name: "ATLAS DI4"
    unique_id: atlas_di4
    state_topic: "digitalInputs/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.DI4.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"

  - name: "ATLAS eMMC RUL OK"
    unique_id: atlas_emmc_rul_ok
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.emmc_rul.ok == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"
    device_class: problem

  - name: "ATLAS eMMC RUL Problem"
    unique_id: atlas_emmc_rul_problem
    state_topic: "systemHealth/runtime/out"
    value_template: >
      {% if value_json.task.taskResult.emmc_rul.ok == false %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: "ON"
    payload_off: "OFF"
    device_class: problem

switch:
  - name: "ATLAS DO1"
    unique_id: atlas_do1
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO1.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO1":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO1":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO2"
    unique_id: atlas_do2
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO2.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO2":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO2":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO3"
    unique_id: atlas_do3
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO3.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO3":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO3":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO4"
    unique_id: atlas_do4
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO4.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO4":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO4":false}}}'
    state_on: "ON"
    state_off: "OFF"
   
  - name: "ATLAS DO5"
    unique_id: atlas_do5
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO5.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO5":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO5":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO6"
    unique_id: atlas_do6
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO6.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO6":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO6":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO7"
    unique_id: atlas_do7
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO7.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO7":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO7":false}}}'
    state_on: "ON"
    state_off: "OFF"

  - name: "ATLAS DO8"
    unique_id: atlas_do8
    state_topic: "digitalOutputs/runtime/out"
    command_topic: "digitalOutputs/runtime/in"
    value_template: >
      {% if value_json.task.taskResult.DO8.result == true %}
        ON
      {% else %}
        OFF
      {% endif %}
    payload_on: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO8":true}}}'
    payload_off: '{"origin":"HA","task":{"alias":"SET_DO","taskParams":{"DO8":false}}}'
    state_on: "ON"
    state_off: "OFF"

number:
  - name: "ATLAS AO1"
    unique_id: atlas_ao1
    state_topic: "analogOutputs/runtime/out"
    command_topic: "analogOutputs/runtime/in"
    value_template: "{{ value_json.task.taskResult.AO1.result }}"
    command_template: >
      {"origin":"HA","task":{"alias":"SET_AO","taskParams":{"AO1":{{ value | float }}}}}
    min: 4
    max: 20
    step: 0.1
    unit_of_measurement: "mA"
    mode: slider

  - name: "ATLAS AO2"
    unique_id: atlas_ao2
    state_topic: "analogOutputs/runtime/out"
    command_topic: "analogOutputs/runtime/in"
    value_template: "{{ value_json.task.taskResult.AO2.result }}"
    command_template: >
      {"origin":"HA","task":{"alias":"SET_AO","taskParams":{"AO2":{{ value | float }}}}}
    min: 4
    max: 20
    step: 0.1
    unit_of_measurement: "mA"
    mode: slider
EOF

Notes about this mqtt.yaml

Entity MQTT Topic Function
sensor.atlas_ai1 .. ai4 analogInputs/runtime/out Show analogue readings AI..AI4
binary_sensor.atlas_di1 .. di4 digitalInputs/runtime/out Show digital input states DI..DI4
switch.atlas_do1 .. do4 digitalOutputs/runtime/in/out Control and confirm digital outputs DO..DO4

Digital inputs accept two response formats:

{
"result": true
}

or:

{
"state": "high"
}

This allows compatibility with different versions of the Node-RED flow.

10. Restart and validate configuration

Restart Home Assistant:

cd /opt/atlas-ha
sudo docker compose restart

View logs:

sudo docker logs -f homeassistant

Confirm there are no errors related to MQTT or YAML.

In Home Assistant, check for entities similar to:

Entity Type
sensor.atlas_ai1 Analogue sensor
sensor.atlas_ai2 Analogue sensor
sensor.atlas_ai3 Analogue sensor
sensor.atlas_ai4 Analogue sensor
binary_sensor.atlas_di1 Digital input
binary_sensor.atlas_di2 Digital input
binary_sensor.atlas_di3 Digital input
binary_sensor.atlas_di4 Digital input
switch.atlas_do1 Digital output
switch.atlas_do2 Digital output
switch.atlas_do3 Digital output
switch.atlas_do4 Digital output

11. Simple dashboard in Home Assistant

Once the entities exist, you can create a simple card in the Dashboard.

Example YAML for a Lovelace view:

type: vertical-stack
cards:
  - type: entities
    title: Analog Inputs
    entities:
      - sensor.atlas_ai1
      - sensor.atlas_ai2
      - sensor.atlas_ai3
      - sensor.atlas_ai4

  - type: entities
    title: Digital Inputs
    entities:
      - binary_sensor.atlas_di1
      - binary_sensor.atlas_di2
      - binary_sensor.atlas_di3
      - binary_sensor.atlas_di4

  - type: entities
    title: Digital Outputs
    entities:
      - switch.atlas_do1
      - switch.atlas_do2
      - switch.atlas_do3
      - switch.atlas_do4

12. Test MQTT communication

Install MQTT client if necessary:

sudo apt-get install -y mosquitto-clients

View MQTT messages received by Home Assistant:

mosquitto_sub -h 127.0.0.1 -t 'analogInputs/runtime/out' -v
mosquitto_sub -h 127.0.0.1 -t 'digitalInputs/runtime/out' -v
mosquitto_sub -h 127.0.0.1 -t 'digitalOutputs/runtime/out' -v

Send a test to a digital output:

mosquitto_pub -h 127.0.0.1 -t 'digitalOutputs/runtime/in' -m '{"id":0,"origin":"TEST","task":{"action":"SET","taskParams":{"DO1":{"state":"high"}}}}'

13. Daily operation

Run these commands inside the folder:

cd /opt/atlas-ha
Action Command
View logs sudo docker logs -f homeassistant
View status sudo docker ps
Restart sudo docker compose restart
Stop sudo docker compose stop
Start sudo docker compose start
Update sudo docker compose pull && sudo docker compose up -d

14. Configuration backup

The ha-config folder contains the Home Assistant state/configuration. Create a backup:

sudo tar czf ~/atlas-ha-backup.tar.gz -C /opt/atlas-ha docker-compose.yml ha-config

15. Automatic installation with script

The current installation can be performed using the script:

install-atlas-ha.sh

This script takes a backup .tar.gz file as an argument and installs/restores Home Assistant in:

/opt/atlas-ha

15.1 Script used

#!/bin/bash
set -e

BACKUP_FILE="$1"
INSTALL_DIR="/opt/atlas-ha"

if [ -z "$BACKUP_FILE" ]; then
  echo "Usage:"
  echo "sudo ./install-atlas-ha.sh atlas-ha-backup.tar.gz"
  exit 1
fi

echo "Installing dependencies..."
sudo apt update
sudo apt install -y docker.io docker-compose-plugin

echo "Enabling Docker..."
sudo systemctl enable docker
sudo systemctl start docker

echo "Creating installation folder..."
sudo mkdir -p "$INSTALL_DIR"

echo "Extracting backup..."
sudo tar -xzvf "$BACKUP_FILE" -C "$INSTALL_DIR"

echo "Starting Home Assistant..."
cd "$INSTALL_DIR"
sudo docker compose up -d

echo "Installation complete."
echo "Access at: http://DEVICE_IP:8123"

15.2 What the script does

Step Action
Validate argument Confirms a backup file was specified
Install dependencies Runs apt update and installs docker.io + docker-compose-plugin
Enable Docker Runs systemctl enable docker and systemctl start docker
Create folder Ensures /opt/atlas-ha exists
Extract backup Extracts the .tar.gz to /opt/atlas-ha
Start HA Enters /opt/atlas-ha and runs sudo docker compose up -d
Show URL Indicates access via http://DEVICE_IP:8123

15.3 Prepare files

Copy to ATLAS:

install-atlas-ha.sh
atlas-ha-backup.tar.gz

Example with scp from PC:

scp install-atlas-ha.sh atlas-ha-backup.tar.gz pi@<atlas-ip>:/home/pi/

On ATLAS:

cd /home/pi
chmod +x install-atlas-ha.sh

15.4 Run installation

sudo ./install-atlas-ha.sh atlas-ha-backup.tar.gz

If the backup has a different name, replace in the command:

sudo ./install-atlas-ha.sh <backup-name>.tar.gz

15.5 Expected backup structure

The backup should contain the necessary structure so that, after extraction in /opt/atlas-ha, at least the following exists:

/opt/atlas-ha/

├── docker-compose.yml

└── ha-config/

    ├── configuration.yaml

    ├── mqtt.yaml

    ├── automations.yaml

    ├── scripts.yaml

    └── scenes.yaml

If the backup does not contain docker-compose.yml, the command sudo docker compose up -d will not be able to start Home Assistant.

15.6 Validation after the script

Check if the container is active:

sudo docker ps

View logs:

sudo docker logs -f homeassistant

Check HTTP response:

curl -s -o /dev/null -w "%{http_code}
" http://localhost:8123

Expected result:

Code Meaning
200 Home Assistant accessible
302 Home Assistant accessible, with redirection
000 connection refused May be normal in the first 1-2 minutes; wait and retry

Access in browser:

http://<atlas-ip>:8123

16. Uninstall / revert

Stop and remove the container:

cd /opt/atlas-ha
sudo docker compose down

Remove the image:

sudo docker image rm ghcr.io/home-assistant/home-assistant:stable

Optionally, also remove the configuration:

sudo rm -rf /opt/atlas-ha

The native ATLAS stack, including Node-RED, Grafana, InfluxDB, and Mosquitto, is not removed by these steps.

17. Summary

Step Command / Action
Create folder sudo mkdir -p /opt/atlas-ha
Create compose docker-compose.yml with network_mode: host
Start sudo docker compose up -d
Access http://<atlas-ip>:8123
Configure MQTT Broker 127.0.0.1:1883
Create entities configuration.yaml + mqtt.yaml
Restart sudo docker compose restart
Logs sudo docker logs -f homeassistant
Backup tar from the ha-config folder
Revert sudo docker compose down