Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update readme #101

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .assets/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/esp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/plan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .assets/users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 12 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,10 @@ The computer can be connected from any network as long as the network has open p

## Requirements
For this project to work you need to have the following installed on the server:
- Linux (Tested on [Ubuntu Server 22.04](https://ubuntu.com/download/server))
- Linux (Tested on [Ubuntu Server 22.04](https://ubuntu.com/download/server) and [Fedora 40](https://fedoraproject.org/workstation/download))
- [Docker Engine](https://docs.docker.com/engine/install/ubuntu/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [Curl](https://curl.se/download.html)
- [jq](https://stedolan.github.io/jq/download/)
```bash
sudo apt-get update
sudo apt-get install git curl jq
sudo apt-get install ca-certificates
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

## Installation
First thing you need to do is to clone the repository from GitHub on the server
Expand All @@ -44,14 +31,13 @@ git clone https://github.com/museebolo/climat_guardian.git
cd climat-guardian
```

---
--
[Info]: <> (
This is the list of all the files that end with .example
)
Once the repository is cloned you can remove the `.example` at the end of the following files:
- .env.example
- esp32/config/secrets.yaml.example
- nextjs-interface/src/contexts/SampleContext.example.tsx
```bash
cp .env.example .env
cp esp32/config/secrets.yaml.example esp32/config/secrets.yaml
Expand Down Expand Up @@ -82,9 +68,12 @@ Once everything is configured on the server, you can start the project by runnin
docker compose -f docker-compose.prod.yml up -d --remove-orphans --build
```
Once the docker is running you can access the web interface by going to the ip address of the server in the web browser of the computer\
the default user is `admin` and has `admin` as password
the default user is `admin` and has `admin` as password, it is recommended to create a new user and delete the default one once you are connected, you can do so under the ``Users`` tab

![web interface](/.assets/dashboard.png)
![Dashboard](/.assets/dashboard.png)
![Plan](/.assets/plan.png)
![Users](/.assets/users.png)
![Esp page](/.assets/esp.png)

## ESP 32 Installation
This project uses [esp home](https://github.com/esphome/esphome) to manage the esp32, you can configure the esp32 by following the instructions below
Expand All @@ -99,17 +88,15 @@ This project uses [esp home](https://github.com/esphome/esphome) to manage the e
Be sure to memorize the ip address of the esp32 (you can find it in the logs)
$${\color{gray} \text{[15:39:12]} \color{magenta} \text{[C]\[wifi:416\]: IP Address: 172.16.5.65}}$$
- You can now unplug the esp32 and plug it to any other power source
- Press `Edit` at the bottom of the logs
- Connect yourself to the dashboard from another tab in the web browser of the computer
- Press the ``ajouter un esp`` button on the left and enter the ip address of the esp32 with the name you want it to have in the interface
- Press the ``...`` on the right of the page and press ``Afficher et Copier le Token``
- Back on the esphome, press `Edit` at the bottom of the logs
- Copy everything from the line 31 of the file `esp32/esp32.yaml` on the server and paste it at the end of your esp32's configuration file
```bash
clear && cat esp32/esp32.yaml | sed -n '31,$p'
```
- Replace the XXX... at the end of the code with the token of your esp32\
you can generate this token by running the following command on the server (replace `255.255.255.255` with the ip address of the esp32)
```bash
export TOKEN=$(curl 'http://127.0.0.1/php/login' -d '{"username":"admin","password":"admin"}' -X POST 2> /dev/null | jq '.token' -r)
curl -H "Authorization: Bearer $TOKEN" "http://127.0.0.1/php/esp" -d '{"ip":"255.255.255.255"}' -X POST 2> /dev/null | jq '.token' -r
```
- Replace the XXX... at the end of the code with the token you copied
- Press `INSTALL` and select `Wirelessly` (the 1st option)
- Wait for the installation to finish
- Press `STOP` to exit the logs
Expand Down
5 changes: 3 additions & 2 deletions esp32/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
config/.esphome/
config/secrets.yaml
config/
!config/secrets.yaml.example