Skip to content

Commit

Permalink
fix: readme and use latest docker images (#24)
Browse files Browse the repository at this point in the history
refactor: change docker image versions

style: use latex instead of html to display color\n\nhtml isn't properly render on github while latex is\nthis line is here to show the user what the line with the ip address looks like on the esphone, the color matches the ones on esphome

fix: ask to change the ip in secret.yaml

refactor: use post request to send data to backend with curl

dev: make gitignore more precise
  • Loading branch information
Rignchen authored Jun 10, 2024
1 parent 2b4b46f commit a5214ed
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.idea
.idea/
# vim backup files
*.sw[pon]
.env
# test bash script
reset_test.sh
# nohup
nohup.out
2 changes: 1 addition & 1 deletion Dockerfile.Php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# php 8.3 with the files, install dependencies
FROM composer:2.7.4
FROM composer:2.7
COPY login .
RUN composer install

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ It is recommended to let the other environment variables as they are

---
Finally, you **have to** fill the Wi-Fi credentials in `esp32/config/secrets.yaml`\
You also **have to** change the `127.0.0.1` in `Interface/src/contexts/SampleContext.tsx` to the ip address of the server
You also **have to** change the `127.0.0.1` in `Interface/src/contexts/SampleContext.tsx` and `esp32/config/secrets.yaml` by the ip address of the server

## Start the project
Once everything is configured on the server, you can start the project by running the docker compose on the server
Expand All @@ -96,8 +96,8 @@ This project uses [esp home](https://github.com/esphome/esphome) to manage the e
- Press `INSTALL` and select `Plug into the computer running ESPHome Dashboard` (the 3rd option)
- Select the device with ``/dev/ttyUSB0`` as path
- Wait for the installation to finish\
Be sure to memorize the ip address of the esp32 (you can find it in the logs)\
<span style="background-color: rgba(125,125,125,0.3);"><span style="color:#ddd">[15:39:12]</span><span style="color:rgb(255, 0, 255)">[C][wifi:416]: IP Address: 172.16.5.65</span></span>
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
- 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
Expand All @@ -107,8 +107,8 @@ 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.php?username=admin&password=admin' | jq '.token' -r)
curl -H "Authorization: Bearer $TOKEN" "http://127.0.0.1/php/esp.php?ip=255.255.255.255" | jq '.token' -r
export TOKEN=$(curl 'http://127.0.0.1/php/login.php' -d '{"username":"admin","password":"admin"}' -X POST | jq '.token' -r)
curl -H "Authorization: Bearer $TOKEN" "http://127.0.0.1/php/esp.php" -d '{"ip":"255.255.255.255"}' -X POST | jq '.token' -r
```
- Press `INSTALL` and select `Wirelessly` (the 1st option)
- Wait for the installation to finish
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
privileged: true

db:
image: postgres:12.19-alpine
image: postgres:16.3-alpine
shm_size: 128mb
volumes:
- "${DB_PATH}:/var/lib/postgresql/data"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
privileged: true

db:
image: postgres:12.19-alpine
image: postgres:16.3-alpine
shm_size: 128mb
volumes:
- "./database/data:/var/lib/postgresql/data"
Expand Down
2 changes: 1 addition & 1 deletion esp32/config/secrets.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
wifi_ssid:
wifi_password:
# The url of the server to send the data to
webhook_url: "http://postgrest.memoires-info.com/insert_data"
webhook_url: "http://127.0.0.1/postgrest/rpc/insert_data"

0 comments on commit a5214ed

Please sign in to comment.