Tempi — build one yourself (software 3.1.0)

GETTING STARTED
1. Wire it as in the table at the top of firmware/src/main.cpp
   (RFM69HW 433 MHz + ESP32-S3-Zero, antenna 17.3 cm).
2. Plug the board in over USB:
       cd firmware
       pio run -t upload      # the program and the partition table
       pio run -t uploadfs    # the page your phone shows
3. Join the WiFi network "Tempi" with your phone and pick your home network on the page that opens.
4. Open http://tempi.local

Nothing needs changing in the code. The sockets' sender id is derived from the chip's serial
number, and you pick a notification channel name under the cog.

GOOD TO KNOW
- Without internet, Tempi controls and logs as usual. Readings get the right time of day
  once it reaches a time server.
- Several boxes: cog -> "Add box". Each box gets its own thermometers, sockets,
  thermostat and batches.
- uploadfs overwrites saved readings and socket events. Settings are kept.

UPDATES
Once a day Tempi checks for a new signed version on Karl's server. Nothing is
installed unless you say yes (unless you choose "Auto" yourself).
If you have changed the code, such an update overwrites your changes. Turn it off under
cog -> Updates -> Off. You can upload your own firmware.bin in the same place
("Manual upload"). It is in firmware/.pio/build/esp32s3zero/ after "pio run".

REMOTE ACCESS THROUGH YOUR OWN SERVER (for the experienced, off by default)
Tempi can call out to a server you run, so you reach the page from outside without
opening anything in your router. You need a computer with Node, your own domain name and a
web server with a certificate from Let's Encrypt (Tempi only trusts them).

1. On the server:
       cd relay && npm install
       TEMPI_TUNNEL_TOKEN=<long random string> TEMPI_BIND=127.0.0.1 node tunnel-relay.js
2. The web server should send /__tunnel to port 4853 and everything else to port 4852.
   PUT A PASSWORD on everything except /__tunnel: the page switches a heater on and off.
   Example for Caddy (change the name and password hash, see "caddy hash-password"):
       tempi.example.com {
           handle /__tunnel {
               reverse_proxy 127.0.0.1:4853
           }
           handle {
               basic_auth {
                   name <hash>
               }
               reverse_proxy 127.0.0.1:4852 {
                   flush_interval -1
                   transport http {
                       keepalive off
                   }
               }
           }
       }
3. Tell your Tempi, from your home network:
       curl -X POST http://tempi.local/api/tunnel \
         -d '{"host":"tempi.example.com","token":"<the same string>","enabled":true}'
   The state shows at http://tempi.local/api/tunnel
