An ESP32-based Redis-watcher and info-displayer https://rpjios.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
Ryan Joseph b1ef2031f8 WIP 1年前
scripts Add Deep sleep mode & provisioning functional verification 1年前
LICENSE Create LICENSE 1年前
README.md Update README.md 1年前
zero_watch.ino WIP 1年前
zw_common.cpp ZeroWatch public repo initial commit 1年前
zw_common.h WIP 1年前
zw_displays.cpp WIP: add pagination, scroll w/ home button; scroll brightness w/ RST button 1年前
zw_displays.h Add Deep sleep mode & provisioning functional verification 1年前
zw_logging.h WIP, not sure when I did all of this but should probably check it in... 1年前
zw_ota.cpp No. 6: Remove delay use in main loop (#8) 1年前
zw_ota.h No. 6: Remove delay use in main loop (#8) 1年前
zw_otp.cpp Minor changes 1年前
zw_otp.h Break out zw_otp 1年前
zw_provision.cpp Retry Redis connection a few times on failure; add null display spec; try to clear boot count upon successful OTA; bump to 0.2.3.8 1年前
zw_provision.h Add Deep sleep mode & provisioning functional verification 1年前
zw_redis.cpp WIP: add pagination, scroll w/ home button; scroll brightness w/ RST button 1年前
zw_redis.h Get time from Redis, set it to RTC 1年前
zw_wifi.cpp WIP: add pagination, scroll w/ home button; scroll brightness w/ RST button 1年前
zw_wifi.h Add Deep sleep mode & provisioning functional verification 1年前

README.md

ZeroWatch

A highly-configurable ESP32-based Redis-watcher and TM1637-displayer, with OTA capability.

Currently driving stuff like this and this:

version 2 version 1

Dependencies

Provisioning

Units must be provisioned with critical datum, written to EEPROM, before they will behave correctly.

To do so, fill in the aforementioned fields appropriately, set ZERO_WATCH_PROVISIONING_MODE to 1 and upload to your ESP32 while monitoring serial (at this baud rate). There are wait-points that allow you to remove power for the unit before data is written.

Most critical of these values is hostname, which is limited to 32 characters in length and must be unique across your network. All references to HOSTNAME elsewhere in this document refer to this data.

None of the remaining fields must be longer than PSTRING_LENGTH_LIMIT bytes and ZWPROV_REDIS_PORT must always only be two bytes (sizeof(uint16_t)).

Once provisioned, the unit will halt forever, so to return it to normal behavior: unset ZERO_WATCH_PROVISIONING_MODE and all ZWPROV_* fields, rebuild and reflash. That’s it!

Configuration

Most of the behavior, save for the display specifications (which will one day be configurable as well), is configurable at runtime via the Redis instance the unit connects to.

Specifically, a number of fields are exposed as HOSTNAME:config:* keys for which any written (valid) value will be honored on the next refresh cycle.

There is also a control point key at HOSTNAME:config:controlPoint, a metadata getter at HOSTNAME:config:getValue and the OTA update configuration key at HOSTNAME:config:update.

OTA

Set ZWPROV_OTA_HOST when provisioning to an HTTP host visible to the unit and this will be combined with the update metadata’s url component to produce the fully-qualified URL for acquisition of the update binary.

The aforementioned metadata must be written to HOSTNAME:config:update as as JSON object consisting of: url, md5, size, and otp (a “one-time password”), e.g.:

{
    "url":  "zero_watch_updates/zero_watch-v0.2.0.6.ino.bin",
    "md5":  "1a6f92066b6e3a63362c6b376fbc438d",
    "size": 924960,
    "otp": 123
}

On the next refresh cycle, this data will be picked up and acted upon. Monitor serial or Redis (depending on HOSTNAME:config:publishLogs) for logging. Upon successful update, the unit will delete HOSTNAME:config:update and reset to the new software (after a small, build-time configurable delay).

Pre-built images of recent versions are available here, but only via HTTPS so as to be unusable as ZWPROV_OTA_HOST. You should only be deploying this type of insecure OTA on a secure local or virtual private network, anyway! 😄