Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
proto_device_features.h
Go to the documentation of this file.
1
#pragma once
2
3
/// @file proto_device_features.h
4
/// @brief Capability bits of a device kind: what a (node type, subtype) can do.
5
/// @ingroup hioc_protocol
6
///
7
/// The bits are carried by the rows of the node-type table (proto_device_types.h) and resolved onto
8
/// each device record, so the hub, the platforms and the Python codegen ask one place whether a
9
/// device has a feature instead of branching on a device type. A bit says *whether* a device has a
10
/// capability; how it is commanded stays in the command builders and the profile tables.
11
///
12
/// This leaf header includes only `<cstdint>`: IoDevice (proto_device_model.h) carries a
13
/// DeviceFeatures word, and proto_device_types.h already includes proto_device_model.h.
14
15
#include <cstdint>
16
17
namespace
esphome
{
18
namespace
home_io_control
{
19
20
/// @brief Capability bits of a device kind; see device_feature.
21
using
DeviceFeatures
= uint16_t;
22
23
/// @brief Capability bits carried by a DeviceTypeInfo row and resolved onto a device record.
24
/// hub_validators.py mirrors the whole word bit for bit (`FEATURE_*`, `DEVICE_FEATURES`) and
25
/// device_features_sync_test.cpp checks it. Bit 15 is never a capability: the Python mirror uses it
26
/// for the row's experimental marker.
27
namespace
device_feature
{
28
/// EXECUTE carries no functional parameter at all (VELUX KLF 200 API specification, Appendix 2:
29
/// "main parameter only"). Read by main_parameter_only_variant() and the table invariants; the frame
30
/// shape itself is EXTENDED_POSITION_FRAME's job.
31
static
constexpr
DeviceFeatures
MAIN_PARAMETER_ONLY
= 1U << 0U;
32
/// Intermediate main-parameter values: a percent position, a brightness or a heat level.
33
static
constexpr
DeviceFeatures
LEVELS
= 1U << 1U;
34
/// Slat angle (functional parameter 3) through the extended status and the tilt EXECUTE.
35
static
constexpr
DeviceFeatures
TILT
= 1U << 2U;
36
/// Named position 0xD800, the favourite ("my") position. Absent where a device has refused the alias
37
/// (garage openers, issue #163).
38
static
constexpr
DeviceFeatures
FAVORITE
= 1U << 3U;
39
/// Named position 0xD803, the window opener's secured ventilation position (VELUX KLF 200 API
40
/// specification, section 14.2).
41
static
constexpr
DeviceFeatures
VENT
= 1U << 4U;
42
/// Named position 0xD809, sent by the Partial Position button: a garage opener runs its stored
43
/// partial position (issue #163).
44
static
constexpr
DeviceFeatures
PARTIAL
= 1U << 5U;
45
/// Named position 0xD807, sent by the Pedestrian Position button.
46
/// \todo Confirm on a real gate opener that 0xD807 opens it to a pedestrian position (experimental).
47
static
constexpr
DeviceFeatures
PEDESTRIAN
= 1U << 6U;
48
/// Position and force-open EXECUTEs use the 8-byte form with functional parameter 1 set (the form
49
/// validated on roller shutters, awnings, the Izymo dimmer and the pergola); without it they use the
50
/// 6-byte main-parameter form. On covers functional parameter 1 is the travel speed (VELUX KLF 200
51
/// API specification, Appendix 2), so `silent:` (the slow profile in that parameter) needs this bit;
52
/// that proxy holds only for covers, which are the only kinds with `silent:`.
53
static
constexpr
DeviceFeatures
EXTENDED_POSITION_FRAME
= 1U << 7U;
54
/// Heater window sensor and open-window-detection switch.
55
static
constexpr
DeviceFeatures
WINDOW_COMPANIONS
= 1U << 8U;
56
/// Direction inverted by default (horizontal awnings: IO 0 is closed).
57
static
constexpr
DeviceFeatures
INVERTED
= 1U << 9U;
58
/// Read and commanded as a domestic hot water heater: family-0x00 registers (proto_dhw.h) for its
59
/// readings and mode, the status main parameter for its target temperature. Gates the water heater
60
/// poll, its register reads and writes, and the `water_heater:` platform.
61
static
constexpr
DeviceFeatures
WATER_HEATER
= 1U << 10U;
62
/// A night light built into a heater with private registers: on/off in register 0x0144, brightness in
63
/// 0x0142 (proto_heating.h). Gates the heater's `night_light:` light entity.
64
static
constexpr
DeviceFeatures
NIGHT_LIGHT
= 1U << 11U;
65
}
// namespace device_feature
66
67
/// @brief True when every bit of `bit` is set in `set`.
68
/// @param set A feature word.
69
/// @param bit One bit, or several that must all be set.
70
constexpr
bool
has_feature
(
DeviceFeatures
set,
DeviceFeatures
bit) {
return
(set & bit) == bit; }
71
72
}
// namespace home_io_control
73
}
// namespace esphome
esphome::home_io_control::device_feature
Capability bits carried by a DeviceTypeInfo row and resolved onto a device record.
Definition
proto_device_features.h:27
esphome::home_io_control::device_feature::PEDESTRIAN
static constexpr DeviceFeatures PEDESTRIAN
Named position 0xD807, sent by the Pedestrian Position button.
Definition
proto_device_features.h:47
esphome::home_io_control::device_feature::EXTENDED_POSITION_FRAME
static constexpr DeviceFeatures EXTENDED_POSITION_FRAME
Position and force-open EXECUTEs use the 8-byte form with functional parameter 1 set (the form valida...
Definition
proto_device_features.h:53
esphome::home_io_control::device_feature::WATER_HEATER
static constexpr DeviceFeatures WATER_HEATER
Read and commanded as a domestic hot water heater: family-0x00 registers (proto_dhw....
Definition
proto_device_features.h:61
esphome::home_io_control::device_feature::VENT
static constexpr DeviceFeatures VENT
Named position 0xD803, the window opener's secured ventilation position (VELUX KLF 200 API specificat...
Definition
proto_device_features.h:41
esphome::home_io_control::device_feature::NIGHT_LIGHT
static constexpr DeviceFeatures NIGHT_LIGHT
A night light built into a heater with private registers: on/off in register 0x0144,...
Definition
proto_device_features.h:64
esphome::home_io_control::device_feature::WINDOW_COMPANIONS
static constexpr DeviceFeatures WINDOW_COMPANIONS
Heater window sensor and open-window-detection switch.
Definition
proto_device_features.h:55
esphome::home_io_control::device_feature::TILT
static constexpr DeviceFeatures TILT
Slat angle (functional parameter 3) through the extended status and the tilt EXECUTE.
Definition
proto_device_features.h:35
esphome::home_io_control::device_feature::INVERTED
static constexpr DeviceFeatures INVERTED
Direction inverted by default (horizontal awnings: IO 0 is closed).
Definition
proto_device_features.h:57
esphome::home_io_control::device_feature::PARTIAL
static constexpr DeviceFeatures PARTIAL
Named position 0xD809, sent by the Partial Position button: a garage opener runs its stored partial p...
Definition
proto_device_features.h:44
esphome::home_io_control::device_feature::FAVORITE
static constexpr DeviceFeatures FAVORITE
Named position 0xD800, the favourite ("my") position.
Definition
proto_device_features.h:38
esphome::home_io_control::device_feature::LEVELS
static constexpr DeviceFeatures LEVELS
Intermediate main-parameter values: a percent position, a brightness or a heat level.
Definition
proto_device_features.h:33
esphome::home_io_control::device_feature::MAIN_PARAMETER_ONLY
static constexpr DeviceFeatures MAIN_PARAMETER_ONLY
EXECUTE carries no functional parameter at all (VELUX KLF 200 API specification, Appendix 2: "main pa...
Definition
proto_device_features.h:31
esphome::home_io_control
Definition
device_registry.cpp:16
esphome::home_io_control::has_feature
constexpr bool has_feature(DeviceFeatures set, DeviceFeatures bit)
True when every bit of bit is set in set.
Definition
proto_device_features.h:70
esphome::home_io_control::DeviceFeatures
uint16_t DeviceFeatures
Capability bits of a device kind; see device_feature.
Definition
proto_device_features.h:21
esphome
Definition
device_registry.cpp:15
components
home_io_control
proto_device_features.h
Generated by
1.18.0