3c6b55e Allowed HTTP server to restart after WDT for remote diagnostics, plus a logs/reset endpoint. Caught exceptions on Push
~jonahbron pushed to ~jonahbron/doorbell git
This product currently works, with a few workarounds.
Setup requires accessing the web server over localhost so that the browser treats the context as secure. This can be done by reverse-proxying port 8001 from the Android device to the development machine with ADB (wireless debugging works), the again reverse-proxying that port to the IP of the doorbell device.
After setting that up, http://localhost:8001
can be visited on a mobile
device, notifications enabled and Push subscription registered with the
doorbell. With that complete, the port forwarding can be halted, and the
doorbell/phone will operate as normal.
machine.WDT
mpremote edit
Currently using MicroPython firmware on the XIAO.
Execute the current program on-device by running:
nix run .#
Write the program to the hardware's memory by instead running:
nix run .#deploy-lib; nix run .#deploy-bin
The device listens for incoming requests on port 80. In order to access it from outside of the local network, the network router must be configure to forward an external port to the doorbell device. The external port can be different from the device's open port as long as the forwarding maps correctly.
Browsers only support Service Workers and the Notification API in "secure contexts". Localhost is one such secure context. In order to test on the development machine, forward a local port to the doorbell.
nix run .#forward-port
For debugging with Android, it's helpful to use ADB to forward a device-local port to the doorbell device. Use WiFi debugging.
nix run .#forward-port-android
This reverse-proxies from Android to the host computer, AND forward the port on the dev machine.
The Seeed Studio XIAO ESP32C3 can have its MicroPython firmware flashed fresh by running
nix run .#flash-firmware
A new microcontroller needs to be loaded with configuration. Run
mpremote edit etc/config.json
To open the config file, and insert a JSON object with keys ssid
, key
, and
port
.
For example:
{"ssid":"My WiFi","key":"wifi password","port":"80"}
Dependencies must also be installed.
nix run .#deploy-lib
Requires USBIPD-WIN set up with the device shared into the guest system.
https://learn.microsoft.com/en-us/windows/wsl/connect-usb#attach-a-usb-device
Ensure that NixOS WSL'd USBIP configuration is set up too.
https://nix-community.github.io/NixOS-WSL/options.html#wslusbipenable
Run this command to see the devices:
usbipd list
Ensure the bus ID is in the auto attach list for the NixOS WSL config.
https://nix-community.github.io/NixOS-WSL/options.html#wslusbipautoattach
Ensure user is in the dialout
group.
The doorbell/
directory contains the KiCad project. Inside of that, is the
kicad-deps
dir, which contains third-party dependency symbol/footprint files.
See Oshpark documentation: https://docs.oshpark.com/design-tools/kicad/generating-kicad-gerbers/
Uploading KiCad files directly is easier, but using Gerber files is necessary because it vectorizes the text, preserving font choice.
doorbell/export/
{F,B}.{Cu,Paste,Silkscreen,Mask}
and Edge.Cuts
export/