Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trombik/roomping
ICMP sensor on ESP32 and ESP8266
https://github.com/trombik/roomping
esp-idf esp32 esp8266 icmp monitoring network
Last synced: 17 days ago
JSON representation
ICMP sensor on ESP32 and ESP8266
- Host: GitHub
- URL: https://github.com/trombik/roomping
- Owner: trombik
- License: isc
- Created: 2019-12-01T02:46:42.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-26T06:43:07.000Z (over 4 years ago)
- Last Synced: 2024-11-11T10:19:10.950Z (about 2 months ago)
- Topics: esp-idf, esp32, esp8266, icmp, monitoring, network
- Language: C
- Homepage:
- Size: 335 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.development.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Development
## Required applications
* `git`
* `openssl`
* an HTTP client, such as `fetch(1)`, `wget`, or `curl`
* `esp-idf` and its tool-chains installed
* `astyle` (optional)## Environment variables
### `IDF_PATH`
`IDF_PATH` must be path to `esp-idf` directory.
```console
export IDF_PATH=~/github/trombik/esp-idf
```### `PATH`
`PATH` must include path to the tool-chain `bin` directory, where
`xtensa-esp32-elf-gcc` and others are.```console
export PATH="/usr/local/xtensa-esp32-elf/bin:$PATH"
```### `ESPPORT`
Set `ESPPORT` to serial port of your device.
```console
export ESPPORT=/dev/ttyU0
```## Generating self-signed certificates for HTTPS
The `OTA` process fetches firmware over HTTPS. Create your own self-signed
certificates.```console
> pwd
/home/trombik/github/trombik/roomPing
> openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365 -nodes
Generating a RSA private key
...........+++++
...........................................................................+++++
writing new private key to 'ca_key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:192.168.1.100
Email Address []:
```Note that, when `openssl` asks questions, you just hit enter key except when
it asks `Common Name`. The `Common Name` should be the IP address or a valid
DNS name of HTTPS server. Make sure this matches the IP address or the host
name of `PROJECT_LATEST_APP_URL`.Copy the keys.
```console
> cp ca_key.pem src/main/certs/ca_key_ota.pem
> cp ca_cert.pem src/main/certs/ca_cert_ota.pem
```### Set `PROJECT_LATEST_APP_URL`
Navigate to `Project configuration` -> `URL to the latest application`. Set
the value to: `https://ip.add.re.ss:8070/build/roomPing.bin`.Make sure to replace `ip.add.re.ss` with the actual IP address of the local
machine.```console
> $IDF_PATH/tools/idf.py menuconfig
```### Running HTTPS server on the local machine
Run HTTPS server. Do NOT use `openssl s_server -HTTP`. You should use a
full-fledged HTTPS server, such as `nginx`, to avoid weird issues. An example
`nginx.conf` is located at [`tools/nginx.conf`](tools/nginx.conf).Make sure the URL works.
`wget(1)` example output:
```console
> pwd
/home/trombik/github/trombik/roomPing/src
> wget --ca-certificate=main/certs/ca_cert_ota.pem https://192.168.1.54:8070/build/roomPing.bin
--2019-12-02 13:43:11-- https://192.168.1.54:8070/build/roomPing.bin
Connecting to 192.168.1.54:8070... connected.
HTTP request sent, awaiting response... 200 ok
Length: unspecified [text/plain]
Saving to: ‘roomPing.bin’
````fetch(1)` example output:
```console
> pwd
/home/trombik/github/trombik/roomPing/src
> fetch --ca-cert main/certs/ca_cert_ota.pem https://192.168.1.54:8070/build/roomPing.bin
fetch: https://192.168.1.54:8070/build/roomPing.bin: size of remote file is not known
roomPing.bin 826 kB 443 MBps 00s
```### Building the latest firmware and flashing it
To perform `OTA`, the firmware on the device must be newer than `FIXME`. If
not, update the firmware over USB serial.```console
> pwd
/home/trombik/github/trombik/roomPing
> cd src
> $IDF_PATH/tools/idf.py flash
```### Performing `OTA`
Make sure the version of the running firmware is older than the new firmware.
Set run to `esp/ota/set`.
```console
> mosquitto_pub -h ip.add.re.ss -t 'homie/foo/esp/reboot/set' -m 'reboot'
```