mirror of
https://github.com/esphome/esphome.git
synced 2025-01-05 18:57:43 +01:00
Fixed a but in node discovery
This commit is contained in:
parent
bc14026f96
commit
376cfa12c2
@ -22,6 +22,16 @@ CONF_DISCOVERY = "discovery"
|
|||||||
# A schema for components like sensors
|
# A schema for components like sensors
|
||||||
DUCO_COMPONENT_SCHEMA = cv.Schema({cv.GenerateID(CONF_DUCO_ID): cv.use_id(Duco)})
|
DUCO_COMPONENT_SCHEMA = cv.Schema({cv.GenerateID(CONF_DUCO_ID): cv.use_id(Duco)})
|
||||||
|
|
||||||
|
DISCOVERY_SCHEMA = (
|
||||||
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.GenerateID(): cv.declare_id(DucoDiscovery),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.extend(cv.polling_component_schema("60s"))
|
||||||
|
.extend(DUCO_COMPONENT_SCHEMA)
|
||||||
|
)
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
{
|
{
|
||||||
@ -30,13 +40,7 @@ CONFIG_SCHEMA = (
|
|||||||
CONF_SEND_WAIT_TIME, default="250ms"
|
CONF_SEND_WAIT_TIME, default="250ms"
|
||||||
): cv.positive_time_period_milliseconds,
|
): cv.positive_time_period_milliseconds,
|
||||||
cv.Optional(CONF_DISABLE_CRC, default=False): cv.boolean,
|
cv.Optional(CONF_DISABLE_CRC, default=False): cv.boolean,
|
||||||
cv.Optional(CONF_DISCOVERY): cv.Schema(
|
cv.Optional(CONF_DISCOVERY): DISCOVERY_SCHEMA,
|
||||||
{
|
|
||||||
cv.GenerateID(): cv.declare_id(DucoDiscovery),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.extend(cv.polling_component_schema("60s"))
|
|
||||||
.extend(DUCO_COMPONENT_SCHEMA),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.extend(cv.COMPONENT_SCHEMA)
|
.extend(cv.COMPONENT_SCHEMA)
|
||||||
|
@ -197,8 +197,9 @@ const std::string friendly_node_type(uint8_t type_code) {
|
|||||||
|
|
||||||
void DucoDiscovery::update() {
|
void DucoDiscovery::update() {
|
||||||
// display all found nodes
|
// display all found nodes
|
||||||
|
ESP_LOGI(TAG, "Discovered nodes:");
|
||||||
for (auto &node : nodes_) {
|
for (auto &node : nodes_) {
|
||||||
ESP_LOGI(TAG, "Node %d: type %d (%s)", std::get<0>(node), std::get<1>(node),
|
ESP_LOGI(TAG, " Node %d: type %d (%s)", std::get<0>(node), std::get<1>(node),
|
||||||
friendly_node_type(std::get<1>(node)).c_str());
|
friendly_node_type(std::get<1>(node)).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +226,7 @@ void DucoDiscovery::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DucoDiscovery::receive_response(DucoMessage message) {
|
void DucoDiscovery::receive_response(DucoMessage message) {
|
||||||
if (message.id == 0x0e) {
|
if (message.function == 0x0e) {
|
||||||
ESP_LOGV(TAG, "Discovery response message: %s", format_hex_pretty(message).c_str());
|
ESP_LOGV(TAG, "Discovery response message: %s", format_hex_pretty(message).c_str());
|
||||||
this->parent_->stop_waiting(message.id);
|
this->parent_->stop_waiting(message.id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user