Merge pull request #650 from iranl/update-libs

Various improvements and fixes
This commit is contained in:
iranl
2025-04-01 23:32:48 +02:00
committed by GitHub
27 changed files with 248 additions and 127 deletions

View File

@@ -12,8 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
#board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
build: [release]
env:
BOARD: ${{ matrix.board }}
@@ -37,7 +36,7 @@ jobs:
key: ${{ runner.os }}-pio-${{ matrix.board }}
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: make deps
- name: Add version info

View File

@@ -18,8 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
#board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
build: [release]
env:
BOARD: ${{ matrix.board }}
@@ -43,7 +42,7 @@ jobs:
key: ${{ runner.os }}-pio-${{ matrix.board }}
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: make deps
- name: Add version info

View File

@@ -34,8 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
#board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
build: [release]
env:
BOARD: ${{ matrix.board }}
@@ -59,7 +58,7 @@ jobs:
key: ${{ runner.os }}-pio-${{ matrix.board }}
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: make deps
- name: Add version info

View File

@@ -12,8 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
#board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10]
board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1, esp32-gl-s10, esp32-p4]
build: [release]
env:
BOARD: ${{ matrix.board }}
@@ -37,7 +36,7 @@ jobs:
key: ${{ runner.os }}-pio-${{ matrix.board }}
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: make deps
- name: Add version info

View File

@@ -22,13 +22,13 @@ In hybrid mode Nuki Hub will automatically choose the best way to communicate wi
When compared to regular/bridge mode this leads to speed increases in getting state changes and pushing state changes (because we can send and receive usefull information directly over MQTT without having to connect over BLE)
When compared to the official MQTT implementation this adds many many features that are not available in the official MQTT implementation and would normally require you to use the app or Web API (which has its own issues, downtime and cloud requirement).
**As the Nuki Smartlock Ultra has no support for the Nuki Bridge it is mandatory to setup Hybrid mode to receive prompt state changes from the lock in Nuki Hub.**
**As the Nuki Smartlock Ultra/5th gen Pro has no support for the Nuki Bridge it is mandatory to setup Hybrid mode to receive prompt state changes from the lock in Nuki Hub.**
### Requirements ###
- ESP32 running Nuki Hub 9.08 or higher
- For WiFi: Nuki lock 3.0 Pro, Nuki Lock 4.0 Pro or Nuki Lock Ultra
- For Thread: Nuki Lock 4.0, Nuki Lock 4.0 Pro or Nuki Lock Ultra. Note that you do ***NOT*** need to buy the remote access addon for the Nuki Lock 4.0
- For WiFi: Nuki lock 3.0 Pro, Nuki Lock 4.0 Pro, Nuki Lock 5.0 Pro, Nuki Lock Go or Nuki Lock Ultra
- For Thread: Nuki Lock 4.0, Nuki Lock 4.0 Pro, Nuki Lock 5.0 Pro, Nuki Lock Go or Nuki Lock Ultra. Note that you do ***NOT*** need to buy the remote access addon for the Nuki Lock 4.0 or Nuki Lock Go
- For Thread: The Nuki Lock needs to have network access to the same MQTT server as the one that Nuki Hub is conected to. Depending if the MQTT server is reachable over IPv6 you might need an OpenThread Border router that supports NAT64 and has this enabled. Currently this means an Apple Device or Home Assistant with the Matter server and OpenThread Border Router
- The Nuki Opener does not have WiFI or Thread and thus doesn't benefit from the hybrid solutions added speed. You can however use and connect a Nuki Opener as usual which will function over regular BLE and can still connect Nuki Hub as a bridge to an Opener.

View File

