Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
tuning_entities.cpp
Go to the documentation of this file.
1
/// @file tuning_entities.cpp
2
/// @brief Home Assistant `number` and `select` tuning entity implementations.
3
/// @ingroup hioc_tuning
4
5
#include "
tuning_entities.h
"
6
#include "
hub_core.h
"
7
8
namespace
esphome
{
9
namespace
home_io_control
{
10
11
void
IOHomeTuningNumber::setup
() {
12
if
(this->
parent_
!=
nullptr
)
13
this->publish_state(this->
parent_
->
get_tuning_number_value
(this->param_name_));
14
}
15
16
void
IOHomeTuningSelect::setup
() {
17
if
(this->
parent_
==
nullptr
)
18
return
;
19
const
std::string value = this->
parent_
->
get_tuning_select_value
(this->
param_name_
);
20
if
(!value.empty())
21
this->publish_state(value);
22
}
23
24
void
IOHomeTuningNumber::control
(
float
value) {
25
this->publish_state(value);
26
if
(this->
parent_
!=
nullptr
)
27
this->
parent_
->
update_tuning_number
(this->
param_name_
, value);
28
}
29
30
void
IOHomeTuningSelect::control
(
const
std::string &value) {
31
this->publish_state(value);
32
if
(this->
parent_
!=
nullptr
)
33
this->
parent_
->
update_tuning_select
(this->
param_name_
, value);
34
}
35
36
}
// namespace home_io_control
37
}
// namespace esphome
esphome::home_io_control::IOHomeControlComponent::update_tuning_select
void update_tuning_select(const std::string &name, const std::string &value)
Receive a select tuning update from a HA select entity.
Definition
hub_core.cpp:240
esphome::home_io_control::IOHomeControlComponent::update_tuning_number
void update_tuning_number(const std::string &name, float value)
Receive a numeric tuning update from a HA number entity.
Definition
hub_core.cpp:223
esphome::home_io_control::IOHomeControlComponent::get_tuning_number_value
float get_tuning_number_value(const std::string &name) const
Current value of a numeric tuning parameter, used to seed a HA number entity on boot.
Definition
hub_core.cpp:258
esphome::home_io_control::IOHomeControlComponent::get_tuning_select_value
std::string get_tuning_select_value(const std::string &name) const
Current option string of a select tuning parameter, used to seed a HA select entity on boot.
Definition
hub_core.cpp:273
esphome::home_io_control::IOHomeTuningNumber::setup
void setup() override
Publish the current tuning value so the HA slider reflects the active configuration on boot.
Definition
tuning_entities.cpp:11
esphome::home_io_control::IOHomeTuningNumber::parent_
IOHomeControlComponent * parent_
Definition
tuning_entities.h:47
esphome::home_io_control::IOHomeTuningNumber::control
void control(float value) override
Called by ESPHome when the user changes the slider value in HA.
Definition
tuning_entities.cpp:24
esphome::home_io_control::IOHomeTuningNumber::param_name_
std::string param_name_
Definition
tuning_entities.h:48
esphome::home_io_control::IOHomeTuningSelect::control
void control(const std::string &value) override
Called by ESPHome when the user selects a new option in HA.
Definition
tuning_entities.cpp:30
esphome::home_io_control::IOHomeTuningSelect::parent_
IOHomeControlComponent * parent_
Definition
tuning_entities.h:73
esphome::home_io_control::IOHomeTuningSelect::setup
void setup() override
Publish the current tuning option so the HA dropdown reflects the active configuration on boot.
Definition
tuning_entities.cpp:16
esphome::home_io_control::IOHomeTuningSelect::param_name_
std::string param_name_
Definition
tuning_entities.h:74
hub_core.h
IO-Homecontrol ESPHome component — protocol controller.
esphome::home_io_control
Definition
device_registry.cpp:13
esphome
Definition
device_registry.cpp:12
tuning_entities.h
Home Assistant number and select entities that control runtime tuning parameters.
components
home_io_control
tuning_entities.cpp
Generated by
1.18.0