SENSBLUE ATLAS/Home Assistant: Difference between revisions
Appearance
No edit summary Tags: Manual revert Visual edit |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
<span class="atlas-btn">[[Media:Atlas-ha-install-v1.zip|Download Script]]</span> | <span class="atlas-btn">[[Media:Atlas-ha-install-v1.zip|Download Script]]</span> | ||
</td> | </td> | ||
</table> | </table>This script takes a backup file as an argument and contains: <code>.tar.gz</code> <syntaxhighlight lang="bash"> | ||
atlas-ha-installer/ | |||
├── docker-compose.yml | |||
├── install.sh | |||
├── README.md | |||
├── provision_areas.py | |||
└── ha-config/ | |||
├── configuration.yaml | |||
├── mqtt.yaml | |||
├── automations.yaml | |||
├── scripts.yaml | |||
└── scenes.yaml | |||
</syntaxhighlight> | |||
=== 1. What the script does === | |||
{| class="wikitable mix-table" | |||
!Stage | |||
!Action | |||
|- | |||
|Validates argument | |||
|Confirms that a backup file was specified | |||
|- | |||
|Installs dependencies | |||
|Run <code>apt update</code> and install <code>docker.io</code> and <code>docker-compose-plugin</code> | |||
|- | |||
|Enables Docker | |||
|Executes <code>systemctl enable docker</code> and <code>systemctl start docker</code> | |||
|- | |||
|Breed pasta | |||
|Ensure <code>/opt/atlas-ha</code> exists | |||
|- | |||
|Extract backup | |||
|Extract the <code>.tar.gz</code> file to <code>/opt/atlas-ha</code> | |||
|- | |||
|HA starts up | |||
|Navigates to <code>/opt/atlas-ha</code> and runs <code>sudo docker compose up -d</code> | |||
|- | |||
|Show URL | |||
|Indicate access via <code><nowiki>http://DEVICE_IP:8123</nowiki></code> | |||
|} | |||
=== 2. Prepare Device === | |||
Transfer the package to ATLAS, for example using WinSCP: | |||
# Open the connection to ATLAS using WinSCP. | |||
# Copy <code>atlas-ha-installer.zip</code> or <code>atlas-ha-installer.tar.gz</code> to <code>/home/pi</code>. | |||
# Drag the folder extracted from the .zip file to the /home/pi directory on ATLAS. | |||
'''Note:''' If you need help installing WinSCP, '''''<u>[[SENSBLUE ATLAS/Putty & WinSCP#Install WinSCP|click here]]</u>'''''. | |||
On ATLAS, after transferring the necessary files, establish an SSH connection | |||
If the package is <code>.zip</code>:<syntaxhighlight lang="bash"> | |||
cd /home/pi | |||
unzip atlas-ha-installer.zip | |||
cd atlas-ha-installer | |||
</syntaxhighlight>If the package is:<code>.tar.gz</code><syntaxhighlight lang="bash">cd /home/pi tar | |||
-xzf atlas-ha-installer.tar.gz | |||
cd atlas-ha-installer</syntaxhighlight>Grant execution permission<syntaxhighlight lang="bash"> | |||
chmod +x install.sh | |||
</syntaxhighlight> | |||
=== 3. Execute installation === | |||
The script will install the required dependencies, install/configure Docker, copy the files to <code>/opt/atlas-ha</code>, and start Home Assistant.<syntaxhighlight lang="bash"> | |||
sudo ./install.sh | |||
</syntaxhighlight>After installation, the following should exist:<syntaxhighlight> | |||
/opt/atlas-ha/ | |||
├── docker-compose.yml | |||
└── ha-config/ | |||
├── configuration.yaml | |||
├── mqtt.yaml | |||
├── automations.yaml | |||
├── scripts.yaml | |||
└── scenes.yaml | |||
</syntaxhighlight> | |||
=== 4. Post-script validation === | |||
Verify that the container is active:<syntaxhighlight lang="bash"> | |||
sudo docker ps | |||
</syntaxhighlight>Check logs:<syntaxhighlight lang="bash"> | |||
sudo docker logs -f homeassistant | |||
</syntaxhighlight>Verify HTTP response:<syntaxhighlight lang="bash"> | |||
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123 | |||
</syntaxhighlight>Expected result: | |||
{| class="wikitable mix-table" | |||
!Code | |||
!Meaning | |||
|- | |||
|200 | |||
|Home Assistant access | |||
|- | |||
|302 | |||
|Home Assistant accessible, with redirection | |||
|- | |||
|000 or connection refused | |||
|It can be normal for the first 1–2 minutes; wait and repeat. | |||
|}Access in browser<syntaxhighlight> | |||
http://<ip-do-atlas>:8123 | |||
</syntaxhighlight> | |||
= Home Assistant integration = | = Home Assistant integration = | ||
| Line 65: | Line 163: | ||
'''Note:''' If you need help installing PuTTY, [[SENSBLUE ATLAS/Putty & WinSCP#Install PuTTY|'''''<u>click here</u>''''']]. | '''Note:''' If you need help installing PuTTY, [[SENSBLUE ATLAS/Putty & WinSCP#Install PuTTY|'''''<u>click here</u>''''']]. | ||
[[File:Image.png|center|frameless|448x448px]] | [[File:Image.png|center|frameless|448x448px]] | ||
'''Note:''' SSH access to the ATLAS device requires authentication. | '''Note:''' SSH access to the ATLAS device requires authentication. | ||
| Line 146: | Line 245: | ||
==== 3.4 Add Docker repository ==== | ==== 3.4 Add Docker repository ==== | ||
<syntaxhighlight lang="bash"> | <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 | 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> | </syntaxhighlight> | ||