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

Hub-level management actions such as device rename, identify, and force-open. More...

#include "management_actions.h"
#include "hub_core.h"
#include "log_helpers.h"
#include "proto_commands.h"
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include <algorithm>
#include <array>
#include <cctype>
#include <cerrno>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <limits>
#include <map>
#include <span>
#include <vector>
Include dependency graph for management_actions.cpp:

Go to the source code of this file.

Classes

struct  esphome::home_io_control::HeatingNamedValue
 A value token that maps to a fixed float (used by set_mode / set_presence / set_window). More...
struct  esphome::home_io_control::ScanState
 Accumulated state for one scan_paired_devices() call, threaded through every attempt. More...
struct  esphome::home_io_control::RollCallAttemptContext
 Per-attempt facts a roll-call reply's DEBUG line needs, kept in one small struct so the reply lambda's capture list stays a couple of pointers rather than growing one field at a time. More...

Namespaces

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

Enumerations

enum class  esphome::home_io_control::ScanAddResult : uint8_t { esphome::home_io_control::ADDED , esphome::home_io_control::DUPLICATE , esphome::home_io_control::FULL }
 Outcome of add_scan_responder(), so callers can tell a harmless repeat from real loss. More...
enum class  esphome::home_io_control::RollCallAttemptResult : uint8_t { esphome::home_io_control::OK , esphome::home_io_control::BUILD_FAILED }
 Outcome of run_roll_call_attempt(), so the sweep loop can surface a build failure the same way scan_paired_devices() always has. More...

Functions

static std::string esphome::home_io_control::normalize_device_id_argument (const std::string &device_id)
static std::string esphome::home_io_control::bool_to_string (bool value)
static std::string esphome::home_io_control::format_hex_byte (uint8_t value)
 Format a byte as two uppercase hex digits, no prefix.
static ManagementActionResult esphome::home_io_control::make_management_result (const std::string &action, const std::string &device_id)
static bool esphome::home_io_control::apply_error_response (const IoFrame &response, ManagementActionResult &result)
 Decode a CMD_ERROR_RESP frame's result code into result.
static bool esphome::home_io_control::parse_probe_index (const std::string &text, uint8_t &out)
 Parse a probe_device()/probe_sweep() index argument into a byte.
static std::string esphome::home_io_control::normalize_lower_argument (const std::string &value)
 Lowercase + ASCII-trim a native-API string argument.
static bool esphome::home_io_control::match_heating_named_value (const std::string &token, const HeatingNamedValue *table, size_t table_len, float &out)
 Match token against table; on a hit set out and return true.
static bool esphome::home_io_control::parse_heating_temperature (const std::string &value, float &value_out, std::string &error)
 Parse set_temperature's value into degrees Celsius, range-checked.
static bool esphome::home_io_control::parse_heating_arguments (const std::string &function, const std::string &value, HeatingFunction &fn_out, float &value_out, std::string &error)
 Parse the (function, value) argument pair of the heating_control action.
static std::string esphome::home_io_control::format_scan_reply_line (const ScanResponder &responder, const std::string &device_id, const IoDevice *registered)
 Format one roll-call responder's report line(s).
static ScanAddResult esphome::home_io_control::add_scan_responder (ScanResponder *responders, uint8_t &count, uint8_t capacity, const IoFrame &frame, int16_t rssi_dbm, const ScanResponder *&entry)
 Record a responder unless its address is already present.
static uint8_t esphome::home_io_control::count_enabled_passes (ScanPowerClasses selection)
 How many of ROLL_CALL_PASSES selection actually calls.
static void esphome::home_io_control::record_roll_call_reply (ScanState &state, const RollCallAttemptContext &ctx, const IoFrame &frame, const ExchangeEngine::BroadcastReplyInfo &info)
 Record one accepted roll-call reply into the scan state, and log it.
static RollCallAttemptResult esphome::home_io_control::run_roll_call_attempt (ExchangeEngine &engine, const uint8_t *node_id, const uint8_t *system_key, const TuningConfig &tuning, const RollCallPass &pass, uint32_t tx_freq_hz, uint8_t attempt, uint8_t total_attempts, ScanState &state)
 Transmit one roll-call attempt and collect its replies into state.
static std::string esphome::home_io_control::build_scan_report (const ScanState &state, DeviceRegistry &registry, ScanPowerClasses selection)
 Build the final report: known/unknown grouping, header, the selection NOTE, and the truncation NOTE.

Detailed Description

Hub-level management actions such as device rename, identify, and force-open.

This file owns advanced management operations that are not part of the normal entity surface. Operations are exposed as ESPHome native API actions so Home Assistant can trigger them without adding always-visible helper entities. All actions share one API service descriptor (detail::ManagementServiceDescriptor); adding a new action is a registration call, not a new descriptor class.

Definition in file management_actions.cpp.