From b343bb4ced62e2eb2ffff19f0f83009fbf67a041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 16 Nov 2021 14:48:59 +0100 Subject: [PATCH] Update simple heat pump to power interface --- simpleheatpump/integrationpluginsimpleheatpump.cpp | 12 ++++++------ simpleheatpump/integrationpluginsimpleheatpump.json | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/simpleheatpump/integrationpluginsimpleheatpump.cpp b/simpleheatpump/integrationpluginsimpleheatpump.cpp index 048e1881..442a1c13 100644 --- a/simpleheatpump/integrationpluginsimpleheatpump.cpp +++ b/simpleheatpump/integrationpluginsimpleheatpump.cpp @@ -69,7 +69,7 @@ void IntegrationPluginSimpleHeatpump::setupThing(ThingSetupInfo *info) } int gpioNumber = thing->paramValue(simpleHeatPumpInterfaceThingGpioNumberParamTypeId).toInt(); - bool initialValue = thing->stateValue(simpleHeatPumpInterfaceBoostStateTypeId).toBool(); + bool initialValue = thing->stateValue(simpleHeatPumpInterfacePowerStateTypeId).toBool(); if (gpioNumber < 0) { qCWarning(dcSimpleHeatPump()) << "Invalid GPIO number" << gpioNumber; @@ -126,15 +126,15 @@ void IntegrationPluginSimpleHeatpump::executeAction(ThingActionInfo *info) return; } - if (info->action().actionTypeId() == simpleHeatPumpInterfaceBoostActionTypeId) { - bool boostEnabled = info->action().paramValue(simpleHeatPumpInterfaceBoostActionBoostParamTypeId).toBool(); - if (!gpio->setValue(boostEnabled ? Gpio::ValueHigh : Gpio::ValueLow)) { - qCWarning(dcSimpleHeatPump()) << "Failed to set the boost mode for" << thing << "to" << boostEnabled; + if (info->action().actionTypeId() == simpleHeatPumpInterfacePowerActionTypeId) { + bool heatPumpEnabled = info->action().paramValue(simpleHeatPumpInterfacePowerActionPowerParamTypeId).toBool(); + if (!gpio->setValue(heatPumpEnabled ? Gpio::ValueHigh : Gpio::ValueLow)) { + qCWarning(dcSimpleHeatPump()) << "Failed to set the power for" << thing << "to" << heatPumpEnabled; info->finish(Thing::ThingErrorHardwareFailure); return; } - thing->setStateValue(simpleHeatPumpInterfaceBoostStateTypeId, boostEnabled); + thing->setStateValue(simpleHeatPumpInterfacePowerStateTypeId, heatPumpEnabled); info->finish(Thing::ThingErrorNoError); } } diff --git a/simpleheatpump/integrationpluginsimpleheatpump.json b/simpleheatpump/integrationpluginsimpleheatpump.json index ebcccf6f..ede890ae 100644 --- a/simpleheatpump/integrationpluginsimpleheatpump.json +++ b/simpleheatpump/integrationpluginsimpleheatpump.json @@ -28,10 +28,10 @@ "stateTypes": [ { "id": "f8bccedf-5eb2-49a0-b892-c398dbd6a18d", - "name": "boost", - "displayName": "Boost production enabled", - "displayNameEvent": "Boost production changed", - "displayNameAction": "Boost production", + "name": "power", + "displayName": "Heat pump enabled", + "displayNameEvent": "Heat pump power changed", + "displayNameAction": "Enable/Disable heat pump power", "type": "bool", "writable": true, "defaultValue": false,