Skip to content

Commit

Permalink
Merge pull request #16 from technyon/main
Browse files Browse the repository at this point in the history
Fix settings opener config; add confguring sound level
  • Loading branch information
Bascy authored Jul 23, 2022
2 parents 3761beb + 822fd64 commit 322b110
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/NukiOpener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ CmdResult NukiOpener::enableLedFlash(const bool enable) {
return result;
}

CmdResult NukiOpener::setSoundLevel(const uint8_t value)
{
AdvancedConfig oldConfig;
Nuki::CmdResult result = requestAdvancedConfig(&oldConfig);
if (result == Nuki::CmdResult::Success) {
oldConfig.soundLevel = value;
result = setFromAdvancedConfig(oldConfig);
}
return result;
}

Nuki::CmdResult NukiOpener::setAdvertisingMode(const AdvertisingMode mode) {
Config oldConfig;
Nuki::CmdResult result = requestConfig(&oldConfig);
Expand Down Expand Up @@ -453,4 +464,6 @@ void NukiOpener::handleReturnMessage(Command returnCode, unsigned char* data, ui
void NukiOpener::logErrorCode(uint8_t errorCode) {
NukiOpener::logErrorCode(errorCode);
}


}
7 changes: 7 additions & 0 deletions src/NukiOpener.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ class NukiOpener : public Nuki::NukiBle {
*/
CmdResult enableLedFlash(const bool enable);

/**
* @brief Gets the current config from the lock, and updates the sound level.
*
* @param enable true if led enabled
*/
CmdResult setSoundLevel(const uint8_t value);

/**
* @brief Gets the current config from the lock, updates the advertising frequency parameter
* and sends the new config to the lock via BLE
Expand Down
2 changes: 2 additions & 0 deletions src/NukiOpenerConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ struct __attribute__((packed)) AdvancedConfig {
uint16_t electricStrikeDuration;
uint8_t disableRtoAfterRing;
uint8_t rtoTimeout;
uint8_t unknown;
uint8_t doorbellSuppression;
uint16_t doorbellSuppressionDuration;
uint8_t soundRing;
Expand All @@ -227,6 +228,7 @@ struct __attribute__((packed)) NewAdvancedConfig {
uint16_t electricStrikeDuration;
uint8_t disableRtoAfterRing;
uint8_t rtoTimeout;
uint8_t unknown;
uint8_t doorbellSuppression;
uint16_t doorbellSuppressionDuration;
uint8_t soundRing;
Expand Down

0 comments on commit 322b110

Please sign in to comment.