esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
lock.hpp
Go to the documentation of this file.
1#pragma once
2
5
9
10#include <cstdint>
11#include <memory>
12#include <optional>
13#include <string>
14
15namespace esphome::api {
16
17namespace proto {
18class ListEntitiesLockResponse;
19class LockStateResponse;
20class LockCommandRequest;
21} // namespace proto
22
24enum class LockCommand : std::int32_t {
25 Unlock = 0, // LOCK_UNLOCK
26 Lock = 1, // LOCK_LOCK
27 Open = 2, // LOCK_OPEN
28};
29
32 bool assumed_state = false;
33 bool supports_open = false;
34 bool requires_code = false;
35 std::string code_format;
36};
37
41 std::uint32_t key = 0;
43};
44
47 std::uint32_t key = 0;
49 std::optional<std::string> code;
50};
51
52LockInfo parse_lock_info(const proto::ListEntitiesLockResponse& msg);
53LockEntityState parse_lock_state(const proto::LockStateResponse& msg);
54std::unique_ptr<ProtoMessage> to_message(const LockCommandData& cmd);
55
56} // namespace esphome::api
Common entity metadata shared by every entity domain.
Typed mirrors of the ESPHome protobuf enums.
Definition bytes.hpp:10
LockInfo parse_lock_info(const proto::ListEntitiesLockResponse &msg)
std::unique_ptr< ProtoMessage > to_message(const AlarmControlPanelCommand &cmd)
LockEntityState parse_lock_state(const proto::LockStateResponse &msg)
LockState
Mirror of proto enum LockState.
Definition enums.hpp:224
LockCommand
Mirror of proto enum LockCommand (not present in the generated enums mirror).
Definition lock.hpp:24
Lightweight base class for every generated ESPHome API message.
Fields present on every ListEntities*Response.
Definition entity.hpp:16
A command targeting a lock entity.
Definition lock.hpp:46
std::uint32_t key
Definition lock.hpp:47
LockCommand command
Definition lock.hpp:48
std::optional< std::string > code
Definition lock.hpp:49
A lock's reported state.
Definition lock.hpp:40
LockState state
Definition lock.hpp:42
std::uint32_t key
Definition lock.hpp:41
Static description of a lock entity.
Definition lock.hpp:31
bool assumed_state
Definition lock.hpp:32
bool supports_open
Definition lock.hpp:33
bool requires_code
Definition lock.hpp:34
std::string code_format
Definition lock.hpp:35