7static const char *
const TAG =
"lock";
42 ESP_LOGD(TAG,
"'%s' Opening.", this->
get_name().c_str());
45 ESP_LOGW(TAG,
"'%s' Does not support Open.", this->
get_name().c_str());
65 ESP_LOGD(TAG,
" State: %s", state_s);
100 ESP_LOGW(TAG,
"'%s' - Unrecognized state %s", this->
parent_->
get_name().
c_str(), state.c_str());
bool next(T value)
Feeds the next item in the series to the deduplicator and returns whether this is a duplicate.
const StringRef & get_name() const
constexpr const char * c_str() const
This class is used to encode all control actions on a lock device.
const optional< LockState > & get_state() const
LockCall & set_state(LockState state)
Set the state of the lock device.
optional< LockState > state_
virtual void control(const LockCall &call)=0
Control the lock device, this is a virtual method that each lock integration must implement.
Deduplicator< LockState > publish_dedup_
virtual void open_latch()
Perform the open latch action with hardware.
LockCall make_call()
Make a lock device control call, this is used to control the lock device, see the LockCall descriptio...
void lock()
Turn this lock on.
void publish_state(LockState state)
Publish a state to the front-end from the back-end.
void add_on_state_callback(std::function< void()> &&callback)
Set callback for state changes.
CallbackManager< void()> state_callback_
LockState state
The current reported state of the lock.
void unlock()
Turn this lock off.
void open()
Open (unlatch) this lock.
bool supports_state(LockState state) const
bool get_supports_open() const
LockState
Enum for all states a lock can be in.
const char * lock_state_to_string(LockState state)
Providing packet encoding functions for exchanging data with a remote host.
bool str_equals_case_insensitive(const std::string &a, const std::string &b)
Compare strings for equality in case-insensitive manner.