Set parent of components directly

This commit is contained in:
Pieter Kokx 2024-11-16 16:38:22 +01:00
parent ab65500420
commit 4d535838e4
No known key found for this signature in database
GPG Key ID: BD73BAB527D54451
4 changed files with 2 additions and 6 deletions

View File

@ -189,7 +189,5 @@ void Duco::debug_hex(std::vector<uint8_t> bytes, uint8_t separator) {
delay(10);
}
void Duco::add_sensor_item(DucoDevice *sensor) { sensor->set_parent(this); }
} // namespace duco
} // namespace esphome

View File

@ -29,8 +29,6 @@ class Duco : public uart::UARTDevice, public Component {
void set_send_wait_time(uint16_t time_in_ms) { send_wait_time_ = time_in_ms; }
void set_disable_crc(bool disable_crc) { disable_crc_ = disable_crc; }
void add_sensor_item(DucoDevice *sensor);
std::map<uint8_t, DucoDevice *> waiting_for_response;
void stop_waiting(uint8_t message_id);

View File

@ -44,4 +44,4 @@ async def to_code(config):
await select.register_select(var, config, options=DUCO_MODE_OPTIONS)
parent = await cg.get_variable(config[CONF_DUCO_ID])
cg.add(parent.add_sensor_item(var))
cg.add(var.set_parent(parent))

View File

@ -27,4 +27,4 @@ async def to_code(config):
await text_sensor.register_text_sensor(var, config)
parent = await cg.get_variable(config[CONF_DUCO_ID])
cg.add(parent.add_sensor_item(var))
cg.add(var.set_parent(parent))