diff --git a/libnymea/devicemanager.cpp b/libnymea/devicemanager.cpp index a4d9340c..6f81c21e 100644 --- a/libnymea/devicemanager.cpp +++ b/libnymea/devicemanager.cpp @@ -1370,6 +1370,7 @@ void DeviceManager::onAutoDevicesAppeared(const DeviceClassId &deviceClassId, co { DeviceClass deviceClass = findDeviceClass(deviceClassId); if (!deviceClass.isValid()) { + qCWarning(dcDeviceManager()) << "Auto device appeared for an unknown DeviceClass. Ignoring..."; return; } diff --git a/plugins/mock/devicepluginmock.cpp b/plugins/mock/devicepluginmock.cpp index 66640ea1..dd419d2e 100644 --- a/plugins/mock/devicepluginmock.cpp +++ b/plugins/mock/devicepluginmock.cpp @@ -130,7 +130,6 @@ DeviceManager::DeviceSetupStatus DevicePluginMock::setupDevice(Device *device) return DeviceManager::DeviceSetupStatusSuccess; } else if (device->deviceClassId() == mockChildDeviceClassId) { qCDebug(dcMockDevice) << "Setup Child mock device" << device->params(); - device->setParentId(DeviceId(device->params().paramValue(mockChildParentUuidParamTypeId).toString())); return DeviceManager::DeviceSetupStatusSuccess; } else if (device->deviceClassId() == mockInputTypeDeviceClassId) { qCDebug(dcMockDevice) << "Setup InputType mock device" << device->params(); @@ -303,14 +302,14 @@ DeviceManager::DeviceError DevicePluginMock::executeAction(Device *device, const } return DeviceManager::DeviceErrorActionTypeNotFound; } else if (device->deviceClassId() == mockParentDeviceClassId) { - if (action.actionTypeId() == mockParentBoolValueParentActionTypeId) { - device->setStateValue(mockParentBoolValueParentStateTypeId, action.param(mockParentBoolValueParentStateParamTypeId).value().toBool()); + if (action.actionTypeId() == mockParentBoolValueActionTypeId) { + device->setStateValue(mockParentBoolValueStateTypeId, action.param(mockParentBoolValueStateParamTypeId).value().toBool()); return DeviceManager::DeviceErrorNoError; } return DeviceManager::DeviceErrorActionTypeNotFound; } else if (device->deviceClassId() == mockChildDeviceClassId) { - if (action.actionTypeId() == mockChildBoolValueParentActionTypeId) { - device->setStateValue(mockChildBoolValueParentStateTypeId, action.param(mockChildBoolValueParentStateParamTypeId).value().toBool()); + if (action.actionTypeId() == mockChildBoolValueActionTypeId) { + device->setStateValue(mockChildBoolValueStateTypeId, action.param(mockChildBoolValueStateParamTypeId).value().toBool()); return DeviceManager::DeviceErrorNoError; } return DeviceManager::DeviceErrorActionTypeNotFound; @@ -458,11 +457,7 @@ void DevicePluginMock::onDisplayPinPairingFinished() void DevicePluginMock::onChildDeviceDiscovered(const DeviceId &parentId) { qCDebug(dcMockDevice) << "Child device discovered for parent" << parentId.toString(); - DeviceDescriptor mockDescriptor(mockChildDeviceClassId, "Child Mock Device (Auto created)"); - ParamList params; - params.append(Param(mockChildParentUuidParamTypeId, parentId)); - mockDescriptor.setParams(params); - + DeviceDescriptor mockDescriptor(mockChildDeviceClassId, "Child Mock Device (Auto created)", "Child Mock Device (Auto created)", parentId); emit autoDevicesAppeared(mockChildDeviceClassId, QList() << mockDescriptor); } diff --git a/plugins/mock/devicepluginmock.json b/plugins/mock/devicepluginmock.json index 27ba6848..216071e5 100644 --- a/plugins/mock/devicepluginmock.json +++ b/plugins/mock/devicepluginmock.json @@ -530,7 +530,7 @@ "stateTypes": [ { "id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0", - "name": "boolValueParent", + "name": "boolValue", "displayName": "bool value", "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value", @@ -545,23 +545,15 @@ "name": "mockChild", "displayName": "Mock Device (Child)", "createMethods": ["auto"], + "paramTypes": [], "basicTags": [ "Device", "Actuator" ], - "paramTypes": [ - { - "id": "104b5288-404e-42d3-bf38-e40682e75681", - "name": "parentUuid", - "displayName": "parent uuid", - "type": "QUuid", - "readOnly": true - } - ], "stateTypes": [ { "id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0", - "name": "boolValueParent", + "name": "boolValue", "displayName": "bool value", "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value",