Merge PR #496: GenericThings: add minimal charging current for generic car.
commit
075d7152f3
|
|
@ -277,8 +277,24 @@ void IntegrationPluginGenericThings::setupThing(ThingSetupInfo *info)
|
||||||
thing->setStateValue(batteryBatteryCriticalStateTypeId, currentBatteryLevel <= value.toInt());
|
thing->setStateValue(batteryBatteryCriticalStateTypeId, currentBatteryLevel <= value.toInt());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (thing->thingClassId() == carThingClassId) {
|
||||||
|
// Set the min charging current state if the settings value changed
|
||||||
|
connect(thing, &Thing::settingChanged, this, [thing](const ParamTypeId ¶mTypeId, const QVariant &value){
|
||||||
|
if (paramTypeId == carSettingsMinChargingCurrentParamTypeId) {
|
||||||
|
qCDebug(dcGenericThings()) << "Car minimum charging current settings changed" << value.toUInt() << "A";
|
||||||
|
thing->setStateValue(carMinChargingCurrentStateTypeId, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Finish the setup
|
||||||
|
info->finish(Thing::ThingErrorNoError);
|
||||||
|
|
||||||
|
// Set the inital state value
|
||||||
|
thing->setStateValue(carMinChargingCurrentStateTypeId, thing->setting(carSettingsMinChargingCurrentParamTypeId));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fall trough, if not already finished and returned...
|
||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1845,6 +1845,18 @@
|
||||||
"displayName": "Generic electric car",
|
"displayName": "Generic electric car",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["user"],
|
||||||
"interfaces": ["electricvehicle"],
|
"interfaces": ["electricvehicle"],
|
||||||
|
"settingsTypes": [
|
||||||
|
{
|
||||||
|
"id": "0c55516d-4285-4d02-8926-1dae03649e18",
|
||||||
|
"name": "minChargingCurrent",
|
||||||
|
"displayName": "Minimum charging current",
|
||||||
|
"type": "uint",
|
||||||
|
"unit": "Ampere",
|
||||||
|
"minValue": 6,
|
||||||
|
"maxValue": 16,
|
||||||
|
"defaultValue": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
"stateTypes": [
|
"stateTypes": [
|
||||||
{
|
{
|
||||||
"id": "363a2a39-61b6-4109-9cd9-aca7367d12c7",
|
"id": "363a2a39-61b6-4109-9cd9-aca7367d12c7",
|
||||||
|
|
@ -1877,6 +1889,17 @@
|
||||||
"minValue": 0,
|
"minValue": 0,
|
||||||
"maxValue": 100,
|
"maxValue": 100,
|
||||||
"defaultValue": 100
|
"defaultValue": 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "20faf2b8-2b40-4bee-b228-97dbaf0cdffc",
|
||||||
|
"name": "minChargingCurrent",
|
||||||
|
"displayName": "Minimum charging current",
|
||||||
|
"displayNameEvent": "Minimum charging current changed",
|
||||||
|
"type": "uint",
|
||||||
|
"unit": "Ampere",
|
||||||
|
"minValue": 6,
|
||||||
|
"maxValue": 16,
|
||||||
|
"defaultValue": 6
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue