esphome-api-client 0.5.0
Modern C++17 client for the ESPHome native API (plaintext + Noise)
Loading...
Searching...
No Matches
siren.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#include <vector>
15
16namespace esphome::api {
17
18namespace proto {
19class ListEntitiesSirenResponse;
20class SirenStateResponse;
21class SirenCommandRequest;
22} // namespace proto
23
26 std::vector<std::string> tones;
27 bool supports_duration = false;
28 bool supports_volume = false;
29};
30
32struct SirenState {
33 std::uint32_t key = 0;
34 bool state = false;
35};
36
39 std::uint32_t key = 0;
40 std::optional<bool> state;
41 std::optional<std::string> tone;
42 std::optional<std::uint32_t> duration;
43 std::optional<float> volume;
44};
45
46SirenInfo parse_siren_info(const proto::ListEntitiesSirenResponse& msg);
47SirenState parse_siren_state(const proto::SirenStateResponse& msg);
48std::unique_ptr<ProtoMessage> to_message(const SirenCommand& cmd);
49
50} // 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)
SirenInfo parse_siren_info(const proto::ListEntitiesSirenResponse &msg)
SirenState parse_siren_state(const proto::SirenStateResponse &msg)
Lightweight base class for every generated ESPHome API message.
Fields present on every ListEntities*Response.
Definition entity.hpp:16
A command targeting a siren entity.
Definition siren.hpp:38
std::optional< bool > state
Definition siren.hpp:40
std::optional< float > volume
Definition siren.hpp:43
std::optional< std::uint32_t > duration
Definition siren.hpp:42
std::uint32_t key
Definition siren.hpp:39
std::optional< std::string > tone
Definition siren.hpp:41
Static description of a siren entity.
Definition siren.hpp:25
bool supports_volume
Definition siren.hpp:28
std::vector< std::string > tones
Definition siren.hpp:26
bool supports_duration
Definition siren.hpp:27
A siren's reported state.
Definition siren.hpp:32
bool state
Definition siren.hpp:34
std::uint32_t key
Definition siren.hpp:33