SENSBLUE ATLAS/Home Assistant: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (27 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:Home Assistant}}[[File:Home Assistant Logo.png|frameless|150x150px]] | |||
== Fast installation script == | |||
(If u are feeling lazy) | |||
<table style="border: none; background: transparent; margin: 15px 0; border-collapse: collapse;"> | |||
<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> | |||
</td> | |||
</table> | |||
= Home Assistant integration = | = Home Assistant integration = | ||
'''Installing Home Assistant on the SENSBLUE ATLAS / i.Cee²''' | '''Installing Home Assistant on the SENSBLUE ATLAS / i.Cee²''' | ||
| Line 16: | Line 26: | ||
=== 1. Prerequisites === | === 1. Prerequisites === | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Item | !Item | ||
!Value / check | !Value / check | ||
| Line 50: | Line 60: | ||
=== 2. Ports used on ATLAS === | === 2. Ports used on ATLAS === | ||
Before and after installation, confirm that the existing stack continues to respond. | Before and after installation, confirm that the existing stack continues to respond. | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Service | !Service | ||
!Port | !Port | ||
| Line 92: | Line 102: | ||
</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>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. | ||
Example alternative line:<syntaxhighlight lang="bash"> | 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> | ||
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 115: | Line 123: | ||
EOF | EOF | ||
</syntaxhighlight>'''Important notes:''' | </syntaxhighlight>'''Important notes:''' | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Option | !Option | ||
!Reason | !Reason | ||
| Line 142: | Line 150: | ||
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123 | curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8123 | ||
</syntaxhighlight>'''Expected result:''' | </syntaxhighlight>'''Expected result:''' | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Code | !Code | ||
!Meaning | !Meaning | ||
| Line 169: | Line 177: | ||
=== 7. Configure MQTT integration in Home Assistant === | === 7. Configure MQTT integration in Home Assistant === | ||
Since the container uses <code>network_mode: host</code>, Home Assistant can access the local Mosquitto via: | Since the container uses <code>network_mode: host</code>, Home Assistant can access the local Mosquitto via: | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Field | !Field | ||
!Value | !Value | ||
| Line 347: | Line 355: | ||
EOF | EOF | ||
</syntaxhighlight>'''Notes about this mqtt.yaml''' | </syntaxhighlight>'''Notes about this mqtt.yaml''' | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Entity | !Entity | ||
!MQTT Topic | !MQTT Topic | ||
| Line 383: | Line 391: | ||
In Home Assistant, check for entities similar to: | In Home Assistant, check for entities similar to: | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Entity | !Entity | ||
!Type | !Type | ||
| Line 462: | Line 470: | ||
mosquitto_sub -h 127.0.0.1 -t 'digitalInputs/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 | mosquitto_sub -h 127.0.0.1 -t 'digitalOutputs/runtime/out' -v | ||
</syntaxhighlight>Send a test to a digital output: | </syntaxhighlight>Send a test to a digital output:<syntaxhighlight lang="bash"> | ||
mosquitto_pub -h 127.0.0.1 -t 'digitalOutputs/runtime/in' -m '{"id":0,"origin":"TEST","task":{"action":"SET","taskParams":{"DO1":{"state":"high"}}}}' | |||
</syntaxhighlight> | |||
=== 13. Daily operation === | === 13. Daily operation === | ||
| Line 470: | Line 478: | ||
cd /opt/atlas-ha | cd /opt/atlas-ha | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Action | !Action | ||
!Command | !Command | ||
| Line 500: | Line 508: | ||
=== 15. Production notes === | === 15. Production notes === | ||
Before sending a unit to a client, review the following points: | Before sending a unit to a client, review the following points: | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Point | !Point | ||
!Note | !Note | ||
| Line 564: | Line 572: | ||
==== 16.2 What the script does ==== | ==== 16.2 What the script does ==== | ||
{| class="wikitable" | {| class="wikitable mix-table" | ||
!Step | !Step | ||
!Action | !Action | ||
| Line 594: | Line 602: | ||
install-atlas-ha.sh | install-atlas-ha.sh | ||
atlas-ha-backup.tar.gz | atlas-ha-backup.tar.gz | ||
</syntaxhighlight>Example with '''scp''' from PC: | </syntaxhighlight>Example with '''scp''' from PC:<syntaxhighlight lang="bash"> | ||
scp install-atlas-ha.sh atlas-ha-backup.tar.gz pi@<atlas-ip>:/home/pi/ | |||
</syntaxhighlight>On ATLAS:<syntaxhighlight lang="bash"> | |||
cd /home/pi | |||
chmod +x install-atlas-ha.sh | |||
</syntaxhighlight> | |||
==== 16.4 Run installation ==== | |||
<syntaxhighlight lang="bash"> | |||
sudo ./install-atlas-ha.sh atlas-ha-backup.tar.gz | |||
</syntaxhighlight>If the backup has a different name, replace in the command:<syntaxhighlight lang="bash"> | |||
sudo ./install-atlas-ha.sh <backup-name>.tar.gz | |||
</syntaxhighlight> | |||
==== 16.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: | |||
/opt/atlas-ha/ | |||
├── docker-compose.yml | |||
└── ha-config/ | |||
├── configuration.yaml | |||
├── mqtt.yaml | |||
├── automations.yaml | |||
├── scripts.yaml | |||
└── scenes.yaml | |||
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 ==== | |||
Check if the container is active:<syntaxhighlight lang="bash"> | |||
sudo docker ps | |||
</syntaxhighlight>View logs:<syntaxhighlight lang="bash"> | |||
sudo docker logs -f homeassistant | |||
</syntaxhighlight>Check HTTP response:<syntaxhighlight lang="bash"> | |||
curl -s -o /dev/null -w "%{http_code} | |||
" http://localhost:8123 | |||
</syntaxhighlight>'''Expected result:''' | |||
{| class="wikitable mix-table" | |||
!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 | |||
=== 17. Uninstall / revert === | |||
Stop and remove the container:<syntaxhighlight lang="bash"> | |||
cd /opt/atlas-ha | |||
sudo docker compose down | |||
</syntaxhighlight>Remove the image:<syntaxhighlight lang="bash"> | |||
sudo docker image rm ghcr.io/home-assistant/home-assistant:stable | |||
</syntaxhighlight>Optionally, also remove the configuration:<syntaxhighlight lang="bash"> | |||
sudo rm -rf /opt/atlas-ha | |||
</syntaxhighlight>The native ATLAS stack, including Node-RED, Grafana, InfluxDB, and Mosquitto, is not removed by these steps. | |||
=== 18. Summary === | |||
{| class="wikitable mix-table" | |||
!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://<ip-do-atlas>:8123 '''<u>http://<atlas-ip>:8123</u>'''] | |||
|- | |||
|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 | |||
|} | |||