esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
switch.hpp
Go to the documentation of this file.
1#pragma once
2
5
9
10#include <cstdint>
11#include <memory>
12#include <string>
13
14namespace esphome::api {
15
16namespace proto {
17class ListEntitiesSwitchResponse;
18class SwitchStateResponse;
19class SwitchCommandRequest;
20} // namespace proto
21
24 bool assumed_state = false;
25 std::string device_class;
26};
27
30 std::uint32_t key = 0;
31 bool state = false;
32};
33
36 std::uint32_t key = 0;
37 bool state = false;
38};
39
40SwitchInfo parse_switch_info(const proto::ListEntitiesSwitchResponse& msg);
41SwitchState parse_switch_state(const proto::SwitchStateResponse& msg);
42std::unique_ptr<ProtoMessage> to_message(const SwitchCommand& cmd);
43
44} // namespace esphome::api
Common entity metadata shared by every entity domain.
Typed mirrors of the ESPHome protobuf enums.
Definition bytes.hpp:10
std::unique_ptr< ProtoMessage > to_message(const AlarmControlPanelCommand &cmd)
SwitchState parse_switch_state(const proto::SwitchStateResponse &msg)
SwitchInfo parse_switch_info(const proto::ListEntitiesSwitchResponse &msg)
Lightweight base class for every generated ESPHome API message.
Fields present on every ListEntities*Response.
Definition entity.hpp:16
A command to change a switch's state.
Definition switch.hpp:35
std::uint32_t key
Definition switch.hpp:36
bool state
Definition switch.hpp:37
Static description of a switch entity.
Definition switch.hpp:23
bool assumed_state
Definition switch.hpp:24
std::string device_class
Definition switch.hpp:25
A switch's reported state.
Definition switch.hpp:29
std::uint32_t key
Definition switch.hpp:30
bool state
Definition switch.hpp:31