Update simple heat pump to power interface

master
Simon Stürz 2021-11-16 14:48:59 +01:00
parent 693db4a23c
commit b343bb4ced
2 changed files with 10 additions and 10 deletions

View File

@ -69,7 +69,7 @@ void IntegrationPluginSimpleHeatpump::setupThing(ThingSetupInfo *info)
} }
int gpioNumber = thing->paramValue(simpleHeatPumpInterfaceThingGpioNumberParamTypeId).toInt(); int gpioNumber = thing->paramValue(simpleHeatPumpInterfaceThingGpioNumberParamTypeId).toInt();
bool initialValue = thing->stateValue(simpleHeatPumpInterfaceBoostStateTypeId).toBool(); bool initialValue = thing->stateValue(simpleHeatPumpInterfacePowerStateTypeId).toBool();
if (gpioNumber < 0) { if (gpioNumber < 0) {
qCWarning(dcSimpleHeatPump()) << "Invalid GPIO number" << gpioNumber; qCWarning(dcSimpleHeatPump()) << "Invalid GPIO number" << gpioNumber;
@ -126,15 +126,15 @@ void IntegrationPluginSimpleHeatpump::executeAction(ThingActionInfo *info)
return; return;
} }
if (info->action().actionTypeId() == simpleHeatPumpInterfaceBoostActionTypeId) { if (info->action().actionTypeId() == simpleHeatPumpInterfacePowerActionTypeId) {
bool boostEnabled = info->action().paramValue(simpleHeatPumpInterfaceBoostActionBoostParamTypeId).toBool(); bool heatPumpEnabled = info->action().paramValue(simpleHeatPumpInterfacePowerActionPowerParamTypeId).toBool();
if (!gpio->setValue(boostEnabled ? Gpio::ValueHigh : Gpio::ValueLow)) { if (!gpio->setValue(heatPumpEnabled ? Gpio::ValueHigh : Gpio::ValueLow)) {
qCWarning(dcSimpleHeatPump()) << "Failed to set the boost mode for" << thing << "to" << boostEnabled; qCWarning(dcSimpleHeatPump()) << "Failed to set the power for" << thing << "to" << heatPumpEnabled;
info->finish(Thing::ThingErrorHardwareFailure); info->finish(Thing::ThingErrorHardwareFailure);
return; return;
} }
thing->setStateValue(simpleHeatPumpInterfaceBoostStateTypeId, boostEnabled); thing->setStateValue(simpleHeatPumpInterfacePowerStateTypeId, heatPumpEnabled);
info->finish(Thing::ThingErrorNoError); info->finish(Thing::ThingErrorNoError);
} }
} }

View File

@ -28,10 +28,10 @@
"stateTypes": [ "stateTypes": [
{ {
"id": "f8bccedf-5eb2-49a0-b892-c398dbd6a18d", "id": "f8bccedf-5eb2-49a0-b892-c398dbd6a18d",
"name": "boost", "name": "power",
"displayName": "Boost production enabled", "displayName": "Heat pump enabled",
"displayNameEvent": "Boost production changed", "displayNameEvent": "Heat pump power changed",
"displayNameAction": "Boost production", "displayNameAction": "Enable/Disable heat pump power",
"type": "bool", "type": "bool",
"writable": true, "writable": true,
"defaultValue": false, "defaultValue": false,