jnthas / clockwise

do-it-yourself, full-featured and smart wall clock device
https://clockwise.page
MIT License
304 stars 39 forks source link

[Feature Request] Web firmware updates #44

Open JeffWDH opened 1 year ago

JeffWDH commented 1 year ago

I think most people use this project for a clock that sits on a shelf, wall, or other location that may not be near a computer. It would be handy to have the ability to upload new firmware to the device without physically connecting to it.

Fortunately, this is pretty easy on an ESP32 using Arduino: https://github.com/espressif/arduino-esp32/blob/master/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino

A prerequisite for this IMO would be to implement some sort of authentication on the web interface. We wouldn't want any unauthenticated user to have access to change settings / potentially upload malicious code.

@jnthas what are your thoughts on this?

jnthas commented 1 year ago

I agree. Update it remotely was one of the things I thought but in that time I used the PxMatrix to drive the display and it frozen when I updated via OTA, then I gave a break for this feature. Nowadays, my plan is to use the same Improv protocol I use today for Serial but for BLE. The problem is, I have to implement it from scratch because there is no library for that. I did it for Serial and I would like to do the same for BLE.

robegamesios commented 1 year ago

Yes, having the ability to update the firmware without having it connected to your computer would be awesome. how would you integrate https://github.com/espressif/arduino-esp32/blob/master/libraries/ArduinoOTA/examples/OTAWebUpdater/OTAWebUpdater.ino to the project? thanks

jnthas commented 1 year ago

The project already have a webserver, I believe it's not that hard to implement this feature, add a couple more endpoints and process like you guys sent as example. I'm creating a tag for this.

robegamesios commented 12 months ago

@jnthas I was able to do a sample of Mario clock and I was able to upload a bin file to upload it. not clean but worked for me. see attached.

  1. upload the otaDefaultUpdate to esp32.
  2. then access the ip address and upload the Mario clock bin file
  3. I added a reset wifi button.
  4. Setting wifi is the same in wifi manager. then include the timezone

Like you said, if it can get implemented as an endpoint to upload the bin file that would be super awesome. thanks I dont know how to create the bin file for the other clock faces e.g. canvas, pacman, time in words, world clock, or do you have a ino file for them? basically the OTA code needs to get included every time.

mariobros-clock.zip otaDefault [mariobros-clock.ino.bin.zip](https://github.com/jnthas/clockwise/files/12840012/mariobros-clock.ino.bin.zip) Update.ino.bin.zip otaDefaultUpdate.ino.zip

jnthas commented 12 months ago

Hi Rob. Thank you! Could you open a PR so we can merge it or work on a final version together.

robegamesios commented 10 months ago

@jnthas @JeffWDH check this out.

  1. Ive included all the current clockwise themes and Audio Visualizer which can be selected and the led matrix panel will update to it and restart itself.
  2. i also added OTA.
  3. I'm having issues with the Canvas clockface though, if the audio visualizer is included i get a No memory error when deserializing the json. maybe you can figure it out? I also tried to make the Audio visualizer a clockface but i still get the no memory error.
  4. right now the only way the only for me to use the canvas theme is to upload firmware via OTA. would be great to not have to upload it as a firmware.

Still prototyping, can use more improvement.

https://github.com/robegamesios/clockwise/tree/feature/add_audio_visualizer

Screenshot 2023-11-11 at 7 43 11 PM Screenshot 2023-11-11 at 7 54 03 PM