Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
entity_helpers.h File Reference

Conversions and renderers shared by the hub and its Home Assistant entities. More...

#include "log_helpers.h"
#include "proto_codecs.h"
#include "proto_constants.h"
#include "proto_device_model.h"
#include "proto_frame.h"
#include "proto_sizes.h"
#include <array>
#include <cinttypes>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <string>
Include dependency graph for entity_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  esphome
namespace  esphome::home_io_control
namespace  esphome::home_io_control::detail

Functions

uint8_t esphome::home_io_control::detail::round_percent (float fraction)
 Convert a 0.0-1.0 HA fraction (position, tilt, or brightness) to a 0-100 IO percent.
std::string esphome::home_io_control::detail::format_originator (uint8_t originator)
 Render a Command Originator byte as "name(0xXX)", e.g.
std::string esphome::home_io_control::detail::describe_last_commander (const IoDevice &dev, const uint8_t *hub_node_id)
 Render the "Last Commanded By" sensor string.
std::string esphome::home_io_control::detail::describe_last_command_source (const IoDevice &dev)
 Render the "Last Command Source" sensor string.
std::string esphome::home_io_control::detail::format_limitation_param (uint8_t parameter_id)
 Render a limitation parameter id: "MP" for the main parameter, "FP<n>" for 1-16, else hex.
std::string esphome::home_io_control::detail::format_limitation_value (uint16_t value_raw)
 Render a limitation value: a percentage, or the raw selector when it is not a position.
std::string esphome::home_io_control::detail::format_limitation_time (uint8_t time_raw)
 Render a limitation time code with its raw byte: "0x1D (900 s)", "0xFD (unlimited)", "0xFE (code 254)".
std::string esphome::home_io_control::detail::format_limitation_status (const LimitationStatus &status)
 Render a decoded limitation reply on one line, raw bytes beside every decoded value.
std::string esphome::home_io_control::detail::describe_limitation_reply (const IoFrame &frame)
 Render a CMD_LIMITATION_STATUS_RESP frame for a log line or probe report.
std::string esphome::home_io_control::detail::describe_limitation_request (const IoFrame &frame)
 Render a CMD_LIMITATION_STATUS_REQ frame for a log line.

Variables

constexpr float esphome::home_io_control::detail::BINARY_ENTITY_ON_POSITION_THRESHOLD
 Shared 0-100 cutoff: values below this mean binary "on".
constexpr size_t esphome::home_io_control::detail::LIMITATION_TEXT_BUFFER_SIZE = 32
 Buffer size for the limitation fragments below: the longest is "selector (D8 01)" or "0xFD (unlimited)".

Detailed Description

Conversions and renderers shared by the hub and its Home Assistant entities.

Carries no dependency on the hub itself, so an entity can include this header instead of the hub's private helpers (make include-graph enforces that split).

Definition in file entity_helpers.h.