Merge pull request #725 from iranl/no-warnings-battery-type

Add NoWarnings BatteryType and Add Recalibrate
This commit is contained in:
iranl
2025-12-13 12:20:38 +01:00
committed by GitHub
15 changed files with 141 additions and 36 deletions

View File

@@ -796,7 +796,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalLockEntities(char *devic
_preferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs));
uint32_t basicLockConfigAclPrefs[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
if(_preferences->getBool(preference_conf_info_enabled, true))
{
@@ -1568,6 +1568,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalLockEntities(char *devic
json["options"][0] = "Alkali";
json["options"][1] = "Accumulators";
json["options"][2] = "Lithium";
json["options"][3] = "No Warnings";
serializeJson(json, _buffer, _bufferSize);
String path = createHassTopicPath("select", "battery_type", uidString);
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, _buffer);
@@ -1968,15 +1969,39 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalLockEntities(char *devic
String("~") + mqtt_topic_config_action,
{
{ (char*)"en", (char*)"true" },
{ (char*)"pl_on", (char*)"{ \"rebootNuki\": \"1\"}" },
{ (char*)"pl_off", (char*)"{ \"rebootNuki\": \"0\"}" },
{ (char*)"val_tpl", (char*)"{{value_json.rebootNuki}}" }
{ (char*)"pl_prs", (char*)"{ \"rebootNuki\": \"1\"}" }
});
}
else
{
removeHassTopic((char*)"button", (char*)"reboot_nuki", uidString);
}
if((int)advancedLockConfigAclPrefs[25] == 1)
{
// Recalibrate Nuki
publishHassTopic("button",
"recalibrate_nuki",
uidString,
"_recalibrate_nuki",
"Recalibrate Nuki",
name,
baseTopic,
"",
deviceType,
"",
"",
"diagnostic",
String("~") + mqtt_topic_config_action,
{
{ (char*)"en", (char*)"true" },
{ (char*)"pl_prs", (char*)"{ \"recalibrateNuki\": \"1\"}" }
});
}
else
{
removeHassTopic((char*)"button", (char*)"recalibrate_nuki", uidString);
}
}
void HomeAssistantDiscovery::publishHASSConfigDoorSensor(char *deviceType, const char *baseTopic, char *name, char *uidString)
@@ -2006,7 +2031,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalOpenerEntities(char *dev
uint32_t aclPrefs[17];
_preferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
if(_preferences->getBool(preference_conf_info_enabled, true))
{
@@ -2859,6 +2884,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalOpenerEntities(char *dev
json["options"][0] = "Alkali";
json["options"][1] = "Accumulators";
json["options"][2] = "Lithium";
json["options"][3] = "No Warnings";
serializeJson(json, _buffer, _bufferSize);
String path = createHassTopicPath("select", "battery_type", uidString);
_device->mqttPublish(path.c_str(), MQTT_QOS_LEVEL, true, _buffer);
@@ -2923,6 +2949,32 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalOpenerEntities(char *dev
{
removeHassTopic((char*)"button", (char*)"reboot_nuki", uidString);
}
if((int)advancedOpenerConfigAclPrefs[21] == 1)
{
// Recalibrate Nuki
publishHassTopic("button",
"recalibrate_nuki",
uidString,
"_recalibrate_nuki",
"Recalibrate Nuki",
name,
baseTopic,
"",
deviceType,
"",
"",
"diagnostic",
String("~") + mqtt_topic_config_action,
{
{ (char*)"en", (char*)"true" },
{ (char*)"pl_prs", (char*)"{ \"recalibrateNuki\": \"1\"}" }
});
}
else
{
removeHassTopic((char*)"button", (char*)"recalibrate_nuki", uidString);
}
}
void HomeAssistantDiscovery::publishHASSConfigAccessLog(char *deviceType, const char *baseTopic, char *name, char *uidString)

View File

@@ -1583,6 +1583,9 @@ void NukiNetwork::batteryTypeToString(const Nuki::BatteryType battype, char* str
case Nuki::BatteryType::Lithium:
strcpy(str, "Lithium");
break;
case Nuki::BatteryType::NoWarnings:
strcpy(str, "No Warnings");
break;
default:
strcpy(str, "undefined");
break;

View File

@@ -972,6 +972,7 @@ void NukiNetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &conf
json["enableSlowSpeedDuringNightMode"] = config.enableSlowSpeedDuringNightMode;
}
json["rebootNuki"] = 0;
json["recalibrateNuki"] = 0;
serializeJson(json, _buffer, _bufferSize);
_nukiPublisher->publishString(mqtt_topic_config_advanced_json, _buffer, true);

View File

@@ -861,6 +861,7 @@ void NukiNetworkOpener::publishAdvancedConfig(const NukiOpener::AdvancedConfig &
json["batteryType"] = str;
json["automaticBatteryTypeDetection"] = config.automaticBatteryTypeDetection;
json["rebootNuki"] = 0;
json["recalibrateNuki"] = 0;
serializeJson(json, _buffer, _bufferSize);
_nukiPublisher->publishString(mqtt_topic_config_advanced_json, _buffer, true);

View File

@@ -1086,7 +1086,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
Nuki::CmdResult cmdResult;
const char *basicKeys[14] = {"name", "latitude", "longitude", "pairingEnabled", "buttonEnabled", "ledFlashEnabled", "timeZoneOffset", "dstMode", "fobAction1", "fobAction2", "fobAction3", "operatingMode", "advertisingMode", "timeZone"};
const char *advancedKeys[21] = {"intercomID", "busModeSwitch", "shortCircuitDuration", "electricStrikeDelay", "randomElectricStrikeDelay", "electricStrikeDuration", "disableRtoAfterRing", "rtoTimeout", "doorbellSuppression", "doorbellSuppressionDuration", "soundRing", "soundOpen", "soundRto", "soundCm", "soundConfirmation", "soundLevel", "singleButtonPressAction", "doubleButtonPressAction", "batteryType", "automaticBatteryTypeDetection", "rebootNuki"};
const char *advancedKeys[22] = {"intercomID", "busModeSwitch", "shortCircuitDuration", "electricStrikeDelay", "randomElectricStrikeDelay", "electricStrikeDuration", "disableRtoAfterRing", "rtoTimeout", "doorbellSuppression", "doorbellSuppressionDuration", "soundRing", "soundOpen", "soundRto", "soundCm", "soundConfirmation", "soundLevel", "singleButtonPressAction", "doubleButtonPressAction", "batteryType", "automaticBatteryTypeDetection", "rebootNuki", "recalibrateNuki"};
bool basicUpdated = false;
bool advancedUpdated = false;
@@ -1438,7 +1438,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
}
}
for(int j=0; j < 21; j++)
for(int j=0; j < 22; j++)
{
if(json[advancedKeys[j]].is<JsonVariantConst>())
{
@@ -1891,6 +1891,19 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
jsonResult[advancedKeys[j]] = "invalidValue";
}
}
else if(strcmp(advancedKeys[j], "recalibrateNuki") == 0)
{
const uint8_t keyvalue = atoi(jsonchar);
if(keyvalue == 1)
{
cmdResult = _nukiOpener.requestCalibration();
}
else
{
jsonResult[advancedKeys[j]] = "invalidValue";
}
}
if(cmdResult != Nuki::CmdResult::Success)
{

View File

@@ -149,7 +149,7 @@ private:
int64_t _lastRssi = 0;
int64_t _disableBleWatchdogTs = 0;
uint32_t _basicOpenerConfigAclPrefs[16];
uint32_t _advancedOpenerConfigAclPrefs[21];
uint32_t _advancedOpenerConfigAclPrefs[22];
std::string _firmwareVersion = "";
std::string _hardwareVersion = "";
NukiOpener::LockAction _nextLockAction = (NukiOpener::LockAction)0xff;

View File

@@ -1296,7 +1296,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
Nuki::CmdResult cmdResult;
const char *basicKeys[16] = {"name", "latitude", "longitude", "autoUnlatch", "pairingEnabled", "buttonEnabled", "ledEnabled", "ledBrightness", "timeZoneOffset", "dstMode", "fobAction1", "fobAction2", "fobAction3", "singleLock", "advertisingMode", "timeZone"};
const char *advancedKeys[25] = {"unlockedPositionOffsetDegrees", "lockedPositionOffsetDegrees", "singleLockedPositionOffsetDegrees", "unlockedToLockedTransitionOffsetDegrees", "lockNgoTimeout", "singleButtonPressAction", "doubleButtonPressAction", "detachedCylinder", "batteryType", "automaticBatteryTypeDetection", "unlatchDuration", "autoLockTimeOut", "autoUnLockDisabled", "nightModeEnabled", "nightModeStartTime", "nightModeEndTime", "nightModeAutoLockEnabled", "nightModeAutoUnlockDisabled", "nightModeImmediateLockOnStart", "autoLockEnabled", "immediateAutoLockEnabled", "autoUpdateEnabled", "rebootNuki", "motorSpeed", "enableSlowSpeedDuringNightMode"};
const char *advancedKeys[26] = {"unlockedPositionOffsetDegrees", "lockedPositionOffsetDegrees", "singleLockedPositionOffsetDegrees", "unlockedToLockedTransitionOffsetDegrees", "lockNgoTimeout", "singleButtonPressAction", "doubleButtonPressAction", "detachedCylinder", "batteryType", "automaticBatteryTypeDetection", "unlatchDuration", "autoLockTimeOut", "autoUnLockDisabled", "nightModeEnabled", "nightModeStartTime", "nightModeEndTime", "nightModeAutoLockEnabled", "nightModeAutoUnlockDisabled", "nightModeImmediateLockOnStart", "autoLockEnabled", "immediateAutoLockEnabled", "autoUpdateEnabled", "rebootNuki", "motorSpeed", "enableSlowSpeedDuringNightMode", "recalibrateNuki"};
bool basicUpdated = false;
bool advancedUpdated = false;
@@ -1688,7 +1688,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
}
}
for(int j=0; j < 25; j++)
for(int j=0; j < 26; j++)
{
if(json[advancedKeys[j]].is<JsonVariantConst>())
{
@@ -2185,6 +2185,19 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
jsonResult[advancedKeys[j]] = "invalidValue";
}
}
else if(strcmp(advancedKeys[j], "recalibrateNuki") == 0)
{
const uint8_t keyvalue = atoi(jsonchar);
if(keyvalue == 1)
{
cmdResult = _nukiLock.requestCalibration();
}
else
{
jsonResult[advancedKeys[j]] = "invalidValue";
}
}
else if(strcmp(advancedKeys[j], "motorSpeed") == 0)
{
NukiLock::MotorSpeed motorSpeed = NukiHelper::motorSpeedToEnum(jsonchar);

View File

@@ -163,7 +163,7 @@ private:
int64_t _lastRssi = 0;
int64_t _disableBleWatchdogTs = 0;
uint32_t _basicLockConfigaclPrefs[16];
uint32_t _advancedLockConfigaclPrefs[25];
uint32_t _advancedLockConfigaclPrefs[26];
std::string _firmwareVersion = "";
std::string _hardwareVersion = "";
volatile NukiLock::LockAction _nextLockAction = (NukiLock::LockAction)0xff;

View File

@@ -212,9 +212,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
preferences->putString(preference_mqtt_lock_path, "nukihub");
@@ -338,9 +338,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
break;
}
@@ -353,9 +353,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
break;
}
@@ -368,9 +368,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
break;
}
@@ -383,9 +383,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
break;
}
@@ -398,9 +398,9 @@ inline void initPreferences(Preferences* preferences)
preferences->putBytes(preference_conf_lock_basic_acl, (byte*)(&basicLockConfigAclPrefs), sizeof(basicLockConfigAclPrefs));
uint32_t basicOpenerConfigAclPrefs[14] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
preferences->putBytes(preference_conf_opener_basic_acl, (byte*)(&basicOpenerConfigAclPrefs), sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
uint32_t advancedLockConfigAclPrefs[26] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
preferences->putBytes(preference_conf_lock_advanced_acl, (byte*)(&advancedLockConfigAclPrefs), sizeof(advancedLockConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
uint32_t advancedOpenerConfigAclPrefs[22] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
break;
}

View File

@@ -2811,8 +2811,8 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
uint32_t aclPrefs[17] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t basicLockConfigAclPrefs[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t basicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t advancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int params = request->params();
@@ -4493,6 +4493,10 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
{
advancedLockConfigAclPrefs[24] = ((value == "1") ? 1 : 0);
}
else if(key == "CONFLCKRCBRTNUKI")
{
advancedLockConfigAclPrefs[25] = ((value == "1") ? 1 : 0);
}
else if(key == "CONFOPNNAME")
{
basicOpenerConfigAclPrefs[0] = ((value == "1") ? 1 : 0);
@@ -4633,6 +4637,10 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
{
advancedOpenerConfigAclPrefs[20] = ((value == "1") ? 1 : 0);
}
else if(key == "CONFOPNRCBRTNUKI")
{
advancedOpenerConfigAclPrefs[21] = ((value == "1") ? 1 : 0);
}
else if(key == "REGAPP")
{
if(_preferences->getBool(preference_register_as_app, false) != (value == "1"))
@@ -4971,9 +4979,9 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
{
uint32_t curAclPrefs[17] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curBasicLockConfigAclPrefs[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curAdvancedLockConfigAclPrefs[25] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curAdvancedLockConfigAclPrefs[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curBasicOpenerConfigAclPrefs[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curAdvancedOpenerConfigAclPrefs[21] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint32_t curAdvancedOpenerConfigAclPrefs[22] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
_preferences->getBytes(preference_acl, &curAclPrefs, sizeof(curAclPrefs));
_preferences->getBytes(preference_conf_lock_basic_acl, &curBasicLockConfigAclPrefs, sizeof(curBasicLockConfigAclPrefs));
_preferences->getBytes(preference_conf_lock_advanced_acl, &curAdvancedLockConfigAclPrefs, sizeof(curAdvancedLockConfigAclPrefs));
@@ -5000,7 +5008,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
break;
}
}
for(int i=0; i < 25; i++)
for(int i=0; i < 26; i++)
{
if(curAdvancedLockConfigAclPrefs[i] != advancedLockConfigAclPrefs[i])
{
@@ -5021,7 +5029,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
break;
}
}
for(int i=0; i < 21; i++)
for(int i=0; i < 22; i++)
{
if(curAdvancedOpenerConfigAclPrefs[i] != advancedOpenerConfigAclPrefs[i])
{
@@ -5992,7 +6000,7 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request, PsychicResponse
{
uint32_t basicLockConfigAclPrefs[16];
_preferences->getBytes(preference_conf_lock_basic_acl, &basicLockConfigAclPrefs, sizeof(basicLockConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25];
uint32_t advancedLockConfigAclPrefs[26];
_preferences->getBytes(preference_conf_lock_advanced_acl, &advancedLockConfigAclPrefs, sizeof(advancedLockConfigAclPrefs));
response.print("<h3>Nuki Lock Access Control</h3>");
@@ -6062,6 +6070,7 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request, PsychicResponse
printCheckBox(&response, "CONFLCKRBTNUKI", "Reboot Nuki", ((int)advancedLockConfigAclPrefs[22] == 1), "chk_config_lock");
printCheckBox(&response, "CONFLCKMTRSPD", "Motor speed", ((int)advancedLockConfigAclPrefs[23] == 1), "chk_config_lock");
printCheckBox(&response, "CONFLCKESSDNM", "Enable slow speed during nightmode", ((int)advancedLockConfigAclPrefs[24] == 1), "chk_config_lock");
printCheckBox(&response, "CONFLCKRCBRTNUKI", "Recalibrate Nuki", ((int)advancedLockConfigAclPrefs[25] == 1), "chk_config_lock");
response.print("</table><br>");
response.print("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");
}
@@ -6069,7 +6078,7 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request, PsychicResponse
{
uint32_t basicOpenerConfigAclPrefs[14];
_preferences->getBytes(preference_conf_opener_basic_acl, &basicOpenerConfigAclPrefs, sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21];
uint32_t advancedOpenerConfigAclPrefs[22];
_preferences->getBytes(preference_conf_opener_advanced_acl, &advancedOpenerConfigAclPrefs, sizeof(advancedOpenerConfigAclPrefs));
response.print("<h3>Nuki Opener Access Control</h3>");
@@ -6132,6 +6141,7 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request, PsychicResponse
printCheckBox(&response, "CONFOPNBATT", "Battery type", ((int)advancedOpenerConfigAclPrefs[18] == 1), "chk_config_opener");
printCheckBox(&response, "CONFOPNABTD", "Automatic battery type detection", ((int)advancedOpenerConfigAclPrefs[19] == 1), "chk_config_opener");
printCheckBox(&response, "CONFOPNRBTNUKI", "Reboot Nuki", ((int)advancedOpenerConfigAclPrefs[20] == 1), "chk_config_opener");
printCheckBox(&response, "CONFOPNRCBRTNUKI", "Recalibrate Nuki", ((int)advancedOpenerConfigAclPrefs[21] == 1), "chk_config_opener");
response.print("</table><br>");
response.print("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");
}
@@ -6705,7 +6715,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
}
uint32_t basicLockConfigAclPrefs[16];
_preferences->getBytes(preference_conf_lock_basic_acl, &basicLockConfigAclPrefs, sizeof(basicLockConfigAclPrefs));
uint32_t advancedLockConfigAclPrefs[25];
uint32_t advancedLockConfigAclPrefs[26];
_preferences->getBytes(preference_conf_lock_advanced_acl, &advancedLockConfigAclPrefs, sizeof(advancedLockConfigAclPrefs));
response.print("\n\n------------ NUKI LOCK ACL ------------");
response.print("\nLock: ");
@@ -6809,6 +6819,8 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
response.print((int)advancedLockConfigAclPrefs[23] ? "Allowed" : "Disallowed");
response.print("\nEnable slow speed during nightmode: ");
response.print((int)advancedLockConfigAclPrefs[24] ? "Allowed" : "Disallowed");
response.print("\nRecalibrate Nuki: ");
response.print((int)advancedLockConfigAclPrefs[25] ? "Allowed" : "Disallowed");
if(_preferences->getBool(preference_show_secrets))
{
@@ -6894,7 +6906,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
response.print(_preferences->getBool(preference_opener_force_keypad, false) ? "Yes" : "No");
uint32_t basicOpenerConfigAclPrefs[14];
_preferences->getBytes(preference_conf_opener_basic_acl, &basicOpenerConfigAclPrefs, sizeof(basicOpenerConfigAclPrefs));
uint32_t advancedOpenerConfigAclPrefs[21];
uint32_t advancedOpenerConfigAclPrefs[22];
_preferences->getBytes(preference_conf_opener_advanced_acl, &advancedOpenerConfigAclPrefs, sizeof(advancedOpenerConfigAclPrefs));
response.print("\n\n------------ NUKI OPENER ACL ------------");
response.print("\nActivate Ring-to-Open: ");
@@ -6984,6 +6996,8 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
response.print((int)advancedOpenerConfigAclPrefs[19] ? "Allowed" : "Disallowed");
response.print("\nReboot Nuki: ");
response.print((int)advancedOpenerConfigAclPrefs[20] ? "Allowed" : "Disallowed");
response.print("\nRecalibrate Nuki: ");
response.print((int)advancedOpenerConfigAclPrefs[21] ? "Allowed" : "Disallowed");
if(_preferences->getBool(preference_show_secrets))
{
char tmp[16];

View File

@@ -9,7 +9,7 @@ dependencies:
espressif/libsodium: "^1.0.20~2"
espressif/esp_hosted:
version: "2.6.6"
version: "2.7.3"
rules:
- if: "target in [esp32p4]"

View File

@@ -329,6 +329,10 @@ const Nuki::BatteryType NukiHelper::batteryTypeToEnum(const char* str)
{
return Nuki::BatteryType::Lithium;
}
else if(strcmp(str, "No Warnings") == 0)
{
return Nuki::BatteryType::NoWarnings;
}
return (Nuki::BatteryType)0xff;
}

View File

@@ -268,6 +268,10 @@ const Nuki::BatteryType NukiOpenerHelper::batteryTypeToEnum(const char* str)
{
return Nuki::BatteryType::Lithium;
}
else if(strcmp(str, "No Warnings") == 0)
{
return Nuki::BatteryType::NoWarnings;
}
return (Nuki::BatteryType)0xff;
}

View File

@@ -3,7 +3,7 @@ dependencies:
idf: ">=5.5"
espressif/esp_hosted:
version: "2.6.6"
version: "2.7.3"
#override_path: "../../resources/espressif__esp_hosted"
rules:
- if: "target in [esp32p4]"