Validate PIN
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
cd ~/arduino*
|
||||
./install.sh
|
||||
./arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" --save-prefs
|
||||
./arduino --install-boards esp32:esp32:2.0.14
|
||||
./arduino --install-boards esp32:esp32:2.0.15
|
||||
- name: Install Arduino CMake Toolchain
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
|
||||
@@ -10,7 +10,7 @@ RUN tar -xf /tmp/arduino-ide.tar.xz --directory ~/
|
||||
RUN cd ~/arduino* && \
|
||||
./install.sh && \
|
||||
./arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" --save-prefs && \
|
||||
./arduino --install-boards esp32:esp32:2.0.14
|
||||
./arduino --install-boards esp32:esp32:2.0.15
|
||||
|
||||
RUN git clone --recurse-submodules https://github.com/technyon/Arduino-CMake-Toolchain.git ~/Arduino-CMake-Toolchain
|
||||
|
||||
@@ -44,6 +44,6 @@ FROM builder AS runtime
|
||||
|
||||
COPY --from=builder /usr/src/nuki_hub/build/nuki_hub.bin /usr/src/nuki_hub/build/release/nuki_hub.bin
|
||||
COPY --from=builder /usr/src/nuki_hub/build/nuki_hub.partitions.bin /usr/src/nuki_hub/build/release/nuki_hub.partitions.bin
|
||||
COPY --from=builder /root/.arduino15/packages/esp32/hardware/esp32/2.0.14/tools/partitions/boot_app0.bin /usr/src/nuki_hub/build/release/boot_app0.bin
|
||||
COPY --from=builder /root/.arduino15/packages/esp32/hardware/esp32/2.0.15/tools/partitions/boot_app0.bin /usr/src/nuki_hub/build/release/boot_app0.bin
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
@@ -412,6 +412,31 @@ void NukiOpenerWrapper::updateConfig()
|
||||
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
|
||||
_network->publishConfig(_nukiConfig);
|
||||
_retryConfigCount = 0;
|
||||
|
||||
const int pinStatus = _preferences->getInt(preference_opener_pin_status, 4);
|
||||
|
||||
if(isPinSet()) {
|
||||
Nuki::CmdResult result = _nukiOpener.verifySecurityPin();
|
||||
|
||||
if(result != Nuki::CmdResult::Success)
|
||||
{
|
||||
if(pinStatus != 2) {
|
||||
_preferences->putInt(preference_opener_pin_status, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pinStatus != 1) {
|
||||
_preferences->putInt(preference_opener_pin_status, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pinStatus != 0) {
|
||||
_preferences->putInt(preference_opener_pin_status, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -378,6 +378,31 @@ void NukiWrapper::updateConfig()
|
||||
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
|
||||
_network->publishConfig(_nukiConfig);
|
||||
_retryConfigCount = 0;
|
||||
|
||||
const int pinStatus = _preferences->getInt(preference_lock_pin_status, 4);
|
||||
|
||||
if(isPinSet()) {
|
||||
Nuki::CmdResult result = _nukiLock.verifySecurityPin();
|
||||
|
||||
if(result != Nuki::CmdResult::Success)
|
||||
{
|
||||
if(pinStatus != 2) {
|
||||
_preferences->putInt(preference_lock_pin_status, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pinStatus != 1) {
|
||||
_preferences->putInt(preference_lock_pin_status, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pinStatus != 0) {
|
||||
_preferences->putInt(preference_lock_pin_status, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
#define preference_mqtt_password "mqttpass"
|
||||
#define preference_mqtt_log_enabled "mqttlog"
|
||||
#define preference_lock_enabled "lockena"
|
||||
#define preference_lock_pin_status "lockpin"
|
||||
#define preference_mqtt_lock_path "mqttpath"
|
||||
#define preference_opener_enabled "openerena"
|
||||
#define preference_opener_pin_status "openerpin"
|
||||
#define preference_opener_continuous_mode "openercont"
|
||||
#define preference_mqtt_opener_path "mqttoppath"
|
||||
#define preference_check_updates "checkupdates"
|
||||
@@ -71,8 +73,8 @@ private:
|
||||
std::vector<char*> _keys =
|
||||
{
|
||||
preference_started_before, preference_config_version, preference_device_id_lock, preference_device_id_opener, preference_nuki_id_lock, preference_nuki_id_opener, preference_mqtt_broker, preference_mqtt_broker_port, preference_mqtt_user, preference_mqtt_password, preference_mqtt_log_enabled, preference_check_updates,
|
||||
preference_lock_enabled, preference_mqtt_lock_path, preference_opener_enabled, preference_opener_continuous_mode, preference_mqtt_opener_path,
|
||||
preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count,
|
||||
preference_lock_enabled, preference_lock_pin_status, preference_mqtt_lock_path, preference_opener_enabled, preference_opener_pin_status,
|
||||
preference_opener_continuous_mode, preference_mqtt_opener_path, preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count,
|
||||
preference_mqtt_ca, preference_mqtt_crt, preference_mqtt_key, preference_mqtt_hass_discovery, preference_mqtt_hass_cu_url,
|
||||
preference_ip_dhcp_enabled, preference_ip_address, preference_ip_subnet, preference_ip_gateway, preference_ip_dns_server,
|
||||
preference_network_hardware, preference_network_wifi_fallback_disabled, preference_rssi_publish_interval,
|
||||
|
||||
@@ -15,9 +15,9 @@ Feel free to join us on Discord: https://discord.gg/feB9FnMY
|
||||
## Supported devices
|
||||
|
||||
<b>Supported ESP32 devices:</b>
|
||||
- All dual-core ESP32 models with WIFI and BLE which are supported by Arduino Core 2.0.14 should work, but builds are currently only provided for the ESP32 and not for the ESP32-S3 or ESP32-C3.
|
||||
- All dual-core ESP32 models with WIFI and BLE which are supported by Arduino Core 2.0.15 should work, but builds are currently only provided for the ESP32 and not for the ESP32-S3 or ESP32-C3.
|
||||
- The ESP32-S2 has no BLE and as such can't run Nuki Hub.
|
||||
- The ESP32-C6 and ESP32-H2 are not supported by Arduino Core 2.0.14 as such can't run Nuki Hub (at this time).
|
||||
- The ESP32-C6 and ESP32-H2 are not supported by Arduino Core 2.0.15 as such can't run Nuki Hub (at this time).
|
||||
|
||||
<b>Supported Nuki devices:</b>
|
||||
- Nuki Smart Lock 1.0
|
||||
|
||||
@@ -710,6 +710,23 @@ void WebCfgServer::buildHtml(String& response)
|
||||
NukiLock::lockstateToString(_nuki->keyTurnerState().lockState, lockstateArr);
|
||||
printParameter(response, "Nuki Lock paired", _nuki->isPaired() ? ("Yes (BLE Address " + _nuki->getBleAddress().toString() + ")").c_str() : "No");
|
||||
printParameter(response, "Nuki Lock state", lockstateArr);
|
||||
|
||||
if(_nuki->isPaired()) {
|
||||
switch(_preferences->getInt(preference_lock_pin_status, 4))
|
||||
{
|
||||
case 0:
|
||||
printParameter(response, "Nuki Lock PIN status", "PIN not set");
|
||||
break;
|
||||
case 1:
|
||||
printParameter(response, "Nuki Lock PIN status", "PIN set but invalid");
|
||||
break;
|
||||
case 2:
|
||||
printParameter(response, "Nuki Lock PIN status", "PIN valid");
|
||||
break;
|
||||
default:
|
||||
printParameter(response, "Nuki Lock PIN status", "Unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(_nukiOpener != nullptr)
|
||||
{
|
||||
@@ -725,6 +742,23 @@ void WebCfgServer::buildHtml(String& response)
|
||||
{
|
||||
printParameter(response, "Nuki Opener state", lockstateArr);
|
||||
}
|
||||
|
||||
if(_nukiOpener->isPaired()) {
|
||||
switch(_preferences->getInt(preference_opener_pin_status, 4))
|
||||
{
|
||||
case 0:
|
||||
printParameter(response, "Nuki Opener PIN status", "PIN not set");
|
||||
break;
|
||||
case 1:
|
||||
printParameter(response, "Nuki Opener PIN status", "PIN set but invalid");
|
||||
break;
|
||||
case 2:
|
||||
printParameter(response, "Nuki Opener PIN status", "PIN valid");
|
||||
break;
|
||||
default:
|
||||
printParameter(response, "Nuki Opener PIN status", "Unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
printParameter(response, "Firmware", version.c_str(), "/info");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user