@@ -29,6 +29,8 @@ Feel free to join us on Discord: https://discord.gg/9nPq85bP4p
- Nuki Smart Lock 3.0 Pro
- Nuki Smart Lock 4.0
- Nuki Smart Lock 4.0 Pro
- Nuki Smart Lock Go
- Nuki Smart Lock 5.0 Pro
- Nuki Smart Lock Ultra
- Nuki Opener
- Nuki Keypad 1.0
@@ -161,30 +163,35 @@ MQTT nodes like lock state and battery level should now reflect the reported val
This is not recommended (unless when using [hybrid mode](/HYBRID.md)) and will lead to excessive battery drain and can lead to either device missing updates.
Enable "Register as app" before pairing to allow this. Otherwise the Bridge will be unregistered when pairing the Nuki Hub.</b>
## Pairing with a Nuki Lock Ultra
## Pairing with a Nuki Lock Ultra / Nuki Lock Go / Nuki Lock 5th gen Pro
Make sure "Bluetooth pairing" is enabled for the Nuki device by enabling this setting in the official Nuki App in "Settings" > "Features & Configuration" > "Button and LED".
Before enabling pairing mode using the button on the Lock Ultra first setup Nuki Hub as follows:
- Enable both "Nuki Smartlock enabled" and "Nuki Smartlock Ultra enabled" settings on the "Basic Nuki Configuration" page and Save. Setting the "Nuki Smartlock Ultra enabled" will change multiple other NukiHub settings.
- Input your 6-digit Nuki Lock Ultra PIN on the "Credentials" page and Save
Before enabling pairing mode using the button on the Nuki Lock Ultra / Nuki Lock Go / Nuki Lock 5th gen Pro first setup Nuki Hub as follows:
- Enable both "Nuki Smartlock enabled" and "Nuki Smartlock Ultra/Go/5th gen enabled" settings on the "Basic Nuki Configuration" page and Save. Setting the "Nuki Smartlock Ultra/Go/5th gen enabled" will change multiple other NukiHub settings.
- Input your 6-digit Nuki Lock Ultra/Go/5th gen PIN on the "Credentials" page and Save
- Press the button on the Nuki device for a few seconds until the LED ring lights up and remains lit.
- It is **strongly** recommended(/mandatory) to setup and enable Hybrid mode over Thread/WiFi + official MQTT as Nuki Hub works best in Hybrid or Bridge mode and the Ultra does not support Bridge mode
- It is **strongly** recommended(/mandatory) to setup and enable Hybrid mode over Thread/WiFi + official MQTT as Nuki Hub works best in Hybrid or Bridge mode and the Ultra/Go/5th gen Pro does not support Bridge mode
When pairing is successful, the web interface should show "Paired: Yes".<br>
## Hybrid mode
Hybrid mode allows you to use the official Nuki MQTT implemenation on a Nuki Lock 3.0 Pro, Nuki Lock 4.0, Nuki Lock 4.0 Pro or Nuki Lock Ultra in conjunction with Nuki Hub.<br>
Hybrid mode allows you to use the official Nuki MQTT implemenation on a Nuki Lock 3.0 Pro, Nuki Lock 4.0, Nuki Lock 4.0 Pro, Nuki Lock 5.0 Pro, Nuki Lock Go or Nuki Lock Ultra in conjunction with Nuki Hub.<br>
See [hybrid mode](/HYBRID.md) for more information.
## Memory constraints
ESP32 devices have a limited amount of free RAM available.<br>
<br>
On version >=9.00 of Nuki Hub with only a Nuki Lock connected the expected free amount of RAM/Heap available is around:
- ESP32: 60 kilobytes / 60.000 bytes
- Other variants (C3/S3/C6/H2): 90-120 kilobytes / 90.000-120.000 bytes
On version >=9.10 of Nuki Hub with only a Nuki Lock connected the expected free amount of RAM/Heap available is around:
- ESP32: 40.000 bytes
- ESP32 with PSRAM: 90.000 bytes + PSRAM
- ESP32-C3: 45.000 bytes
- ESP32-C6: 170.000 bytes
- ESP32-S3 90.000 bytes
- ESP32-S3 with PSRAM: 130.000 bytes + PSRAM
This free amount of RAM can be reduced (temporarily) by certain actions (such as changing Nuki device config) or continuously when enabling the following:
- Connecting both a Nuki opener and a Nuki lock to Nuki Hub
@@ -208,7 +215,7 @@ Webflash will automatically flash the no/Quad SPI PSRAM build when an ESP32-S3 i
If your ESP32-S3 device has PSRAM but it is not detected please switch to the other S3 binary.<br>
You can do this by flashing the correct binaries manually or by selecting the option to switch S3 binary build from the Firmware Update page of the Web Configurator.
Note that there are also is a separate build of Nuki Hub available for the GL-S10 ESP32 which is needed to enable PSRAM on this device (BETA).<br>
Note that there are also is a separate build of Nuki Hub available for the GL-S10 ESP32 which is needed to enable PSRAM on this device.<br>
## Configuration
@@ -218,7 +225,7 @@ In a browser navigate to the IP address assigned to the ESP32.
#### Network Configuration
- Host name: Set the hostname for the Nuki Hub ESP
- Hostname (needs to be unique, "nukihub" is not allowed): Set the hostname for the Nuki Hub ESP, will also be used as the MQTT client ID. Needs to be unique.
- Network hardware: "Wi-Fi only" by default, set to one of the specified ethernet modules if available, see the "Supported Ethernet devices" and "[Connecting via Ethernet](#connecting-via-ethernet-optional)" section of this README.
- Home Assistant device configuration URL: When using Home Assistant discovery the link to the Nuki Hub Web Configuration will be published to Home Assistant. By default when this setting is left empty this will link to the current IP of the Nuki Hub. When using a reverse proxy to access the Web Configuration you can set a custom URL here.
- RSSI Publish interval: Set to a positive integer to set the amount of seconds between updates to the maintenance/wifiRssi MQTT topic with the current Wi-Fi RSSI, set to -1 to disable, default 60.
@@ -270,7 +277,7 @@ In a browser navigate to the IP address assigned to the ESP32.
#### Basic Nuki Configuration
- Nuki Smartlock enabled: Enable if you want Nuki Hub to connect to a Nuki Lock (1.0-4.0 and Ultra)
- Nuki Smartlock Ultra enabled: Enable if you want Nuki Hub to connect to a Nuki Lock Ultra
- Nuki Smartlock Ultra/Go/5th gen enabled: Enable if you want Nuki Hub to connect to a Nuki Lock Ultra/Go/5th gen Pro
- Nuki Opener enabled: Enable if you want Nuki Hub to connect to a Nuki Opener
- New Nuki Bluetooth connection mode (disable if there are connection issues): Enable to use the latest Nuki BLE connection mode (recommended). Disable if you have issues communicating with the lock/opener
@@ -345,7 +352,7 @@ Note: All of the following requires the Nuki security code / PIN to be set, see
#### Nuki Lock PIN / Nuki Opener PIN
- PIN Code: Fill with the Nuki Security Code of the Nuki Lock and/or Nuki Opener. Required for functions that require the security code to be sent to the lock/opener such as setting lock permissions/adding keypad codes, viewing the activity log or changing the Nuki device configuration. Set to "#" to remove the security code from the Nuki Hub configuration.
- PIN Code Ultra: Fill with the 6-digit Nuki Security Code of the Nuki Lock Ultra. Required for pairing (and many other functions)
- PIN Code Ultra/5th gen: Fill with the 6-digit Nuki Security Code of the Nuki Lock Ultra/Go/5th gen Pro. Required for pairing (and many other functions)
#### Unpair Nuki Lock / Unpair Nuki Opener
@@ -615,8 +622,8 @@ Changing settings has to enabled first in the configuration portal. Check the se
| autoLockEnabled | Whether auto lock is enabled. | 1 = enabled, 0 = disabled |`{ "autoLockEnabled": "1" }` |
| immediateAutoLockEnabled | Whether auto lock should be performed immediately after the door has been closed. | 1 = enabled, 0 = disabled |`{ "immediateAutoLockEnabled": "1" }`|
| autoUpdateEnabled | Whether automatic firmware updates should be enabled. | 1 = enabled, 0 = disabled |`{ "autoUpdateEnabled": "1" }` |
| motorSpeed | The desired motor speed (Ultra only) | "Standard", "Insane", "Gentle" |`{ "motorSpeed": "Standard" }` |
| enableSlowSpeedDuringNightMode | Whether the slow speed should be applied during Night Mode (Ultra only) | 1 = enabled, 0 = disabled |`{ "enableSlowSpeedDuringNightMode": "1" }` |
| motorSpeed | The desired motor speed (Ultra/5th gen Pro only) | "Standard", "Insane", "Gentle" |`{ "motorSpeed": "Standard" }` |
| enableSlowSpeedDuringNightMode | Whether the slow speed should be applied during Night Mode (Ultra/5th gen Pro only) | 1 = enabled, 0 = disabled |`{ "enableSlowSpeedDuringNightMode": "1" }` |
| rebootNuki | Reboot the Nuki device immediately | 1 = reboot nuki |`{ "rebootNuki": "1" }` |
### Nuki Opener Configuration
@@ -695,13 +702,15 @@ When you are on the right application you can upload the new binary by clicking
After about a minute the new firmware should be installed afterwhich the ESP will reboot automatically to the updated binary.<br>
Selecting the wrong binary will lead to an unsuccessfull update<br>
<br>
<b> Note for users upgrading from Nuki Hub 8.35 or lower:</b><br>
Updating to version 9.00 requires a change to the partition table of the ESP32.<br>
Please follow the instructions for the [First time installation](#first-time-installation) one time when updating to Nuki Hub 9.00 from an earlier version.<br>
<b> Note for users upgrading from Nuki Hub 9.09 or lower:</b><br>
Updating to version 9.10 requires a change to the partition table of the ESP32.<br>
Please follow the instructions for the [First time installation](#first-time-installation) one time when updating to Nuki Hub 9.10 from an earlier version.<br>
## MQTT Encryption (optional)
The communication via MQTT can be SSL encrypted.<br>
Note: MQTT SSL requires a significant amount of RAM and will not work in most cases on low RAM devices (ESP32 without PSRAM or ESP32-C3)
To enable SSL encryption, supply the necessary information in the MQTT Configuration page.<br>
<br>
The following configurations are supported:<br>

View File

@@ -1 +1 @@
# Espressif ESP32 Partition Table
# Espressif ESP32 Partition Table
1 # Espressif ESP32 Partition Table # Name Type SubType Offset Size Flags nvs data nvs 0x9000 0x5000 otadata data ota 0xe000 0x2000 app0 app ota_0 0x10000 0x260000 app1 app ota_1 0x280000 0x270000 0x130000 0x140000 spiffs data spiffs 0x3B0000 0x40000 coredump data coredump 0x3F0000 0x10000

View File

@@ -58,7 +58,7 @@ def merge_bin(source, target, env):
flash_args.append(position)
flash_args.append(bin_file)
flash_args.append("0x2B0000")
flash_args.append("0x270000")
flash_args.append(f"{target_dir}/nuki_hub_updater_{board}.bin")
cmd = f"esptool.py --chip {chip} merge_bin -o {target_file} --flash_mode dio --flash_freq keep --flash_size keep " + " ".join(flash_args)

View File

@@ -13,7 +13,7 @@ default_envs = esp32
boards_dir = boards
[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
platform_packages =
framework = arduino, espidf
board_build.embed_txtfiles =
@@ -44,6 +44,13 @@ build_flags =
-DNUKI_MUTEX_RECURSIVE
-DNUKI_64BIT_TIME
-DETH_SPI_SUPPORTS_NO_IRQ
-DEMC_RX_BUFFER_SIZE=1440
-DEMC_TX_BUFFER_SIZE=1440
-DEMC_MIN_FREE_MEMORY=8192
-DEMC_TASK_STACK_SIZE=10240
-DEMC_USE_MEMPOOL=1
-DEMC_NUM_POOL_ELEMENTS=64
-DEMC_SIZE_POOL_ELEMENTS=256
-Wno-ignored-qualifiers
-Wno-missing-field-initializers
-Wno-type-limits

View File

@@ -99,34 +99,38 @@ As an alternative to the Download Tools, you can also use the esptool from the E
## ESP32
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32.bin 0x280000 nuki_hub_updater_esp32.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32.bin 0x270000 nuki_hub_updater_esp32.bin 0x8000 nuki_hub.partitions.bin
## ESP32-GL-S10
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32.bin 0x280000 nuki_hub_updater_esp32.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32.bin 0x270000 nuki_hub_updater_esp32.bin 0x8000 nuki_hub.partitions.bin
## ESP32-S3
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3.bin 0x280000 nuki_hub_updater_esp32s3.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3.bin 0x270000 nuki_hub_updater_esp32s3.bin 0x8000 nuki_hub.partitions.bin
## ESP32-S3-OCT
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3oct.bin 0x280000 nuki_hub_updater_esp32s3oct.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3oct.bin 0x270000 nuki_hub_updater_esp32s3oct.bin 0x8000 nuki_hub.partitions.bin
## ESP32-C3
esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c3.bin 0x280000 nuki_hub_updater_esp32c3.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c3.bin 0x270000 nuki_hub_updater_esp32c3.bin 0x8000 nuki_hub.partitions.bin
## ESP32-C6
esptool.py --chip esp32c6 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c6.bin 0x280000 nuki_hub_updater_esp32c6.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32c6 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c6.bin 0x270000 nuki_hub_updater_esp32c6.bin 0x8000 nuki_hub.partitions.bin
## ESP32-H2
esptool.py --chip esp32c6 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32h2.bin 0x280000 nuki_hub_updater_esp32h2.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32h2 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32h2.bin 0x270000 nuki_hub_updater_esp32h2.bin 0x8000 nuki_hub.partitions.bin
## ESP32-P4
esptool.py --chip esp32p4 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32p4.bin 0x270000 nuki_hub_updater_esp32p4.bin 0x8000 nuki_hub.partitions.bin
## ESP32-SOLO1
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32-solo1.bin 0x280000 nuki_hub_updater_esp32-solo1.bin 0x8000 nuki_hub.partitions.bin
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader.bin 0x10000 nuki_hub_esp32-solo1.bin 0x270000 nuki_hub_updater_esp32-solo1.bin 0x8000 nuki_hub.partitions.bin
Adjust the serial device and path to the binaries if necessary.

View File

@@ -40,6 +40,38 @@ pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
MrY=
-----END CERTIFICATE-----
USERTrust RSA Certification Authority
=====================================
-----BEGIN CERTIFICATE-----
MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
+T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
-----END CERTIFICATE-----
DigiCert High Assurance EV Root CA
==================================
-----BEGIN CERTIFICATE-----

View File

@@ -40,10 +40,14 @@ CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y
CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="resources/root_ca.pem"
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y
#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y
#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y
#CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y
#CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="resources/root_ca.pem"
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y
# RTC WDT
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=y

View File

@@ -5,7 +5,7 @@
#define NUKI_HUB_VERSION "9.10"
#define NUKI_HUB_VERSION_INT (uint32_t)910
#define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2025-03-03"
#define NUKI_HUB_DATE "2025-04-01"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"

View File

@@ -11,6 +11,7 @@
#endif
#include "networkDevices/EthernetDevice.h"
#include "hal/wdt_hal.h"
#include "esp_mac.h"
NukiNetwork* NukiNetwork::_inst = nullptr;
@@ -216,9 +217,15 @@ void NukiNetwork::initialize()
{
_hostname = _preferences->getString(preference_hostname, "");
if(_hostname == "")
if(_hostname == "" || _hostname == "nukihub")
{
_hostname = "nukihub";
char _nukiHubUidString[20];
uint8_t mac[8];
esp_efuse_mac_get_default(mac);
uint64_t curDevId;
memcpy(&curDevId, &mac, 8);
sprintf(_nukiHubUidString, "%" PRIu64, curDevId);
_hostname = (String)"NH" + _nukiHubUidString;
_preferences->putString(preference_hostname, _hostname);
}
@@ -258,9 +265,15 @@ void NukiNetwork::initialize()
_hostname = _preferences->getString(preference_hostname, "");
if(_hostname == "")
if(_hostname == "" || _hostname == "nukihub")
{
_hostname = "nukihub";
char _nukiHubUidString[20];
uint8_t mac[8];
esp_efuse_mac_get_default(mac);
uint64_t curDevId;
memcpy(&curDevId, &mac, 8);
sprintf(_nukiHubUidString, "%" PRIu64, curDevId);
_hostname = (String)"NH" + _nukiHubUidString;
_preferences->putString(preference_hostname, _hostname);
}
@@ -429,7 +442,7 @@ bool NukiNetwork::update()
_firstDisconnected = true;
}
if(!_device->mqttConnected() && _device->isConnected())
if(!_logIp && _device->isConnected() && !_device->mqttConnected() )
{
bool success = reconnect();
if(!success)
@@ -453,7 +466,7 @@ bool NukiNetwork::update()
delay(2000);
}
if(!_device->mqttConnected() || !_device->isConnected())
if(!_device->isConnected() || !_device->mqttConnected() )
{
if(_networkTimeout > 0 && (ts - _lastConnectedTs > _networkTimeout * 1000) && ts > 60000)
{

View File

@@ -1601,18 +1601,18 @@ esp_err_t WebCfgServer::buildOtaHtml(PsychicRequest *request, PsychicResponse* r
#else
String build_type = "debug";
#endif
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('latestver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest release?'); } \" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"token\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: green\" value=\"Update to latest release\"></form>");
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('betaver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest beta? This version could contain breaking bugs and necessitate downgrading to the latest release version using USB/Serial'); }\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"beta\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"token\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"color: black; background: yellow\" value=\"Update to latest beta\"></form>");
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('devver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest development version? This version could contain breaking bugs and necessitate downgrading to the latest release version using USB/Serial'); }\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"master\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"token\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: red\" value=\"Update to latest development version\"></form>");
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('latestver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest release?'); } \" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: green\" value=\"Update to latest release\"></form>");
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('betaver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest beta? This version could contain breaking bugs and necessitate downgrading to the latest release version using USB/Serial'); }\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"beta\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"color: black; background: yellow\" value=\"Update to latest beta\"></form>");
response.print("<form onsubmit=\"if(document.getElementById('currentver').innerHTML == document.getElementById('devver').innerHTML && '" + release_type + "' == '" + build_type + "') { alert('You are already on this version, build and build type'); return false; } else { return confirm('Do you really want to update to the latest development version? This version could contain breaking bugs and necessitate downgrading to the latest release version using USB/Serial'); }\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"master\" value=\"1\" /><input type=\"hidden\" name=\"" + release_type + "\" value=\"1\" /><input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: red\" value=\"Update to latest development version\"></form>");
#if defined(CONFIG_IDF_TARGET_ESP32S3)
if(esp_psram_get_size() <= 0)
{
response.print("<form onsubmit=\"return confirm('Do you really want to update to the latest release?');\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"other\" value=\"1\" /><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"token\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: blue\" value=\"Update to other PSRAM release version\"></form>");
response.print("<form onsubmit=\"return confirm('Do you really want to update to the latest release?');\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"other\" value=\"1\" /><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: blue\" value=\"Update to other PSRAM release version\"></form>");
}
#elif defined(CONFIG_IDF_TARGET_ESP32) && !defined(NUKI_TARGET_GL_S10)
if(_preferences->getInt(preference_network_hardware) == 8)
{
response.print("<form onsubmit=\"return confirm('Do you really want to update to the latest release?');\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"other\" value=\"1\" /><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"token\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: blue\" value=\"Update to specific GL-S10 release version\"></form>");
response.print("<form onsubmit=\"return confirm('Do you really want to update to the latest release?');\" action=\"/get\" method=\"get\" style=\"float: left; margin-right: 10px\"><input type=\"hidden\" name=\"page\" value=\"autoupdate\"><input type=\"hidden\" name=\"other\" value=\"1\" /><input type=\"hidden\" name=\"release\" value=\"1\" /><input type=\"hidden\" name=\"CONFIRMTOKEN\" value=\"" + _confirmCode + "\" /><br><input type=\"submit\" style=\"background: blue\" value=\"Update to specific GL-S10 release version\"></form>");
}
#endif
response.print("<div style=\"clear: both\"></div><br>");
@@ -3174,7 +3174,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
}
else if(key == "HOSTNAME")
{
if(_preferences->getString(preference_hostname, "") != value)
if(_preferences->getString(preference_hostname, "") != value && value != "nukihub")
{
_preferences->putString(preference_hostname, value);
Log->print("Setting changed: ");
@@ -4377,6 +4377,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
configChanged = true;
clearSession = true;
newMFA = true;
_importExport->_sessionsOpts[request->client()->localIP().toString() + "totp"] = true;
}
}
}
@@ -4412,7 +4413,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
{
if (_preferences->getBool(preference_lock_gemini_enabled, false))
{
message = "Nuki Lock Ultra PIN cleared";
message = "Nuki Lock Ultra/Go/5th gen PIN cleared";
_nuki->setUltraPin(0xffffffff);
_preferences->putInt(preference_lock_gemini_pin, 0);
}
@@ -4431,7 +4432,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
{
if(_nuki->getUltraPin() != value.toInt())
{
message = "Nuki Lock Ultra PIN saved";
message = "Nuki Lock Ultra/Go/5th gen PIN saved";
_nuki->setUltraPin(value.toInt());
_preferences->putInt(preference_lock_gemini_pin, value.toInt());
Log->print("Setting changed: ");
@@ -5103,7 +5104,7 @@ esp_err_t WebCfgServer::buildNetworkConfigHtml(PsychicRequest *request, PsychicR
response.print("<input type=\"hidden\" name=\"page\" value=\"savecfg\">");
response.print("<h3>Network Configuration</h3>");
response.print("<table>");
printInputField(&response, "HOSTNAME", "Host name", _preferences->getString(preference_hostname).c_str(), 100, "");
printInputField(&response, "HOSTNAME", "Hostname (needs to be unique, \"nukihub\" is not allowed)", _preferences->getString(preference_hostname).c_str(), 100, "");
printDropDown(&response, "NWHW", "Network hardware", String(_preferences->getInt(preference_network_hardware)), getNetworkDetectionOptions(), "");
printInputField(&response, "HASSCUURL", "Home Assistant device configuration URL (empty to use http://LOCALIP; fill when using a reverse proxy for example)", _preferences->getString(preference_mqtt_hass_cu_url).c_str(), 261, "");
#ifndef CONFIG_IDF_TARGET_ESP32H2
@@ -5781,7 +5782,7 @@ esp_err_t WebCfgServer::buildNukiConfigHtml(PsychicRequest *request, PsychicResp
response.print("<h3>Basic Nuki Configuration</h3>");
response.print("<table>");
printCheckBox(&response, "LOCKENA", "Nuki Lock enabled", _preferences->getBool(preference_lock_enabled, true), "");
printCheckBox(&response, "GEMINIENA", "Nuki Smartlock Ultra enabled", _preferences->getBool(preference_lock_gemini_enabled, false), "");
printCheckBox(&response, "GEMINIENA", "Nuki Smartlock Ultra/Go/5th gen enabled", _preferences->getBool(preference_lock_gemini_enabled, false), "");
printCheckBox(&response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled, false), "");
printCheckBox(&response, "CONNMODE", "New Nuki Bluetooth connection mode (disable if there are connection issues)", _preferences->getBool(preference_connect_mode, true), "");
response.print("</table><br>");
@@ -6268,7 +6269,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
else
{
response.print("\nLock enabled: Yes");
response.print("\nLock Ultra enabled: ");
response.print("\nLock Ultra/Go/5th gen enabled: ");
response.print(_preferences->getBool(preference_lock_gemini_enabled, false) ? "Yes" : "No");
response.print("\nPaired: ");
response.print(_nuki->isPaired() ? "Yes" : "No");
@@ -6466,7 +6467,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
uint32_t authorizationIdInt = authorizationId[0] + 256U*authorizationId[1] + 65536U*authorizationId[2] + 16777216U*authorizationId[3];
response.print("\nAuthorizationId (UINT32_T): ");
response.print(authorizationIdInt);
response.print("\nPaired to Nuki Lock Ultra: ");
response.print("\nPaired to Nuki Lock Ultra/Go/5th gen: ");
response.print(nukiBlePref.getBool("isUltra", false) ? "Yes" : "No");
}
}
@@ -6689,9 +6690,9 @@ esp_err_t WebCfgServer::processUpdate(PsychicRequest *request, PsychicResponse*
{
esp_err_t res;
String value = "";
if(request->hasParam("token"))
if(request->hasParam("CONFIRMTOKEN"))
{
const PsychicWebParameter* p = request->getParam("token");
const PsychicWebParameter* p = request->getParam("CONFIRMTOKEN");
if(p->value() != "")
{
value = p->value();
@@ -6975,6 +6976,7 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
options.push_back(std::make_pair("8", "GL-S10"));
options.push_back(std::make_pair("9", "ETH01-Evo"));
options.push_back(std::make_pair("13", "Waveshare ESP32-S3-ETH / ESP32-S3-ETH-POE"));
options.push_back(std::make_pair("14", "LilyGO T-ETH-Lite-ESP32S3"));
options.push_back(std::make_pair("11", "Custom LAN module"));
return options;

View File

@@ -14,5 +14,6 @@ enum class NetworkDeviceType
GL_S10,
ETH01_Evo,
Waveshare_ESP32_S3_ETH,
LilyGO_T_ETH_Lite_S3,
CUSTOM
};

View File

@@ -4,7 +4,7 @@ dependencies:
esp-nimble-cpp:
git: https://github.com/h2zero/esp-nimble-cpp.git
version: 88c5d0c7b7cadb1fa328dbfa80eb14f7f4cc9e52
version: 723cdf0a66587bba30c8694b38267a91a530f024
espressif/libsodium: "^1.0.20~2"

View File

@@ -95,6 +95,8 @@ RTC_NOINIT_ATTR bool wifiFallback;
RTC_NOINIT_ATTR bool ethCriticalFailure;
bool coredumpPrinted = true;
bool timeSynced = false;
bool webStarted = false;
bool webSSLStarted = false;
int lastHTTPeventId = -1;
bool doOta = false;
@@ -218,7 +220,7 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
{
SPIFFS.remove((String)"/" + file.name());
}
file = root.openNextFile();
}
}
@@ -257,6 +259,20 @@ void networkTask(void *pvParameters)
{
esp_netif_sntp_start();
}
/* MDNS currently disabled for causing issues (9.10 / 2025-04-01)
if(webSSLStarted) {
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 443);
}
}
else if(webStarted) {
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 80);
}
}
*/
reroute = false;
setReroute();
}
@@ -529,6 +545,8 @@ void setupTasks(bool ota)
esp_chip_info_t info;
esp_chip_info(&info);
uint8_t espCores = info.cores;
Log->print("Cores: ");
Log->println(espCores);
if(ota)
{
@@ -673,7 +691,7 @@ void setup()
{
logCoreDump();
}
if (SPIFFS.begin(true))
{
listDir(SPIFFS, "/", 1);
@@ -792,10 +810,7 @@ void setup()
return response->redirect("/");
});
psychicSSLServer->begin();
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 443);
}
webSSLStarted = true;
}
}
}
@@ -812,9 +827,7 @@ void setup()
return response->redirect("/");
});
psychicServer->begin();
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 80);
}
webStarted = true;
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
}
#endif
@@ -977,9 +990,7 @@ void setup()
return response->redirect("/");
});
psychicSSLServer->begin();
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 443);
}
webSSLStarted = true;
}
}
}
@@ -996,9 +1007,7 @@ void setup()
return response->redirect("/");
});
psychicServer->begin();
if (MDNS.begin(preferences->getString(preference_hostname, "nukihub").c_str())) {
MDNS.addService("http", "tcp", 80);
}
webStarted = true;
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
}
#endif

