Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Oct 24, 2024
1 parent f01b4c4 commit 18762b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
16 changes: 0 additions & 16 deletions components/nuki_lock/nuki_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,39 +621,23 @@ void NukiLockUnpairButton::press_action() {

#ifdef USE_SWITCH
// Pairing Mode Switch
void NukiLockPairingModeSwitch::setup() {
this->publish_state(false);
}

void NukiLockPairingModeSwitch::write_state(bool state) {
this->parent_->set_pairing_mode(state);
}

// Button Enabled Switch
void NukiLockButtonEnabledSwitch::setup() {
this->publish_state(false);
}

void NukiLockButtonEnabledSwitch::write_state(bool state) {
this->parent_->set_button_enabled(state);
}

// LED Enabled Switch
void NukiLockLedEnabledSwitch::setup() {
this->publish_state(false);
}

void NukiLockLedEnabledSwitch::write_state(bool state) {
this->parent_->set_led_enabled(state);
}
#endif

#ifdef USE_NUMBER
// LED Brightness Number
void NukiLockLedBrightnessNumber::setup() {
this->publish_state(0);
}

void NukiLockLedBrightnessNumber::control(float value) {
this->parent_->set_led_brightness(value);
}
Expand Down
8 changes: 2 additions & 6 deletions components/nuki_lock/nuki_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,12 @@ class NukiLockUnpairButton : public button::Button, public Parented<NukiLockComp
#endif

#ifdef USE_SWITCH
class NukiLockPairingModeSwitch : public Component, public switch_::Switch, public Parented<NukiLockComponent> {
class NukiLockPairingModeSwitch : public switch_::Switch, public Parented<NukiLockComponent> {
public:
NukiLockPairingModeSwitch() = default;
Trigger<> *get_turn_on_trigger() const;
Trigger<> *get_turn_off_trigger() const;
protected:
void setup() override;
void write_state(bool state) override;
Trigger<> *turn_on_trigger_;
Trigger<> *turn_off_trigger_;
Expand All @@ -227,7 +226,6 @@ class NukiLockAutoUnlatchEnabledSwitch : public switch_::Switch, public Parented
Trigger<> *get_turn_off_trigger() const;

protected:
void setup() override;
void write_state(bool state) override;
Trigger<> *turn_on_trigger_;
Trigger<> *turn_off_trigger_;
Expand All @@ -240,7 +238,6 @@ class NukiLockButtonEnabledSwitch : public switch_::Switch, public Parented<Nuki
Trigger<> *get_turn_off_trigger() const;

protected:
void setup() override;
void write_state(bool state) override;
Trigger<> *turn_on_trigger_;
Trigger<> *turn_off_trigger_;
Expand All @@ -253,15 +250,14 @@ class NukiLockLedEnabledSwitch : public switch_::Switch, public Parented<NukiLoc
Trigger<> *get_turn_off_trigger() const;

protected:
void setup() override;
void write_state(bool state) override;
Trigger<> *turn_on_trigger_;
Trigger<> *turn_off_trigger_;
};
#endif

#ifdef USE_NUMBER
class NukiLockLedBrightnessNumber : public number::Number, public Parented<NukiLockComponent> {
class NukiLockLedBrightnessNumber : public Component, public number::Number, public Parented<NukiLockComponent> {
public:
NukiLockLedBrightnessNumber() = default;

Expand Down

0 comments on commit 18762b4

Please sign in to comment.