Merge remote-tracking branch 'upstream/master' into c5
This commit is contained in:
19
src/Config.h
19
src/Config.h
@@ -5,12 +5,27 @@
|
||||
#define NUKI_HUB_VERSION "9.11"
|
||||
#define NUKI_HUB_VERSION_INT (uint32_t)911
|
||||
#define NUKI_HUB_BUILD "unknownbuildnr"
|
||||
#define NUKI_HUB_DATE "2025-05-17"
|
||||
#define NUKI_HUB_DATE "2025-06-09"
|
||||
|
||||
#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"
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32p4.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32p4.bin"
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32p4.bin"
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_updater_esp32p4.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32p4.bin"
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32p4.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32p4.bin"
|
||||
#define NUKI_HUB_HW (char*)"ESP32-P4"
|
||||
#define BOOT_BUTTON_GPIO (gpio_num_t)35
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c3.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c3.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32c3.bin"
|
||||
|
||||
@@ -162,6 +162,7 @@ void NukiWrapper::readSettings()
|
||||
_forceKeypad = _preferences->getBool(preference_lock_force_keypad, false);
|
||||
_forceId = _preferences->getBool(preference_lock_force_id, false);
|
||||
_isUltra = _preferences->getBool(preference_lock_gemini_enabled, false);
|
||||
_isDebugging = _preferences->getBool(preference_debug_hex_data, false);
|
||||
|
||||
_preferences->getBytes(preference_conf_lock_basic_acl, &_basicLockConfigaclPrefs, sizeof(_basicLockConfigaclPrefs));
|
||||
_preferences->getBytes(preference_conf_lock_advanced_acl, &_advancedLockConfigaclPrefs, sizeof(_advancedLockConfigaclPrefs));
|
||||
@@ -360,6 +361,10 @@ void NukiWrapper::update(bool reboot)
|
||||
Log->println("Updating Lock config based on timer or query");
|
||||
_nextConfigUpdateTs = ts + _intervalConfig * 1000;
|
||||
updateConfig();
|
||||
if(_isDebugging)
|
||||
{
|
||||
updateDebug();
|
||||
}
|
||||
}
|
||||
if(_waitAuthLogUpdateTs != 0 && ts > _waitAuthLogUpdateTs)
|
||||
{
|
||||
@@ -728,6 +733,149 @@ void NukiWrapper::updateConfig()
|
||||
}
|
||||
}
|
||||
|
||||
void NukiWrapper::updateDebug()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
int count = 0;
|
||||
|
||||
Log->println("Running debug command - RequestGeneralStatistics");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::RequestGeneralStatistics);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - RequestDailyStatistics");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.requestDailyStatistics();
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - RequestMqttConfig");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::RequestMqttConfig);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - RequestMqttConfigForMigration");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::RequestMqttConfigForMigration);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - ReadWifiConfig");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::ReadWifiConfig);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - ReadWifiConfigForMigration");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::ReadWifiConfigForMigration);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - GetKeypad2Config");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::GetKeypad2Config, false);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
Log->println("Running debug command - RequestFingerprintEntries");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.retrieveFingerprintEntries();
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
count = 0;
|
||||
while (count < 5) {
|
||||
delay(1000);
|
||||
esp_task_wdt_reset();
|
||||
count++;
|
||||
}
|
||||
|
||||
std::list<NukiLock::FingerprintEntry> fingerprintEntries;
|
||||
_nukiLock.getFingerprintEntries(&fingerprintEntries);
|
||||
|
||||
Log->print("Fingerprint entries: ");
|
||||
Log->println(fingerprintEntries.size());
|
||||
Log->println("Debug command complete");
|
||||
|
||||
Log->println("Running debug command - RequestInternalLogEntries");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.retrieveInternalLogEntries(0, 10, 1, false);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
|
||||
count = 0;
|
||||
while (count < 15) {
|
||||
delay(1000);
|
||||
esp_task_wdt_reset();
|
||||
count++;
|
||||
}
|
||||
|
||||
std::list<NukiLock::InternalLogEntry> internalLogEntries;
|
||||
_nukiLock.getInternalLogEntries(&internalLogEntries);
|
||||
|
||||
Log->print("InternalLog entries: ");
|
||||
Log->println(internalLogEntries.size());
|
||||
Log->println("Debug command complete");
|
||||
|
||||
Log->println("Running debug command - scanWifi");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.scanWifi(15);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
|
||||
count = 0;
|
||||
while (count < 20) {
|
||||
delay(1000);
|
||||
esp_task_wdt_reset();
|
||||
count++;
|
||||
}
|
||||
|
||||
std::list<NukiLock::WifiScanEntry> wifiScanEntries;
|
||||
_nukiLock.getWifiScanEntries(&wifiScanEntries);
|
||||
|
||||
Log->print("WifiScan entries: ");
|
||||
Log->println(wifiScanEntries.size());
|
||||
Log->println("Debug command complete");
|
||||
|
||||
Log->println("Running debug command - getAccessoryInfo, type = 4");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.getAccessoryInfo(4);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
|
||||
Log->println("Running debug command - getAccessoryInfo, type = 5");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.getAccessoryInfo(5);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
|
||||
Log->println("Running debug command - RequestDoorSensorConfig");
|
||||
result = (Nuki::CmdResult)-1;
|
||||
result = _nukiLock.genericCommand(Nuki::Command::RequestDoorSensorConfig, false);
|
||||
Log->print("Result: ");
|
||||
Log->println(result);
|
||||
Log->println("Debug command complete");
|
||||
|
||||
/*
|
||||
CheckKeypadCode = 0x006E keypadCode (int), (nonce, PIN)
|
||||
|
||||
RequestMatterPairings = 0x0112 requestTotalCount (bool), (nonce, PIN)
|
||||
MatterPairing = 0x0113
|
||||
MatterPairingCount = 0x0114
|
||||
|
||||
ConnectWifi = 0x0082
|
||||
SetWifiConfig = 0x0087
|
||||
SetMqttConfig = 0x008D
|
||||
SetKeypad2Config = 0x009C
|
||||
EnableMatterCommissioning = 0x0110
|
||||
SetMatterState = 0x0111
|
||||
*/
|
||||
}
|
||||
|
||||
void NukiWrapper::updateAuthData(bool retrieved)
|
||||
{
|
||||
if(!isPinValid())
|
||||
|
||||
@@ -69,6 +69,7 @@ private:
|
||||
bool updateKeyTurnerState();
|
||||
void updateBatteryState();
|
||||
void updateConfig();
|
||||
void updateDebug();
|
||||
void updateAuthData(bool retrieved);
|
||||
void updateKeypad(bool retrieved);
|
||||
void updateTimeControl(bool retrieved);
|
||||
@@ -140,6 +141,7 @@ private:
|
||||
bool _keypadEnabled = false;
|
||||
bool _forceId = false;
|
||||
bool _isUltra = false;
|
||||
bool _isDebugging = false;
|
||||
uint _maxKeypadCodeCount = 0;
|
||||
uint _maxTimeControlEntryCount = 0;
|
||||
uint _maxAuthEntryCount = 0;
|
||||
|
||||
@@ -6642,7 +6642,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
|
||||
|
||||
response.print("\n\n------------ GPIO ------------\n");
|
||||
response.print("\nRetain Input GPIO MQTT state: ");
|
||||
response.print(_preferences->getBool(preference_retain_gpio, false) ? "Yes" : "No");
|
||||
response.print(_preferences->getBool(preference_retain_gpio, false) ? "Yes\n" : "No\n");
|
||||
String gpioStr = "";
|
||||
_gpio->getConfigurationText(gpioStr, _gpio->pinConfiguration());
|
||||
response.print(gpioStr);
|
||||
@@ -6977,6 +6977,9 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
|
||||
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("15", "Waveshare ESP32-P4-NANO"));
|
||||
options.push_back(std::make_pair("16", "Waveshare ESP32-P4-Module-DEV-KIT"));
|
||||
options.push_back(std::make_pair("17", "ESP32-P4-Function-EV-Board"));
|
||||
options.push_back(std::make_pair("11", "Custom LAN module"));
|
||||
|
||||
return options;
|
||||
|
||||
@@ -15,5 +15,8 @@ enum class NetworkDeviceType
|
||||
ETH01_Evo,
|
||||
Waveshare_ESP32_S3_ETH,
|
||||
LilyGO_T_ETH_Lite_S3,
|
||||
Waveshare_ESP32_P4_NANO,
|
||||
Waveshare_ESP32_P4_Module_DEV_KIT,
|
||||
ESP32_P4_Function_EV_Board,
|
||||
CUSTOM
|
||||
};
|
||||
@@ -20,29 +20,39 @@ const String WifiDevice::deviceName() const
|
||||
|
||||
void WifiDevice::initialize()
|
||||
{
|
||||
ssid = _preferences->getString(preference_wifi_ssid, "");
|
||||
ssid.trim();
|
||||
pass = _preferences->getString(preference_wifi_pass, "");
|
||||
pass.trim();
|
||||
WiFi.setHostname(_hostname.c_str());
|
||||
if (_hostname != "fakep4forhosted") {
|
||||
ssid = _preferences->getString(preference_wifi_ssid, "");
|
||||
ssid.trim();
|
||||
pass = _preferences->getString(preference_wifi_pass, "");
|
||||
pass.trim();
|
||||
WiFi.setHostname(_hostname.c_str());
|
||||
|
||||
WiFi.onEvent([&](WiFiEvent_t event, WiFiEventInfo_t info)
|
||||
{
|
||||
onWifiEvent(event, info);
|
||||
});
|
||||
WiFi.onEvent([&](WiFiEvent_t event, WiFiEventInfo_t info)
|
||||
{
|
||||
onWifiEvent(event, info);
|
||||
});
|
||||
|
||||
if(isWifiConfigured())
|
||||
{
|
||||
Log->println(String("Attempting to connect to saved SSID ") + String(ssid));
|
||||
_openAP = false;
|
||||
if(isWifiConfigured())
|
||||
{
|
||||
Log->println(String("Attempting to connect to saved SSID ") + String(ssid));
|
||||
_openAP = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log->println("No SSID or Wifi password saved, opening AP");
|
||||
_openAP = true;
|
||||
}
|
||||
|
||||
scan(false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log->println("No SSID or Wifi password saved, opening AP");
|
||||
_openAP = true;
|
||||
WiFi.disconnect(true);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
delay(5000);
|
||||
Log->println("Dummy WiFi device for Hosted on P4 done");
|
||||
}
|
||||
|
||||
scan(false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -177,7 +187,7 @@ bool WifiDevice::connect()
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDeviceType, String hostname, Preferences *preferences, IPConfiguration *ipConfiguration)
|
||||
{
|
||||
NetworkDevice* device = nullptr;
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
bool fakedevice = true;
|
||||
#endif
|
||||
|
||||
switch (networkDeviceType)
|
||||
{
|
||||
@@ -91,7 +94,35 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
|
||||
ETH_PHY_SPI_MOSI_ETHLITES3_W5500,
|
||||
ETH_PHY_W5500);
|
||||
break;
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
case NetworkDeviceType::Waveshare_ESP32_P4_NANO:
|
||||
device = new EthernetDevice(hostname, preferences, ipConfiguration, "Waveshare ESP32-P4-NANO",
|
||||
1,
|
||||
51,
|
||||
31,
|
||||
52,
|
||||
ETH_PHY_IP101,
|
||||
ETH_CLOCK_GPIO0_IN);
|
||||
break;
|
||||
case NetworkDeviceType::Waveshare_ESP32_P4_Module_DEV_KIT:
|
||||
device = new EthernetDevice(hostname, preferences, ipConfiguration, "Waveshare ESP32-P4-Module-DEV-KIT",
|
||||
1,
|
||||
51,
|
||||
31,
|
||||
52,
|
||||
ETH_PHY_IP101,
|
||||
ETH_CLOCK_GPIO0_IN);
|
||||
break;
|
||||
case NetworkDeviceType::ESP32_P4_Function_EV_Board:
|
||||
device = new EthernetDevice(hostname, preferences, ipConfiguration, "ESP32-P4-Function-EV-Board",
|
||||
1,
|
||||
51,
|
||||
31,
|
||||
52,
|
||||
ETH_PHY_IP101,
|
||||
ETH_CLOCK_GPIO0_IN);
|
||||
break;
|
||||
#endif
|
||||
case NetworkDeviceType::CUSTOM:
|
||||
{
|
||||
int custPHY = preferences->getInt(preference_network_custom_phy, 0);
|
||||
@@ -153,6 +184,9 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
|
||||
else
|
||||
{
|
||||
device = new WifiDevice(hostname, preferences, ipConfiguration);
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
fakedevice = false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -183,9 +217,15 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
case NetworkDeviceType::WiFi:
|
||||
device = new WifiDevice(hostname, preferences, ipConfiguration);
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
fakedevice = false;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
device = new WifiDevice(hostname, preferences, ipConfiguration);
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
fakedevice = false;
|
||||
#endif
|
||||
break;
|
||||
#else
|
||||
default:
|
||||
@@ -202,5 +242,16 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32P4)
|
||||
if (fakedevice) {
|
||||
Log->println("Create dummy WiFi device for Hosted on P4");
|
||||
NetworkDevice* device2 = nullptr;
|
||||
device2 = new WifiDevice("fakep4forhosted", preferences, ipConfiguration);
|
||||
device2->initialize();
|
||||
delete device2;
|
||||
device2 = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,12 @@ NetworkDeviceType NetworkUtil::GetDeviceTypeFromPreference(int hardwareDetect, i
|
||||
return NetworkDeviceType::Waveshare_ESP32_S3_ETH;
|
||||
case 14:
|
||||
return NetworkDeviceType::LilyGO_T_ETH_Lite_S3;
|
||||
case 15:
|
||||
return NetworkDeviceType::Waveshare_ESP32_P4_NANO;
|
||||
case 16:
|
||||
return NetworkDeviceType::Waveshare_ESP32_P4_Module_DEV_KIT;
|
||||
case 17:
|
||||
return NetworkDeviceType::ESP32_P4_Function_EV_Board;
|
||||
default:
|
||||
Log->println("Unknown hardware selected, falling back to Wi-Fi.");
|
||||
return NetworkDeviceType::WiFi;
|
||||
@@ -101,7 +107,7 @@ eth_clock_mode_t NetworkUtil::GetCustomClock(int custCLKpref)
|
||||
case 0:
|
||||
return ETH_CLOCK_GPIO0_IN;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
return ETH_CLOCK_GPIO0_OUT;
|
||||
break;
|
||||
case 2:
|
||||
|
||||
Reference in New Issue
Block a user