Skip to content

Commit

Permalink
20240415
Browse files Browse the repository at this point in the history
Web UI:
- Introduced login page, replacing the basic authentication window.
- Added a button to toggle password visibility.
- Segregated all LED-related options into a separate card.
- Implemented night mode configuration options for LEDs on the General page.
- Incorporated emoji as identifying buttons for LEDs.
- Updated status bar icons to reflect the current state.
- Enabled version selection for ESP32 updates via the web interface.
- Rectified issues with the color modal and tables.
- Reorganized buttons on the Tools page for improved usability.
- Introduced a factory reset button on the Tools page.
- Added language selection in the side navigation menu.
- Integrated i18next for translation support.
- Adapted static HTML pages and all JavaScript for compatibility with i18next.
- Conditionally hid LEDs and UART mode options based on pin availability in the configuration.
- Refined input placeholders, patterns, and title attributes, specifically on the MQTT page.
- Implemented toasts for ESP update notifications and beta feedback submissions.
- ESP32 updating modal window with confirmation before start
- All devices stats sends to web client in clean values, formatting goes in the browser.
- Add clock in header navbar
- Add tooltips to navbar icons and clock
- Add progress bars to visualize ESP temp, used heap and RSSI
- Add NVS and FS stats on root page (with progress bars)

Code:
- Set default values for mqttTopic and Husarnet hostname.
- Configured MQTT server by FQDN (see issue #33 @ UZG-01).
- Relocated configHw.json to the root folder for easier access.
- Purged debug logs for cleaner codebase.
- Addressed temperature offset configuration issues during board configuration search.
- Consolidated all LED actions into a single function for efficiency.
- Corrected minor errors encountered during configuration migration.
- Overhauled the factory reset process for reliability.
- Added an API route for factory resets to streamline the process.
- Established webserver routes for locating JSON files and facilitating i18next.
- Refined the ESP32 update process indication through the /events route.
- Moved constants to separate files (keys.cpp and keys.h) for code maintainability and memory optimization.
- Fix #15 @ ZigStarGW-FW
- Fix #30 @ UZG-01
- WiFi and Ethernet works at the same time with auto AP starting if any error occurs
- Rework LED logic using background tasks (indicates modes, connection state, zigbee errors, support disabling)
- Rework BTN logic
    - short click disable/enable LEDs for current session (only if NOT fully disabled)
    - Long click over 3sec - toggle working mode NETWORK/USB, flashing 1Hz when ready to release
    - Long click over 5sec - enable Zigbee BSL mode, flashing 3Hz when ready to release

Build and Development:
- Applied minification to JavaScript and JSON files for optimized performance.
- Reorganized folders within websrc and webh dirs for better project structure.
- Add i18n Ally config for VSCode showing translations
- Script for generate keys.h

Docs:

Hardware:
  • Loading branch information
xyzroe committed Apr 15, 2024
1 parent 85f0a59 commit f223136
Show file tree
Hide file tree
Showing 69 changed files with 9,214 additions and 2,750 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ jobs:
- name: Get last commit message
id: get_commit_message
run: |
currentTag=${GITHUB_REF#refs/tags/}
badgeText="![GitHub Downloads](https://img.shields.io/github/downloads/xyzroe/XZG/$currentTag/total)%0A"
commitMessage=$(git log -1 --pretty=%B | tail -n +3)
fullCommitMessage="$badgeText$commitMessage"
echo "commitMessage<<EOF" >> $GITHUB_ENV
echo "$commitMessage" >> $GITHUB_ENV
echo "$fullCommitMessage" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}

- name: Calculate SHA-256 hash of the firmware
id: sha256_hash
Expand Down
26 changes: 26 additions & 0 deletions .vscode/i18n-ally-custom-framework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .vscode/i18n-ally-custom-framework.yml

languageIds:
- javascript
- html

usageMatchRegex:
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
- "data-i18n=['\"]({key})['\"]"
- "([^;'\"]*?)\\[placeholder\\]"
- "([^;'\"]*?)\\[title\\]"





scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"

# An array of strings containing refactor templates.
# The "$1" will be replaced by the keypath specified.
# Optional: uncomment the following two lines to use

# refactorTemplates:
# - i18n.get("$1")

monopoly: true
152 changes: 100 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,136 @@
# XZG Firmware
<div align="center"><img src="src/websrc/img/logo.svg" width="128" height="128" alt="XZG logo">

This repository contains the firmware for various, ESP32 based, Zigbee gateways.

<div align="center">
<a href="https://github.com/xyzroe/xzg/releases">
<img src="https://img.shields.io/github/release/xyzroe/xzg.svg" alt="GitHub version">
</a>
<img src="https://img.shields.io/github/actions/workflow/status/xyzroe/XZG/build_release_push" alt="GitHub Actions Workflow Status">
<a href="https://github.com/xyzroe/xzg/releases/latest">
<img src="https://img.shields.io/github/downloads/xyzroe/xzg/total.svg" alt="GitHub download">
</a>
<img src="https://img.shields.io/github/issues/xyzroe/XZG" alt="GitHub Issues or Pull Requests">
<a href="LICENSE">
<img src="https://img.shields.io/github/license/xyzroe/xzg.svg" alt="License">
</a>
</div>
<div align="center">
<br><br>
<img src="src/websrc/img/logo.svg" width="128" height="128" alt="XZG logo">
<br><br>
This repository contains the firmware for various, ESP32 based, Zigbee gateways.<br><br>
Firmware is opensource, so feel free to improve it <br> by making a commit to this repository.
</div>

[![GitHub version](https://img.shields.io/github/release/xyzroe/xzg.svg)](https://github.com/xyzroe/xzg/releases)
[![GitHub download](https://img.shields.io/github/downloads/xyzroe/xzg/total.svg)](https://github.com/xyzroe/xzg/releases/latest)
[![License](https://img.shields.io/github/license/xyzroe/xzg.svg)](LICENSE)


<br><br>
<table width="40%" align="center">
<tr align="center">
<td colspan="3"><i>Previous versions:</i></td>
</tr>
<tr align="center">
<td><a href="https://github.com/xyzroe/ZigStarGW-FW/releases/latest">ZigStarGW-FW</a></td>
<td><a href="https://github.com/mercenaruss/uzg-firmware/releases/latest">UZG-01</a></td>
<td><a href="https://github.com/smlight-dev/slzb-06-firmware/releases/">SLZB-06</a></td>
</tr>
<tr align="center">
<td><a href="https://github.com/xyzroe/ZigStarGW-FW/releases/latest"><img src="https://img.shields.io/github/downloads/xyzroe/ZigStarGW-FW/total.svg" alt="ZigStarGW-FW's download"></a></td>
<td><a href="https://github.com/mercenaruss/uzg-firmware/releases/latest"><img src="https://img.shields.io/github/downloads/mercenaruss/uzg-firmware/total.svg" alt="UZG-01 Firmware's download"></a></td>
<td><a href="https://github.com/smlight-dev/slzb-06-firmware/releases/latest"><img src="https://img.shields.io/github/downloads/smlight-dev/slzb-06-firmware/total.svg" alt="SLZB-06 Firmware's download"></a></td>
</tr>
</table>
<br>

## 🍓 KEY FIRMWARE FEATURES

<table align="center" width=60%>
<tr>
<td><img src="https://img.shields.io/badge/Visual%20Studio%20Code-007ACC?logo=visualstudiocode&logoColor=fff&style=plastic" alt="Visual Studio Code Badge"></td>
<td><img src="https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=fff&style=plastic" alt="npm Badge"></td>
<td><img src="https://img.shields.io/badge/Arduino-00878F?logo=arduino&logoColor=fff&style=plastic" alt="Arduino Badge"></td>
<td><img src="https://img.shields.io/badge/JSON-000?logo=json&logoColor=fff&style=plastic" alt="JSON Badge"></td>
<td><img src="https://img.shields.io/badge/gulp-CF4647?logo=gulp&logoColor=fff&style=plastic" alt="gulp Badge"></td>
<td><img src="https://img.shields.io/badge/Bootstrap-7952B3?logo=bootstrap&logoColor=fff&style=plastic" alt="Bootstrap Badge"></td>
<td><img src="https://img.shields.io/badge/jQuery-0769AD?logo=jquery&logoColor=fff&style=plastic" alt="jQuery Badge"></td>
<td><img src="https://img.shields.io/badge/i18next-26A69A?logo=i18next&logoColor=fff&style=plastic" alt="i18next Badge"></td>
<td><img src="https://img.shields.io/badge/GitHub%20Actions-2088FF?logo=githubactions&logoColor=fff&style=plastic" alt="GitHub Actions Badge"></td>
</tr>
</table>
<table align="center" width=80%>
<tr><td colspan="4" align="center">Localized Translation</td></tr>
<tr><td colspan="4" align="center">🇬🇧 | 🇺🇦 | 🇨🇳 | 🇪🇸 | 🇸🇦 | 🇵🇹 | 🇷🇺 | 🇫🇷 | 🇩🇪 | 🇯🇵 | 🇹🇷 | 🇮🇹 | 🇵🇱</td></tr>
<tr><td colspan="4"></td></tr>
<tr align="center"><td colspan="2">Light mode</td><td colspan="2">Dark mode</td></tr>
<tr align="center"><td colspan="2">🌞</td><td colspan="2">🌑</td></tr>
<tr align="center"><td colspan="2"></td><td colspan="2"></td></tr>
<tr align="center"><td colspan="2"><b>Network mode</b></td><td colspan="2"><b>USB mode</b></td></tr>
<tr align="center"><td>LAN</td><td>Wi-Fi</td><td>Zigbee</td><td>ESP32</td></tr>
<tr align="center"><td colspan="2"><i><b>at the same time</b></i></td><td colspan="2"><i>selectable</i></td></tr>
<tr><td colspan="4"></td></tr>
<tr align="center"><td>NTP time</td><td>LED control</td><td>VPN access</td><td>MQTT client</td></tr>
<tr align="center"><td>Check and install updates, LEDs control</td><td>Night mode, Manual control, Full disable</td><td>Full access via WireGuard</td><td>View gateway stats, change modes, control LEDs. <br> Home Assistant Auto Discovery.</td></tr>
</table>



### Previous versions:
| [ZigStarGW-FW](https://github.com/xyzroe/ZigStarGW-FW/releases/latest) | [XZG](https://github.com/mercenaruss/uzg-firmware/releases/latest) | [SLZB-06](https://github.com/smlight-dev/slzb-06-firmware/releases/) |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [![ZigStarGW-FW's download](https://img.shields.io/github/downloads/xyzroe/ZigStarGW-FW/total.svg)](https://github.com/xyzroe/ZigStarGW-FW/releases/latest) | [![XZG Firmware's download](https://img.shields.io/github/downloads/mercenaruss/uzg-firmware/total.svg)](https://github.com/mercenaruss/uzg-firmware/releases/latest) | [![XZG Firmware's download](https://img.shields.io/github/downloads/smlight-dev/slzb-06-firmware/total.svg)](https://github.com/smlight-dev/slzb-06-firmware/releases/latest) |



## KEY FIRMWARE FEATURES
- Change Ethernet/USB adapter mode through firmware or by physical button short press (Red LED On = USB mode, RED LED Off = Ethernet mode);
- Adapter mode selector through web-interface: `Zigbee-to-Network` or `Zigbee-to-USB`;
- Support mDNS autodiscovery in your network (go in the browser to `uzg-01.local`), in Zigbee2MQTT (set `port: mdns://uzg-01`), and in ZHA;
- Support mDNS autodiscovery in your network (go in the browser to `xzg.local`), in Zigbee2MQTT (set `port: mdns://xzg`), and in ZHA;
- Secure login through username and password;
- Zigbee2MQTT and ZHA config helper;
- Control behavior of LED (you can disable Mode LED, Power LED through firmware, or toggle both by the button long press);
- DHCP or static IP address for Ethernet connection;

- ESP32 (peripheral) and CC2652P (Zigbee) OTA updates, ESP32 and CC2652P restart;
- Switch CC2652P (Zigbee) to flash mode;
- Pairing mode for the adapter in router mode;

- Filter IP addresses for incoming connections to secure your network;
- Fully responsive web interface based on the latest Bootstrap 5.3.
- WireGuard VPN
- MQTT client for gateway monitoring and control

## Installation and Configuration
Please refer to the installation and configuration articles based on your hardware.
## 🚀 Installation

Please follow this link for web-flasher - just plug-and-flash: [XZG Web flasher 🚀](https://xzg.xyzroe.cc/)
For a quick setup, use [XZG Web Flasher](https://xzg.xyzroe.cc/) for an easy plug-and-flash experience.

## Compiling from source
Please follow the installation guide tailored to your hardware.

## 🛠️ Compiling from source

### Local

- You need npm and Python installed;
- Download this repository;
- Install Visual Studio Code (VSC);
- Install PlatformIO extension to VSC;
- Press "PlatformIO: Build" and wait until XZG*.bin is generated;
- Press "PlatformIO: Build" and wait until XZG*.bin are generated;

### Github
- Fork this repository;
- Made your changes;
- Push a new tag in format "vX.X.X" to run workflow;
- Push a new tag to run workflow;
- Just wait and get new release;

### Gitpod
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://github.com/xyzroe/xzg)

## 🖥️ Contribute

Contributions are welcome! If you'd like to help improve the XZG Firmware, you can:

- Provide Pull Requests with enhancements or fixes. Please see our [contribution guidelines](CONTRIBUTING.md).
- Test newly released features and report issues.
- Help expand our documentation for better user support.

## Contribute

You can contribute to XZG Firmware by
- Providing Pull Requests - please read contributing approach [here](CONTRIBUTING.md)
- Testing newly released features and reporting issues
- Contributing missing documentation
## 🎉 Credits

## Credits
Thanks to all the developers and contributors who make this project possible:

People helping to keep the show on the road - **developers and contributors**:
- Special thanks to [@mercenaruss](https://github.com/mercenaruss/) for **Zig Star devices development**.

- [@mercenaruss](https://github.com/mercenaruss/) for **Zig Star devices development**, for initial firmware release of XZG version and giving me motivation and energy to implement new functions.
### Our Awesome Contributors:

- [@Tarik2142](https://github.com/Tarik2142) for refactoring, code optimizations done under [smlight-dev](https://github.com/smlight-dev/)
<a href="https://github.com/xyzroe/XZG/graphs/contributors"><img src="https://contrib.rocks/image?repo=xyzroe/XZG" /></a><br>
<a href="https://github.com/xyzroe/ZigStarGW-FW/graphs/contributors"><img src="https://contrib.rocks/image?repo=xyzroe/ZigStarGW-FW" /></a><br>
<a href="https://github.com/mercenaruss/uzg-firmware/graphs/contributors"><img src="https://contrib.rocks/image?repo=mercenaruss/uzg-firmware" /></a><br>
<a href="https://github.com/smlight-dev/slzb-06-firmware/graphs/contributors"><img src="https://contrib.rocks/image?repo=smlight-dev/slzb-06-firmware" /></a>

- **TO-DO** - add all contributors automatic **HERE**!


Special thanks goes also to all authors of 3rd party libraries which are used in this project:
Special thanks to all third-party library authors. Their work has significantly contributed to this project:

- [espressif / arduino-esp32](https://github.com/espressif/arduino-esp32),
- [esprfid / esp-rfid](https://github.com/esprfid/esp-rfid),
Expand All @@ -91,21 +139,21 @@ Special thanks goes also to all authors of 3rd party libraries which are used in
- [rlogiacco / circularbuffer](https://github.com/rlogiacco/CircularBuffer),
- [sstaub / ticker](https://github.com/sstaub/Ticker),
- [vurtun / lib](https://github.com/vurtun/lib),
- [ciniml / WireGuard-ESP32-Arduino](https://github.com/ciniml/WireGuard-ESP32-Arduino),
- [plerup / EspSoftwareSerial](https://github.com/plerup/espsoftwareserial),
- [marian-craciunescu / ESP32Ping](https://github.com/marian-craciunescu/ESP32Ping),
- [Tinkerforge / WireGuard-ESP32-Arduino](https://github.com/Tinkerforge/WireGuard-ESP32-Arduino),
- [sstaub / Ticker](https://github.com/sstaub/Ticker),
- [knolleary / PubSubClient](https://github.com/knolleary/pubsubclient),
- [ESP Async WebServer](https://github.com/me-no-dev/ESPAsyncWebServer),
- [Martin-Laclaustra / CronAlarms](https://github.com/Martin-Laclaustra/CronAlarms)
- [Martin-Laclaustra / CronAlarms](https://github.com/Martin-Laclaustra/CronAlarms),
- [xreef / WebServer-Esp8266-ESP32-Tutorial](https://github.com/xreef/WebServer-Esp8266-ESP32-Tutorial)


## License and attribution

**XZG Firmware** is licensed under **GNU General Public License v3**.
## 📄 License

XZG Firmware is released under the **GNU General Public License v3.0**. See the [LICENSE](LICENSE) file for more details.

Third-party libraries used in this project are under their respective licenses. Please refer to each for more information.

3rd party libraries that are used by this project are licensed under different license schemes, please check them out as well.
---

Copyright (c) 2024 xyzroe
<div align="center"> Created with &#x2764;&#xFE0F; by <a href="https://xyzroe.cc/">xyzroe</a> © 2024</div>

The GNU General Public License v3 ensures that if you use any part of this software in any way, your software must be released under the same license.
---
27 changes: 27 additions & 0 deletions XZG.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"i18n-ally.keystyle": "nested",
"i18n-ally.localesPaths": [
"src/websrc/json"
],
"cSpell.useGitignore": false,
},
"extensions": {
"recommendations": [
"jock.svg",
"DevEscalus.svg-sprites-viewer",
"streetsidesoftware.code-spell-checker",
"Perkovec.emoji",
"lokalise.i18n-ally",
"platformio.platformio-ide",
"marcochan.get-svg-icons",
"yzhang.markdown-all-in-one",
"ms-vscode.cpptools"
]
}
}
Binary file removed bin/XZG_20240330.full.bin
Binary file not shown.
Binary file removed bin/XZG_20240330.ota.bin
Binary file not shown.
Binary file added bin/XZG_20240415.full.bin
Binary file not shown.
Binary file added bin/XZG_20240415.ota.bin
Binary file not shown.
7 changes: 7 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ lib_deps =
sstaub/Ticker@>=4.4.0
knolleary/PubSubClient@^2.8
Martin-Laclaustra/CronAlarms
husarnet/Husarnet ESP32 @ 1.2.0-5 ;husarnet example
;plerup/[email protected]
;marian-craciunescu/ESP32Ping@>=1.7
;me-no-dev/[email protected]
monitor_filters = esp32_exception_decoder, default ;, log2file
monitor_speed = 115200
upload_speed = 460800
;platform_packages =
; framework-arduinoespressif32 @ https://github.com/husarnet/arduino-esp32/releases/download/1.0.4-1/arduino-husarnet-esp32.zip ;husarnet example
extra_scripts =
;pre:tools/build/version_increment_pre.py
pre:tools/build/pre_build.py
pre:tools/build/version_update.py
pre:tools/webfilesbuilder/build_html.py
post:tools/build/build.py
Expand Down Expand Up @@ -79,10 +83,13 @@ extra_scripts =

[env:debug]
platform = espressif32 @ 6.4.0
;platform = [email protected] ;husarnet example
board = esp32dev
build_flags =
-DDEBUG
${env.build_flags}
extra_scripts =
${env.extra_scripts}
lib_deps =
${env.lib_deps}

Loading

0 comments on commit f223136

Please sign in to comment.