diff --git a/libnymea-app/thingmanager.cpp b/libnymea-app/thingmanager.cpp index f9fba10d..58f892de 100644 --- a/libnymea-app/thingmanager.cpp +++ b/libnymea-app/thingmanager.cpp @@ -299,7 +299,7 @@ void ThingManager::getPluginConfigResponse(int /*commandId*/, const QVariantMap void ThingManager::getThingsResponse(int /*commandId*/, const QVariantMap ¶ms) { -// qDebug() << "Things received:" << params; +// qCritical() << "Things received:" << qUtf8Printable(QJsonDocument::fromVariant(params).toJson(QJsonDocument::Indented)); if (params.keys().contains("things")) { QVariantList thingsList = params.value("things").toList(); foreach (QVariant thingVariant, thingsList) { diff --git a/libnymea-app/types/thing.cpp b/libnymea-app/types/thing.cpp index 1e0e5f21..25961141 100644 --- a/libnymea-app/types/thing.cpp +++ b/libnymea-app/types/thing.cpp @@ -235,6 +235,7 @@ int Thing::executeAction(const QString &actionName, const QVariantList ¶ms) } finalParams.append(param); } +// qCritical() << "Executing action" << finalParams; int commandId = m_thingManager->executeAction(m_id, actionType->id(), finalParams); m_pendingActions.append(commandId); return commandId; diff --git a/nymea-app/ui/customviews/ThermostatController.qml b/nymea-app/ui/customviews/ThermostatController.qml index d32a8364..5aa6dbdc 100644 --- a/nymea-app/ui/customviews/ThermostatController.qml +++ b/nymea-app/ui/customviews/ThermostatController.qml @@ -40,14 +40,14 @@ Item { property int startAngle: 135 property int maxAngle: 270 - property int steps: roundToPrecision(root.targetTemperatureStateType.maxValue - root.targetTemperatureStateType.minValue) * (1/root.precision) - property double stepSize: (root.targetTemperatureStateType.maxValue - root.targetTemperatureStateType.minValue) / steps + property int steps: roundToPrecision(root.targetTemperatureState.maxValue - root.targetTemperatureState.minValue) * (1/root.precision) + property double stepSize: (root.targetTemperatureState.maxValue - root.targetTemperatureState.minValue) / steps property double anglePerStep: maxAngle / steps function angleToValue(angle) { - var from = root.targetTemperatureStateType.minValue - var to = root.targetTemperatureStateType.maxValue + var from = root.targetTemperatureState.minValue + var to = root.targetTemperatureState.maxValue return (to - from) * angle / maxAngle + from } @@ -77,10 +77,10 @@ Item { // Step lines var currentValue = actionQueue.pendingValue || root.targetTemperatureState.value - var targetTempStep = roundToPrecision(currentValue - root.targetTemperatureStateType.minValue) * (1/root.precision) + var targetTempStep = roundToPrecision(currentValue - root.targetTemperatureState.minValue) * (1/root.precision) var currentTempStep; if (root.temperatureState) { - currentTempStep = roundToPrecision(root.temperatureState.value - root.targetTemperatureStateType.minValue) * (1/root.precision) + currentTempStep = roundToPrecision(root.temperatureState.value - root.targetTemperatureState.minValue) * (1/root.precision) } for(var step = 0; step < steps; step += root.precision) { @@ -207,9 +207,10 @@ Item { var valueDiff = angleDiff / canvas.anglePerStep * canvas.stepSize valueDiff = canvas.roundToPrecision(valueDiff) if (Math.abs(valueDiff) > 0) { - var currentValue = actionQueue.pendingValue || root.targetTemperatureState.value + var currentValue = actionQueue.pendingValue ? actionQueue.pendingValue : root.targetTemperatureState.value var newValue = currentValue + valueDiff - newValue = Math.min(root.targetTemperatureStateType.maxValue, Math.max(root.targetTemperatureStateType.minValue, newValue)) + newValue = Math.min(root.targetTemperatureState.maxValue, Math.max(root.targetTemperatureState.minValue, newValue)) + print("newValue:", newValue, "current:", currentValue, "diff:", valueDiff, root.targetTemperatureState.minValue) if (currentValue !== newValue) { actionQueue.sendValue(newValue) } diff --git a/nymea-app/ui/utils/ActionQueue.qml b/nymea-app/ui/utils/ActionQueue.qml index e9a2ad19..ccd61b23 100644 --- a/nymea-app/ui/utils/ActionQueue.qml +++ b/nymea-app/ui/utils/ActionQueue.qml @@ -19,6 +19,7 @@ Item { return; } d.pendingValue = value; +// print("sending action", value) var stateName = root.stateType == null ? root.stateName : root.stateType.name d.pendingCommand = root.thing.executeAction(stateName, [{ @@ -39,6 +40,7 @@ Item { target: root.thing onExecuteActionReply: { if (d.pendingCommand == commandId) { +// print("command finished") d.pendingCommand = -1; if (d.queuedValue != null) { root.sendValue(d.queuedValue)