From 4b9a9d6ae6897fe7be68f114fcc3586e09bc4858 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 9 Dec 2018 18:31:02 +0100 Subject: [PATCH] properly set device parent in tasmota child devices --- tasmota/deviceplugintasmota.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tasmota/deviceplugintasmota.cpp b/tasmota/deviceplugintasmota.cpp index 34d44dfb..bc0e5479 100644 --- a/tasmota/deviceplugintasmota.cpp +++ b/tasmota/deviceplugintasmota.cpp @@ -170,13 +170,14 @@ DeviceManager::DeviceSetupStatus DevicePluginTasmota::setupDevice(Device *device for (int i = 0; i < m_attachedDeviceParamTypeIdMap.value(device->deviceClassId()).count(); i++) { ParamTypeId attachedDeviceParamTypeId = m_attachedDeviceParamTypeIdMap.value(device->deviceClassId()).at(i); if (device->paramValue(attachedDeviceParamTypeId).toString() == "Light") { - DeviceDescriptor descriptor1(tasmotaLightDeviceClassId, device->name() + " CH" + QString::number(i+1), QString(), device->id()); + DeviceDescriptor descriptor(tasmotaLightDeviceClassId, device->name() + " CH" + QString::number(i+1), QString(), device->id()); + descriptor.setParentDeviceId(device->id()); if (m_attachedDeviceParamTypeIdMap.value(device->deviceClassId()).count() == 1) { - descriptor1.setParams(ParamList() << Param(tasmotaLightDeviceChannelNameParamTypeId, "POWER")); + descriptor.setParams(ParamList() << Param(tasmotaLightDeviceChannelNameParamTypeId, "POWER")); } else { - descriptor1.setParams(ParamList() << Param(tasmotaLightDeviceChannelNameParamTypeId, "POWER" + QString::number(i+1))); + descriptor.setParams(ParamList() << Param(tasmotaLightDeviceChannelNameParamTypeId, "POWER" + QString::number(i+1))); } - deviceDescriptors << descriptor1; + deviceDescriptors << descriptor; } } if (!deviceDescriptors.isEmpty()) {