15 #define LOG_LOCK(prefix, type, obj) \ 16 if ((obj) != nullptr) { \ 17 ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \ 18 if (!(obj)->get_icon().empty()) { \ 19 ESP_LOGCONFIG(TAG, "%s Icon: '%s'", prefix, (obj)->get_icon().c_str()); \ 21 if ((obj)->traits.get_assumed_state()) { \ 22 ESP_LOGCONFIG(TAG, "%s Assumed State: YES", prefix); \ 80 LockCall &set_state(
const std::string &state);
146 void add_on_state_callback(std::function<
void()> &&callback);
167 virtual void control(
const LockCall &call) = 0;
void set_supported_states(std::set< LockState > states)
std::set< LockState > get_supported_states() const
optional< LockState > state_
const char * lock_state_to_string(LockState state)
void set_supports_open(bool supports_open)
void set_assumed_state(bool assumed_state)
This class is used to encode all control actions on a lock device.
std::set< LockState > supported_states_
Deduplicator< LockState > publish_dedup_
bool supports_state(LockState state) const
void add_supported_state(LockState state)
bool get_assumed_state() const
virtual void open_latch()
Perform the open latch action with hardware.
bool get_requires_code() const
Implementation of SPI Controller mode.
LockState
Enum for all states a lock can be in.
void set_requires_code(bool requires_code)
bool get_supports_open() const
Base class for all locks.