Skip to content

Commit 322b110

Browse files
authored
Merge pull request #16 from technyon/main
Fix settings opener config; add confguring sound level
2 parents 3761beb + 822fd64 commit 322b110

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/NukiOpener.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ CmdResult NukiOpener::enableLedFlash(const bool enable) {
223223
return result;
224224
}
225225

226+
CmdResult NukiOpener::setSoundLevel(const uint8_t value)
227+
{
228+
AdvancedConfig oldConfig;
229+
Nuki::CmdResult result = requestAdvancedConfig(&oldConfig);
230+
if (result == Nuki::CmdResult::Success) {
231+
oldConfig.soundLevel = value;
232+
result = setFromAdvancedConfig(oldConfig);
233+
}
234+
return result;
235+
}
236+
226237
Nuki::CmdResult NukiOpener::setAdvertisingMode(const AdvertisingMode mode) {
227238
Config oldConfig;
228239
Nuki::CmdResult result = requestConfig(&oldConfig);
@@ -453,4 +464,6 @@ void NukiOpener::handleReturnMessage(Command returnCode, unsigned char* data, ui
453464
void NukiOpener::logErrorCode(uint8_t errorCode) {
454465
NukiOpener::logErrorCode(errorCode);
455466
}
467+
468+
456469
}

src/NukiOpener.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ class NukiOpener : public Nuki::NukiBle {
137137
*/
138138
CmdResult enableLedFlash(const bool enable);
139139

140+
/**
141+
* @brief Gets the current config from the lock, and updates the sound level.
142+
*
143+
* @param enable true if led enabled
144+
*/
145+
CmdResult setSoundLevel(const uint8_t value);
146+
140147
/**
141148
* @brief Gets the current config from the lock, updates the advertising frequency parameter
142149
* and sends the new config to the lock via BLE

src/NukiOpenerConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ struct __attribute__((packed)) AdvancedConfig {
204204
uint16_t electricStrikeDuration;
205205
uint8_t disableRtoAfterRing;
206206
uint8_t rtoTimeout;
207+
uint8_t unknown;
207208
uint8_t doorbellSuppression;
208209
uint16_t doorbellSuppressionDuration;
209210
uint8_t soundRing;
@@ -227,6 +228,7 @@ struct __attribute__((packed)) NewAdvancedConfig {
227228
uint16_t electricStrikeDuration;
228229
uint8_t disableRtoAfterRing;
229230
uint8_t rtoTimeout;
231+
uint8_t unknown;
230232
uint8_t doorbellSuppression;
231233
uint16_t doorbellSuppressionDuration;
232234
uint8_t soundRing;

0 commit comments

Comments
 (0)