View File

@@ -7,9 +7,19 @@
#include "SPIFFS.h"
#include "../MqttTopics.h"
#include "PreferencesKeys.h"
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
#include "esp_psram.h"
#endif
void NetworkDevice::init()
{
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
if(esp_psram_get_size() > 0)
{
_mqttInternal = true;
}
#endif
if(_preferences->getBool(preference_mqtt_ssl_enabled, false)) {
if (!SPIFFS.begin(true)) {
Log->println("SPIFFS Mount Failed");
@@ -28,12 +38,19 @@ void NetworkDevice::init()
char* caDest;
caDest = (char *)malloc(sizeof(char) * (ca_cert.length()+1));
strcpy(caDest, ca_cert.c_str());
if(ca_cert.length() > 1)
{
_useEncryption = true;
Log->println("MQTT over TLS.");
_mqttClientSecure = new espMqttClientSecure(espMqttClientTypes::UseInternalTask::NO);
if(_mqttInternal)
{
_mqttClientSecure = new espMqttClientSecure(espMqttClientTypes::UseInternalTask::YES);
}
else
{
_mqttClientSecure = new espMqttClientSecure(espMqttClientTypes::UseInternalTask::NO);
}
_mqttClientSecure->setCACert(caDest);
File file2 = SPIFFS.open("/mqtt_ssl.crt");
@@ -48,7 +65,7 @@ void NetworkDevice::init()
char* certDest;
certDest = (char *)malloc(sizeof(char) * (cert.length()+1));
strcpy(certDest, cert.c_str());
String key = file3.readString();
file3.close();
char* keyDest;
@@ -70,7 +87,14 @@ void NetworkDevice::init()
if (!_useEncryption)
{
Log->println("MQTT without TLS.");
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::NO);
if(_mqttInternal)
{
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::YES);
}
else
{
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::NO);
}
}
if(_preferences->getBool(preference_mqtt_log_enabled, false) || _preferences->getBool(preference_webserial_enabled, false))
@@ -101,7 +125,7 @@ void NetworkDevice::init()
}
void NetworkDevice::update()
{
if (_mqttEnabled)
if (_mqttEnabled && !_mqttInternal)
{
getMqttClient()->loop();
}

View File

@@ -64,6 +64,7 @@ protected:
bool _useEncryption = false;
bool _mqttEnabled = true;
bool _mqttInternal = false;
char* _path;
#endif

View File

@@ -2,40 +2,47 @@
#include <hal/spi_types.h>
#define ETH_PHY_TYPE_W5500 ETH_PHY_W5500
#define ETH_PHY_ADDR_W5500 1
#define ETH_PHY_IRQ_M5_W5500 -1
#define ETH_PHY_RST_M5_W5500 -1
#define ETH_PHY_CS_M5_W5500 19
#define ETH_PHY_SPI_SCK_M5_W5500 22
#define ETH_PHY_SPI_MISO_M5_W5500 23
#define ETH_PHY_SPI_MOSI_M5_W5500 33
#define ETH_PHY_TYPE_W5500 ETH_PHY_W5500
#define ETH_PHY_ADDR_W5500 1
#define ETH_PHY_IRQ_M5_W5500 -1
#define ETH_PHY_RST_M5_W5500 -1
#define ETH_PHY_CS_M5_W5500 19
#define ETH_PHY_SPI_SCK_M5_W5500 22
#define ETH_PHY_SPI_MISO_M5_W5500 23
#define ETH_PHY_SPI_MOSI_M5_W5500 33
#define ETH_PHY_CS_M5_W5500_S3 6
#define ETH_PHY_SPI_SCK_M5_W5500_S3 5
#define ETH_PHY_SPI_MISO_M5_W5500_S3 7
#define ETH_PHY_SPI_MOSI_M5_W5500_S3 8
#define ETH_PHY_CS_M5_W5500_S3 6
#define ETH_PHY_SPI_SCK_M5_W5500_S3 5
#define ETH_PHY_SPI_MISO_M5_W5500_S3 7
#define ETH_PHY_SPI_MOSI_M5_W5500_S3 8
#define ETH_PHY_IRQ_ELITE_W5500 14
#define ETH_PHY_RST_ELITE_W5500 -1
#define ETH_PHY_CS_ELITE_W5500 45
#define ETH_PHY_SPI_SCK_ELITE_W5500 48
#define ETH_PHY_SPI_MISO_ELITE_W5500 47
#define ETH_PHY_SPI_MOSI_ELITE_W5500 21
#define ETH_PHY_IRQ_ELITE_W5500 14
#define ETH_PHY_RST_ELITE_W5500 -1
#define ETH_PHY_CS_ELITE_W5500 45
#define ETH_PHY_SPI_SCK_ELITE_W5500 48
#define ETH_PHY_SPI_MISO_ELITE_W5500 47
#define ETH_PHY_SPI_MOSI_ELITE_W5500 21
#define ETH_PHY_IRQ_GENERIC_W5500 3
#define ETH_PHY_RST_GENERIC_W5500 4
#define ETH_PHY_CS_GENERIC_W5500 5
#define ETH_PHY_SPI_SCK_GENERIC_W5500 8
#define ETH_PHY_SPI_MISO_GENERIC_W5500 9
#define ETH_PHY_SPI_MOSI_GENERIC_W5500 10
#define ETH_PHY_IRQ_GENERIC_W5500 3
#define ETH_PHY_RST_GENERIC_W5500 4
#define ETH_PHY_CS_GENERIC_W5500 5
#define ETH_PHY_SPI_SCK_GENERIC_W5500 8
#define ETH_PHY_SPI_MISO_GENERIC_W5500 9
#define ETH_PHY_SPI_MOSI_GENERIC_W5500 10
#define ETH_ADDR_WAVESHARE_ESP32_S3_ETH 1
#define ETH_PHY_SPI_IRQ_WAVESHARE_ESP32_S3_ETH 10
#define ETH_PHY_SPI_RST_WAVESHARE_ESP32_S3_ETH 9
#define ETH_PHY_SPI_CS_WAVESHARE_ESP32_S3_ETH 14
#define ETH_PHY_SPI_SCK_WAVESHARE_ESP32_S3_ETH 13
#define ETH_PHY_SPI_MISO_WAVESHARE_ESP32_S3_ETH 12
#define ETH_PHY_SPI_MOSI_WAVESHARE_ESP32_S3_ETH 11
#define ETH_ADDR_WAVESHARE_ESP32_S3_ETH 1
#define ETH_PHY_SPI_IRQ_WAVESHARE_ESP32_S3_ETH 10
#define ETH_PHY_SPI_RST_WAVESHARE_ESP32_S3_ETH 9
#define ETH_PHY_SPI_CS_WAVESHARE_ESP32_S3_ETH 14
#define ETH_PHY_SPI_SCK_WAVESHARE_ESP32_S3_ETH 13
#define ETH_PHY_SPI_MISO_WAVESHARE_ESP32_S3_ETH 12
#define ETH_PHY_SPI_MOSI_WAVESHARE_ESP32_S3_ETH 11
#define ETH_PHY_CS_ETHLITES3_W5500 9
#define ETH_PHY_IRQ_ETHLITES3_W5500 13
#define ETH_PHY_RST_ETHLITES3_W5500 14
#define ETH_PHY_SPI_SCK_ETHLITES3_W5500 10
#define ETH_PHY_SPI_MISO_ETHLITES3_W5500 11
#define ETH_PHY_SPI_MOSI_ETHLITES3_W5500 12
#define ETH_ADDR 1

View File

@@ -286,10 +286,6 @@ void WifiDevice::onWifiEvent(const WiFiEvent_t &event, const WiFiEventInfo_t &in
break;
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
Log->println("Connected to access point");
if(!_openAP)
{
onConnected();
}
break;
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
Log->println("Disconnected from WiFi access point");

View File

@@ -80,6 +80,18 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
ETH_PHY_SPI_MOSI_ELITE_W5500,
ETH_PHY_W5500);
break;
case NetworkDeviceType::LilyGO_T_ETH_Lite_S3:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "LilyGO T-ETH-Lite-ESP32S3",
ETH_PHY_ADDR_W5500,
ETH_PHY_CS_ETHLITES3_W5500,
ETH_PHY_IRQ_ETHLITES3_W5500,
ETH_PHY_RST_ETHLITES3_W5500,
ETH_PHY_SPI_SCK_ETHLITES3_W5500,
ETH_PHY_SPI_MISO_ETHLITES3_W5500,
ETH_PHY_SPI_MOSI_ETHLITES3_W5500,
ETH_PHY_W5500);
break;
case NetworkDeviceType::CUSTOM:
{
int custPHY = preferences->getInt(preference_network_custom_phy, 0);

View File

@@ -36,6 +36,8 @@ NetworkDeviceType NetworkUtil::GetDeviceTypeFromPreference(int hardwareDetect, i
return NetworkDeviceType::LilyGO_T_ETH_ELite;
case 13:
return NetworkDeviceType::Waveshare_ESP32_S3_ETH;
case 14:
return NetworkDeviceType::LilyGO_T_ETH_Lite_S3;
default:
Log->println("Unknown hardware selected, falling back to Wi-Fi.");
return NetworkDeviceType::WiFi;

View File

@@ -1 +1 @@
# Espressif ESP32 Partition Table
# Espressif ESP32 Partition Table
1 # Espressif ESP32 Partition Table # Name Type SubType Offset Size Flags nvs data nvs 0x9000 0x5000 otadata data ota 0xe000 0x2000 app0 app ota_0 0x10000 0x130000 0x140000

View File

@@ -13,7 +13,7 @@ default_envs = updater_esp32
boards_dir = ../boards
[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
platform_packages =
framework = arduino, espidf
board_build.embed_txtfiles =

View File

@@ -26,7 +26,9 @@ CONFIG_ARDUINO_SELECTIVE_RainMaker=n
CONFIG_ARDUINO_SELECTIVE_OpenThread=n
CONFIG_ARDUINO_SELECTIVE_Insights=n
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y
CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y
CONFIG_LOG_COLORS=n
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=n
CONFIG_LOG_MAXIMUM_LEVEL=4