fixed event parsing
This commit is contained in:
parent
38517a24d8
commit
eaf4e87c7a
@ -485,6 +485,27 @@ QUuid HomeConnect::startProgram(const QString &haId, const QString &programKey,
|
|||||||
return commandId;
|
return commandId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUuid HomeConnect::stopProgram(const QString &haId)
|
||||||
|
{
|
||||||
|
QUuid commandId = QUuid::createUuid();
|
||||||
|
QUrl url = QUrl(m_baseControlUrl+"/api/homeappliances/"+haId+"/programs/active");
|
||||||
|
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
request.setRawHeader("Authorization", "Bearer "+m_accessToken);
|
||||||
|
request.setRawHeader("Accept-Language", "en-US");
|
||||||
|
request.setRawHeader("accept", "application/vnd.bsh.sdk.v1+json");
|
||||||
|
|
||||||
|
QNetworkReply *reply = m_networkManager->deleteResource(request);
|
||||||
|
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
||||||
|
connect(reply, &QNetworkReply::finished, this, [this, commandId, reply]{
|
||||||
|
|
||||||
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
QByteArray rawData = reply->readAll();
|
||||||
|
emit commandExecuted(commandId, checkStatusCode(status, rawData));
|
||||||
|
});
|
||||||
|
return commandId;
|
||||||
|
}
|
||||||
|
|
||||||
void HomeConnect::getStatus(const QString &haid)
|
void HomeConnect::getStatus(const QString &haid)
|
||||||
{
|
{
|
||||||
QUrl url = QUrl(m_baseControlUrl+"/api/homeappliances/"+haid+"/status");
|
QUrl url = QUrl(m_baseControlUrl+"/api/homeappliances/"+haid+"/status");
|
||||||
@ -566,19 +587,16 @@ void HomeConnect::connectEventStream()
|
|||||||
});
|
});
|
||||||
connect(reply, &QNetworkReply::readyRead, this, [this, reply]{
|
connect(reply, &QNetworkReply::readyRead, this, [this, reply]{
|
||||||
|
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
while (reply->canReadLine()) {
|
||||||
QByteArrayList rawData = reply->readAll().split('\n');
|
|
||||||
QJsonDocument data;
|
QJsonDocument data;
|
||||||
QString haId;
|
QString haId;
|
||||||
EventType eventType;
|
EventType eventType;
|
||||||
Q_FOREACH(QByteArray line, rawData) {
|
|
||||||
if (line.startsWith("data")) {
|
QByteArray eventTypeLine = reply->readLine();
|
||||||
if (checkStatusCode(status, line.remove(0,6)))
|
if (eventTypeLine == "\n")
|
||||||
data = QJsonDocument::fromJson(line);
|
continue;
|
||||||
} else if (line.startsWith("id")) {
|
if (eventTypeLine.startsWith("event")) {
|
||||||
haId = line.split(':').last().trimmed();
|
QString eventString = eventTypeLine.split(':').last().trimmed();
|
||||||
} else if (line.startsWith("event")) {
|
|
||||||
QString eventString = line.split(':').last().trimmed();
|
|
||||||
if (eventString == "KEEP-ALIVE") {
|
if (eventString == "KEEP-ALIVE") {
|
||||||
eventType = EventTypeKeepAlive;
|
eventType = EventTypeKeepAlive;
|
||||||
} else if (eventString == "STATUS") {
|
} else if (eventString == "STATUS") {
|
||||||
@ -599,7 +617,24 @@ void HomeConnect::connectEventStream()
|
|||||||
qCWarning(dcHomeConnect()) << "Unhandled event type" << eventString;
|
qCWarning(dcHomeConnect()) << "Unhandled event type" << eventString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QByteArray dataLine = reply->readLine();
|
||||||
|
if (dataLine.startsWith("data")) {
|
||||||
|
data = QJsonDocument::fromJson(dataLine.remove(0,6));
|
||||||
|
|
||||||
|
QByteArray idLine = reply->readLine();
|
||||||
|
if (idLine.startsWith("id")) {
|
||||||
|
haId = idLine.split(':').last().trimmed();
|
||||||
|
} else {
|
||||||
|
qCWarning(dcHomeConnect()) << "Id line: Unexpected line" << eventTypeLine;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
qCWarning(dcHomeConnect()) << "Data Line: Unexpected line" << eventTypeLine;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCWarning(dcHomeConnect()) << "Event type: Unexpected line" << eventTypeLine;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.toVariant().toMap().contains("items")) {
|
if (data.toVariant().toMap().contains("items")) {
|
||||||
@ -621,6 +656,7 @@ void HomeConnect::connectEventStream()
|
|||||||
} else if (data.toVariant().toMap().contains("error")) {
|
} else if (data.toVariant().toMap().contains("error")) {
|
||||||
qCWarning(dcHomeConnect()) << "Event stream error" << data.toVariant().toMap().value("error");
|
qCWarning(dcHomeConnect()) << "Event stream error" << data.toVariant().toMap().value("error");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,7 @@ public:
|
|||||||
void getProgramsSelected(const QString &haId); //Get the program which is currently selected
|
void getProgramsSelected(const QString &haId); //Get the program which is currently selected
|
||||||
void getProgramsActiveOption(const QString &haId, const QString &optionKey);
|
void getProgramsActiveOption(const QString &haId, const QString &optionKey);
|
||||||
QUuid startProgram(const QString &haId, const QString &programKey, QList<Option> options);
|
QUuid startProgram(const QString &haId, const QString &programKey, QList<Option> options);
|
||||||
|
QUuid stopProgram(const QString &haId);
|
||||||
|
|
||||||
// STATUS EVENTS
|
// STATUS EVENTS
|
||||||
void getStatus(const QString &haid);
|
void getStatus(const QString &haid);
|
||||||
|
|||||||
@ -62,34 +62,20 @@ IntegrationPluginHomeConnect::IntegrationPluginHomeConnect()
|
|||||||
m_connectedStateTypeIds.insert(hoodThingClassId, hoodConnectedStateTypeId);
|
m_connectedStateTypeIds.insert(hoodThingClassId, hoodConnectedStateTypeId);
|
||||||
|
|
||||||
m_localControlStateTypeIds.insert(ovenThingClassId, ovenLocalControlStateStateTypeId);
|
m_localControlStateTypeIds.insert(ovenThingClassId, ovenLocalControlStateStateTypeId);
|
||||||
//m_localControlStateTypeIds.insert(fridgeThingClassId, fridgeLocalControlStateStateTypeId);
|
m_localControlStateTypeIds.insert(dryerThingClassId, dryerLocalControlStateStateTypeId);
|
||||||
//m_localControlStateTypeIds.insert(dryerThingClassId, dryerLocalControlStateTypeId);
|
|
||||||
m_localControlStateTypeIds.insert(coffeeMakerThingClassId, coffeeMakerLocalControlStateStateTypeId);
|
m_localControlStateTypeIds.insert(coffeeMakerThingClassId, coffeeMakerLocalControlStateStateTypeId);
|
||||||
//m_localControlStateTypeIds.insert(dishwasherThingClassId, dishwasherLocalControlStateStateTypeId);
|
|
||||||
m_localControlStateTypeIds.insert(washerThingClassId, washerLocalControlStateStateTypeId);
|
m_localControlStateTypeIds.insert(washerThingClassId, washerLocalControlStateStateTypeId);
|
||||||
//m_localControlStateTypeIds.insert(cookTopThingClassId, cookTopLocalControlStateStateTypeId);
|
|
||||||
//m_localControlStateTypeIds.insert(cleaningRobotThingClassId, cleaningRobotLocalControlStateStateTypeId);
|
|
||||||
//m_localControlStateTypeIds.insert(hoodThingClassId, hoodLocalControlStateStateTypeId);
|
|
||||||
|
|
||||||
m_remoteStartAllowanceStateTypeIds.insert(ovenThingClassId, ovenRemoteStartAllowanceStateStateTypeId);
|
m_remoteStartAllowanceStateTypeIds.insert(ovenThingClassId, ovenRemoteStartAllowanceStateStateTypeId);
|
||||||
//m_remoteStartAllowanceStateTypeIds.insert(fridgeThingClassId, fridgeRemoteStartAllowanceStateStateTypeId);
|
|
||||||
m_remoteStartAllowanceStateTypeIds.insert(dryerThingClassId, dryerRemoteStartAllowanceStateStateTypeId);
|
m_remoteStartAllowanceStateTypeIds.insert(dryerThingClassId, dryerRemoteStartAllowanceStateStateTypeId);
|
||||||
m_remoteStartAllowanceStateTypeIds.insert(coffeeMakerThingClassId, coffeeMakerRemoteStartAllowanceStateStateTypeId);
|
m_remoteStartAllowanceStateTypeIds.insert(coffeeMakerThingClassId, coffeeMakerRemoteStartAllowanceStateStateTypeId);
|
||||||
m_remoteStartAllowanceStateTypeIds.insert(dishwasherThingClassId, dishwasherRemoteStartAllowanceStateStateTypeId);
|
m_remoteStartAllowanceStateTypeIds.insert(dishwasherThingClassId, dishwasherRemoteStartAllowanceStateStateTypeId);
|
||||||
m_remoteStartAllowanceStateTypeIds.insert(washerThingClassId, washerRemoteStartAllowanceStateStateTypeId);
|
m_remoteStartAllowanceStateTypeIds.insert(washerThingClassId, washerRemoteStartAllowanceStateStateTypeId);
|
||||||
//m_remoteStartAllowanceStateTypeIds.insert(cookTopThingClassId, cookTopRemoteStartAllowanceStateStateTypeId);
|
|
||||||
//m_remoteStartAllowanceStateTypeIds.insert(cleaningRobotThingClassId, cleaningRobotRemoteStartAllowanceStateStateTypeId);
|
|
||||||
//m_remoteStartAllowanceStateTypeIds.insert(hoodThingClassId, hoodRemoteStartAllowanceStateStateTypeId);
|
|
||||||
|
|
||||||
m_remoteControlActivationStateTypeIds.insert(ovenThingClassId, ovenRemoteControlActivationStateStateTypeId);
|
m_remoteControlActivationStateTypeIds.insert(ovenThingClassId, ovenRemoteControlActivationStateStateTypeId);
|
||||||
//m_remoteControlActivationStateTypeIds.insert(fridgeThingClassId, fridgeRemoteControlActivationStateStateTypeId);
|
|
||||||
m_remoteControlActivationStateTypeIds.insert(dryerThingClassId, dryerRemoteControlActivationStateStateTypeId);
|
m_remoteControlActivationStateTypeIds.insert(dryerThingClassId, dryerRemoteControlActivationStateStateTypeId);
|
||||||
//m_remoteControlActivationStateTypeIds.insert(coffeeMakerThingClassId, coffeeMakerRemoteControlActivationStateStateTypeId);
|
|
||||||
m_remoteControlActivationStateTypeIds.insert(dishwasherThingClassId, dishwasherRemoteControlActivationStateStateTypeId);
|
m_remoteControlActivationStateTypeIds.insert(dishwasherThingClassId, dishwasherRemoteControlActivationStateStateTypeId);
|
||||||
m_remoteControlActivationStateTypeIds.insert(washerThingClassId, washerRemoteControlActivationStateStateTypeId);
|
m_remoteControlActivationStateTypeIds.insert(washerThingClassId, washerRemoteControlActivationStateStateTypeId);
|
||||||
//m_remoteControlActivationStateTypeIds.insert(cookTopThingClassId, cookTopRemoteControlActivationStateStateTypeId);
|
|
||||||
//m_remoteControlActivationStateTypeIds.insert(cleaningRobotThingClassId, cleaningRobotRemoteControlActivationStateStateTypeId);
|
|
||||||
//m_remoteControlActivationStateTypeIds.insert(hoodThingClassId, hoodRemoteControlActivationStateStateTypeId);
|
|
||||||
|
|
||||||
m_doorStateTypeIds.insert(dishwasherThingClassId, dishwasherDoorStateStateTypeId);
|
m_doorStateTypeIds.insert(dishwasherThingClassId, dishwasherDoorStateStateTypeId);
|
||||||
m_doorStateTypeIds.insert(washerThingClassId, washerDoorStateStateTypeId);
|
m_doorStateTypeIds.insert(washerThingClassId, washerDoorStateStateTypeId);
|
||||||
@ -116,8 +102,15 @@ IntegrationPluginHomeConnect::IntegrationPluginHomeConnect()
|
|||||||
|
|
||||||
m_endTimerStateTypeIds.insert(ovenThingClassId, ovenEndTimeStateTypeId);
|
m_endTimerStateTypeIds.insert(ovenThingClassId, ovenEndTimeStateTypeId);
|
||||||
|
|
||||||
m_pauseActionTypeIds.insert(ovenThingClassId, ovenPauseActionTypeId);
|
m_startActionTypeIds.insert(ovenThingClassId, ovenStartActionTypeId);
|
||||||
m_resumeActionTypeIds.insert(ovenThingClassId, ovenResumeActionTypeId);
|
m_startActionTypeIds.insert(washerThingClassId, washerStartActionTypeId);
|
||||||
|
m_startActionTypeIds.insert(dryerThingClassId, dryerStartActionTypeId);
|
||||||
|
m_startActionTypeIds.insert(dishwasherThingClassId, dishwasherStartActionTypeId);
|
||||||
|
|
||||||
|
m_stopActionTypeIds.insert(ovenThingClassId, ovenStopActionTypeId);
|
||||||
|
m_stopActionTypeIds.insert(washerThingClassId, washerStopActionTypeId);
|
||||||
|
m_stopActionTypeIds.insert(dryerThingClassId, dryerStopActionTypeId);
|
||||||
|
m_stopActionTypeIds.insert(dishwasherThingClassId, dishwasherStopActionTypeId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +119,13 @@ void IntegrationPluginHomeConnect::startPairing(ThingPairingInfo *info)
|
|||||||
if (info->thingClassId() == homeConnectConnectionThingClassId) {
|
if (info->thingClassId() == homeConnectConnectionThingClassId) {
|
||||||
|
|
||||||
bool simulationMode = configValue(homeConnectPluginSimulationModeParamTypeId).toBool();
|
bool simulationMode = configValue(homeConnectPluginSimulationModeParamTypeId).toBool();
|
||||||
|
bool controlEnabled = configValue(homeConnectPluginControlEnabledParamTypeId).toBool();
|
||||||
|
|
||||||
HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this);
|
HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this);
|
||||||
QUrl url = homeConnect->getLoginUrl(QUrl("https://127.0.0.1:8888"), "IdentifyAppliance Monitor Settings");
|
QString scope = "IdentifyAppliance Monitor Settings";
|
||||||
|
if (controlEnabled)
|
||||||
|
scope.append(" Control");
|
||||||
|
QUrl url = homeConnect->getLoginUrl(QUrl("https://127.0.0.1:8888"), scope);
|
||||||
qCDebug(dcHomeConnect()) << "HomeConnect url:" << url;
|
qCDebug(dcHomeConnect()) << "HomeConnect url:" << url;
|
||||||
info->setOAuthUrl(url);
|
info->setOAuthUrl(url);
|
||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
@ -147,8 +145,6 @@ void IntegrationPluginHomeConnect::confirmPairing(ThingPairingInfo *info, const
|
|||||||
QUrl url(secret);
|
QUrl url(secret);
|
||||||
QUrlQuery query(url);
|
QUrlQuery query(url);
|
||||||
QByteArray authorizationCode = query.queryItemValue("code").toLocal8Bit();
|
QByteArray authorizationCode = query.queryItemValue("code").toLocal8Bit();
|
||||||
//QByteArray state = query.queryItemValue("state").toLocal8Bit();
|
|
||||||
//TODO evaluate state if it equals the given state
|
|
||||||
|
|
||||||
HomeConnect *homeConnect = m_setupHomeConnectConnections.value(info->thingId());
|
HomeConnect *homeConnect = m_setupHomeConnectConnections.value(info->thingId());
|
||||||
if (!homeConnect) {
|
if (!homeConnect) {
|
||||||
@ -243,24 +239,6 @@ void IntegrationPluginHomeConnect::setupThing(ThingSetupInfo *info)
|
|||||||
|
|
||||||
void IntegrationPluginHomeConnect::postSetupThing(Thing *thing)
|
void IntegrationPluginHomeConnect::postSetupThing(Thing *thing)
|
||||||
{
|
{
|
||||||
/* if (!m_pluginTimer5sec) {
|
|
||||||
m_pluginTimer5sec = hardwareManager()->pluginTimerManager()->registerTimer(5);
|
|
||||||
connect(m_pluginTimer5sec, &PluginTimer::timeout, this, [this]() {
|
|
||||||
|
|
||||||
foreach (Thing *connectionThing, myThings().filterByThingClassId(homeConnectConnectionThingClassId)) {
|
|
||||||
HomeConnect *homeConnect = m_homeConnectConnections.value(connectionThing);
|
|
||||||
if (!homeConnect) {
|
|
||||||
qWarning(dcHomeConnect()) << "No HomeConnect account found for" << connectionThing->name();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach (Thing *childThing, myThings().filterByParentId(connectionThing->id())) {
|
|
||||||
QString haid = childThing->paramValue(m_idParamTypeIds.value(childThing->thingClassId())).toString();
|
|
||||||
homeConnect->getStatus(haid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (!m_pluginTimer60sec) {
|
if (!m_pluginTimer60sec) {
|
||||||
m_pluginTimer60sec = hardwareManager()->pluginTimerManager()->registerTimer(60);
|
m_pluginTimer60sec = hardwareManager()->pluginTimerManager()->registerTimer(60);
|
||||||
connect(m_pluginTimer60sec, &PluginTimer::timeout, this, [this]() {
|
connect(m_pluginTimer60sec, &PluginTimer::timeout, this, [this]() {
|
||||||
@ -324,14 +302,15 @@ void IntegrationPluginHomeConnect::executeAction(ThingActionInfo *info)
|
|||||||
}
|
}
|
||||||
QString haid = thing->paramValue(m_idParamTypeIds.value(thing->thingClassId())).toString();
|
QString haid = thing->paramValue(m_idParamTypeIds.value(thing->thingClassId())).toString();
|
||||||
|
|
||||||
if (m_pauseActionTypeIds.values().contains(action.actionTypeId())) {
|
if (m_startActionTypeIds.values().contains(action.actionTypeId())) {
|
||||||
QUuid requestId;
|
QUuid requestId;
|
||||||
requestId = homeConnect->sendCommand(haid, "BSH.Common.Command.PauseProgram");
|
QList<HomeConnect::Option> options;
|
||||||
|
requestId = homeConnect->startProgram(haid, m_selectedProgram.value(thing), options);
|
||||||
m_pendingActions.insert(requestId, info);
|
m_pendingActions.insert(requestId, info);
|
||||||
connect(info, &ThingActionInfo::aborted, [requestId, this] {
|
connect(info, &ThingActionInfo::aborted, [requestId, this] {
|
||||||
m_pendingActions.remove(requestId);
|
m_pendingActions.remove(requestId);
|
||||||
});
|
});
|
||||||
} else if (m_resumeActionTypeIds.values().contains(action.actionTypeId())) {
|
} else if (m_stopActionTypeIds.values().contains(action.actionTypeId())) {
|
||||||
QUuid requestId;
|
QUuid requestId;
|
||||||
requestId = homeConnect->sendCommand(haid, "BSH.Common.Command.ResumeProgram");
|
requestId = homeConnect->sendCommand(haid, "BSH.Common.Command.ResumeProgram");
|
||||||
m_pendingActions.insert(requestId, info);
|
m_pendingActions.insert(requestId, info);
|
||||||
@ -355,10 +334,6 @@ void IntegrationPluginHomeConnect::thingRemoved(Thing *thing)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (myThings().empty()) {
|
if (myThings().empty()) {
|
||||||
if (m_pluginTimer5sec) {
|
|
||||||
m_pluginTimer5sec = nullptr;
|
|
||||||
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer5sec);
|
|
||||||
}
|
|
||||||
if (m_pluginTimer60sec) {
|
if (m_pluginTimer60sec) {
|
||||||
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer60sec);
|
hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer60sec);
|
||||||
m_pluginTimer60sec = nullptr;
|
m_pluginTimer60sec = nullptr;
|
||||||
@ -440,17 +415,23 @@ void IntegrationPluginHomeConnect::parseKey(Thing *thing, const QString &key, co
|
|||||||
thing->setStateValue(ovenDurationStateTypeId, value);
|
thing->setStateValue(ovenDurationStateTypeId, value);
|
||||||
} else if (key == "Cooking.Oven.Option.FastPreHeat") {
|
} else if (key == "Cooking.Oven.Option.FastPreHeat") {
|
||||||
} else if (key == "BSH.Common.Option.StartInRelative") {
|
} else if (key == "BSH.Common.Option.StartInRelative") {
|
||||||
|
//TODO
|
||||||
} else if (key == "LaundryCare.Washer.Option.Temperature") {
|
} else if (key == "LaundryCare.Washer.Option.Temperature") {
|
||||||
thing->setStateValue(washerTemperatureStateTypeId, value);
|
thing->setStateValue(washerTemperatureStateTypeId, value);
|
||||||
} else if (key == "LaundryCare.Washer.Option.SpinSpeed") {
|
} else if (key == "LaundryCare.Washer.Option.SpinSpeed") {
|
||||||
thing->setStateValue(washerSpinSpeedStateTypeId, value);
|
thing->setStateValue(washerSpinSpeedStateTypeId, value);
|
||||||
} else if (key == "LaundryCare.Dryer.Option.DryingTarget") {
|
} else if (key == "LaundryCare.Dryer.Option.DryingTarget") {
|
||||||
|
//TODO
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Option.BeanAmount") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Option.BeanAmount") {
|
||||||
|
//TODO
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Option.FillQuantity") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Option.FillQuantity") {
|
||||||
|
//TODO
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Option.CoffeeTemperature") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Option.CoffeeTemperature") {
|
||||||
|
//TODO
|
||||||
} else if (key == "Cooking.Common.Option.Hood.VentingLevel") {
|
} else if (key == "Cooking.Common.Option.Hood.VentingLevel") {
|
||||||
|
//TODO
|
||||||
} else if (key == "Cooking.Common.Option.Hood.IntensiveLevel") {
|
} else if (key == "Cooking.Common.Option.Hood.IntensiveLevel") {
|
||||||
|
//TODO
|
||||||
} else if (key == "ConsumerProducts.CleaningRobot.Option.ReferenceMapId") {
|
} else if (key == "ConsumerProducts.CleaningRobot.Option.ReferenceMapId") {
|
||||||
} else if (key == "ConsumerProducts.CleaningRobot.Option.CleaningMode") {
|
} else if (key == "ConsumerProducts.CleaningRobot.Option.CleaningMode") {
|
||||||
|
|
||||||
@ -470,12 +451,17 @@ void IntegrationPluginHomeConnect::parseKey(Thing *thing, const QString &key, co
|
|||||||
}
|
}
|
||||||
// Program Progress Events
|
// Program Progress Events
|
||||||
} else if (key == "BSH.Common.Event.ProgramAborted") {
|
} else if (key == "BSH.Common.Event.ProgramAborted") {
|
||||||
|
//TODO emit programfinished for all things
|
||||||
|
emitEvent(Event(ovenProgramFinishedEventTypeId, thing->id()));
|
||||||
} else if (key == "BSH.Common.Event.ProgramFinished") {
|
} else if (key == "BSH.Common.Event.ProgramFinished") {
|
||||||
|
//TODO emit programfinished for all things
|
||||||
|
emitEvent(Event(ovenProgramFinishedEventTypeId, thing->id()));
|
||||||
} else if (key == "BSH.Common.Event.AlarmClockElapsed") {
|
} else if (key == "BSH.Common.Event.AlarmClockElapsed") {
|
||||||
} else if (key == "Cooking.Oven.Event.PreheatFinished") {
|
} else if (key == "Cooking.Oven.Event.PreheatFinished") {
|
||||||
|
emitEvent(Event(ovenPreheatFinishedEventTypeId, thing->id()));
|
||||||
// Home Appliance State Changes
|
// Home Appliance State Changes
|
||||||
} else if (key == "BSH.Common.Setting.PowerState") {
|
} else if (key == "BSH.Common.Setting.PowerState") {
|
||||||
|
//Ignore
|
||||||
} else if (key == "BSH.Common.Status.RemoteControlActive") {
|
} else if (key == "BSH.Common.Status.RemoteControlActive") {
|
||||||
if (m_remoteControlActivationStateTypeIds.contains(thing->thingClassId())) {
|
if (m_remoteControlActivationStateTypeIds.contains(thing->thingClassId())) {
|
||||||
thing->setStateValue(m_remoteControlActivationStateTypeIds.value(thing->thingClassId()), value);
|
thing->setStateValue(m_remoteControlActivationStateTypeIds.value(thing->thingClassId()), value);
|
||||||
@ -495,15 +481,25 @@ void IntegrationPluginHomeConnect::parseKey(Thing *thing, const QString &key, co
|
|||||||
|
|
||||||
// Home Appliance Events
|
// Home Appliance Events
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Event.BeanContainerEmpty") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Event.BeanContainerEmpty") {
|
||||||
|
emitEvent(Event(coffeeMakerBeanContainerEmptyEventTypeId, thing->id()));
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Event.WaterTankEmpty") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Event.WaterTankEmpty") {
|
||||||
|
emitEvent(Event(coffeeMakerWaterTankEmptyEventTypeId, thing->id()));
|
||||||
} else if (key == "ConsumerProducts.CoffeeMaker.Event.DripTrayFull") {
|
} else if (key == "ConsumerProducts.CoffeeMaker.Event.DripTrayFull") {
|
||||||
} else if (key == "Refrigeration.FridgeFreezer.Event.DoorAlarmFreezer") {
|
emitEvent(Event(coffeeMakerDripTrayFullEventTypeId, thing->id()));
|
||||||
|
} else if (key == "Refrigeration.FridgeFreezer.Event.DoorAlarmFreezer") {;
|
||||||
|
emitEvent(Event(fridgeDoorAlarmFreezerEventTypeId, thing->id()));
|
||||||
} else if (key == "Refrigeration.FridgeFreezer.Event.DoorAlarmRefrigerator") {
|
} else if (key == "Refrigeration.FridgeFreezer.Event.DoorAlarmRefrigerator") {
|
||||||
|
emitEvent(Event(fridgeDoorAlarmRefrigeratorEventTypeId, thing->id()));
|
||||||
} else if (key == "Refrigeration.FridgeFreezer.Event.TemperatureAlarmFreezer") {
|
} else if (key == "Refrigeration.FridgeFreezer.Event.TemperatureAlarmFreezer") {
|
||||||
|
emitEvent(Event(fridgeTemperatureAlarmFreezerEventTypeId, thing->id()));
|
||||||
} else if (key == "ConsumerProducts.CleaningRobot.Event.EmptyDustBoxAndCleanFilter") {
|
} else if (key == "ConsumerProducts.CleaningRobot.Event.EmptyDustBoxAndCleanFilter") {
|
||||||
|
emitEvent(Event(cleaningRobotEmptyDustBoxAndCleanFilterEventTypeId, thing->id()));
|
||||||
} else if (key == "ConsumerProducts.CleaningRobot.Event.RobotIsStuck") {
|
} else if (key == "ConsumerProducts.CleaningRobot.Event.RobotIsStuck") {
|
||||||
|
emitEvent(Event(cleaningRobotRobotIsStuckEventTypeId, thing->id()));
|
||||||
} else if (key == "ConsumerProducts.CleaningRobot.Event.DockingStationNotFound") {
|
} else if (key == "ConsumerProducts.CleaningRobot.Event.DockingStationNotFound") {
|
||||||
// UNDOKUMENTED
|
emitEvent(Event(cleaningRobotDockingStationNotFoundEventTypeId, thing->id()));
|
||||||
|
|
||||||
|
// UNDOCUMENTED
|
||||||
} else if (key == "Cooking.Oven.Status.CurrentCavityTemperature") {
|
} else if (key == "Cooking.Oven.Status.CurrentCavityTemperature") {
|
||||||
thing->setStateValue(ovenCurrentTemperatureStateTypeId, value);
|
thing->setStateValue(ovenCurrentTemperatureStateTypeId, value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -69,6 +69,7 @@ private:
|
|||||||
QHash<Thing *, HomeConnect *> m_homeConnectConnections;
|
QHash<Thing *, HomeConnect *> m_homeConnectConnections;
|
||||||
|
|
||||||
QHash<QUuid, ThingActionInfo *> m_pendingActions;
|
QHash<QUuid, ThingActionInfo *> m_pendingActions;
|
||||||
|
QHash<Thing *, QString> m_selectedProgram;
|
||||||
|
|
||||||
QHash<ThingClassId, ParamTypeId> m_idParamTypeIds;
|
QHash<ThingClassId, ParamTypeId> m_idParamTypeIds;
|
||||||
|
|
||||||
@ -83,8 +84,8 @@ private:
|
|||||||
QHash<ThingClassId, StateTypeId> m_progressStateTypeIds;
|
QHash<ThingClassId, StateTypeId> m_progressStateTypeIds;
|
||||||
QHash<ThingClassId, StateTypeId> m_endTimerStateTypeIds;
|
QHash<ThingClassId, StateTypeId> m_endTimerStateTypeIds;
|
||||||
|
|
||||||
QHash<ThingClassId, StateTypeId> m_resumeActionTypeIds;
|
QHash<ThingClassId, ActionTypeId> m_startActionTypeIds;
|
||||||
QHash<ThingClassId, ActionTypeId> m_pauseActionTypeIds;
|
QHash<ThingClassId, ActionTypeId> m_stopActionTypeIds;
|
||||||
|
|
||||||
HomeConnect *createHomeConnection();
|
HomeConnect *createHomeConnection();
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,13 @@
|
|||||||
"displayName": "Simulation mode",
|
"displayName": "Simulation mode",
|
||||||
"defaultValue": false,
|
"defaultValue": false,
|
||||||
"type": "bool"
|
"type": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "37c6cbee-4ce6-4f8c-91ad-9f6f89b6c032",
|
||||||
|
"name": "controlEnabled",
|
||||||
|
"displayName": "Control enabled",
|
||||||
|
"defaultValue": false,
|
||||||
|
"type": "bool"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"vendors": [
|
"vendors": [
|
||||||
@ -162,9 +169,11 @@
|
|||||||
"name": "duration",
|
"name": "duration",
|
||||||
"displayName": "Duration",
|
"displayName": "Duration",
|
||||||
"displayNameEvent": "Duration changed",
|
"displayNameEvent": "Duration changed",
|
||||||
|
"displayNameAction": "Set duration",
|
||||||
"defaultValue": 0,
|
"defaultValue": 0,
|
||||||
"unit": "Seconds",
|
"unit": "Minutes",
|
||||||
"type": "int"
|
"type": "int",
|
||||||
|
"writable": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "85a333dc-0e0b-454c-9c9a-d14dd6484275",
|
"id": "85a333dc-0e0b-454c-9c9a-d14dd6484275",
|
||||||
@ -195,13 +204,25 @@
|
|||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
{
|
{
|
||||||
"id": "c7b9b467-6ac5-4870-8874-da977fa30987",
|
"id": "c7b9b467-6ac5-4870-8874-da977fa30987",
|
||||||
"name": "pause",
|
"name": "start",
|
||||||
"displayName": "Pause"
|
"displayName": "Start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "0467aeed-b275-4e5f-a288-1a600465b582",
|
"id": "0467aeed-b275-4e5f-a288-1a600465b582",
|
||||||
"name": "resume",
|
"name": "stop",
|
||||||
"displayName": "Resume"
|
"displayName": "Stop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "aa3372df-5be7-499a-8246-9c4319a2c080",
|
||||||
|
"name": "preheatFinished",
|
||||||
|
"displayName": "Preheat finished"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3067c6e8-33b3-4a87-ae41-09f28e8a0c1e",
|
||||||
|
"name": "programFinished",
|
||||||
|
"displayName": "Program finished"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -292,6 +313,45 @@
|
|||||||
"displayNameEvent": "Selected program changed",
|
"displayNameEvent": "Selected program changed",
|
||||||
"defaultValue": "None",
|
"defaultValue": "None",
|
||||||
"type": "QString"
|
"type": "QString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "27de74b5-265a-4c9f-bd3e-f58ab5c81a1f",
|
||||||
|
"name": "startTime",
|
||||||
|
"displayName": "Start time",
|
||||||
|
"displayNameEvent": "Start time changed",
|
||||||
|
"displayNameAction": "Set start time",
|
||||||
|
"defaultValue": 0,
|
||||||
|
"minValue": 0,
|
||||||
|
"type": "int",
|
||||||
|
"unit": "Minutes",
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "f61cd171-2e8e-434c-98f9-e7fc7df1c928",
|
||||||
|
"name": "endTime",
|
||||||
|
"displayName": "End time",
|
||||||
|
"displayNameEvent": "End time changed",
|
||||||
|
"defaultValue": "00:00:00",
|
||||||
|
"type": "QString"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actionTypes": [
|
||||||
|
{
|
||||||
|
"id": "7dc1e238-cdc2-42e8-9a2a-e93d497966d9",
|
||||||
|
"name": "start",
|
||||||
|
"displayName": "Start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "c2c7e1bd-bf0f-4ded-93e0-e4d770f03f6f",
|
||||||
|
"name": "stop",
|
||||||
|
"displayName": "Stop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "509e62c1-8121-4f8e-b847-e5e8083d6c1b",
|
||||||
|
"name": "programFinished",
|
||||||
|
"displayName": "Program finished"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -430,6 +490,35 @@
|
|||||||
"type": "QString",
|
"type": "QString",
|
||||||
"writable": true
|
"writable": true
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"actionTypes": [
|
||||||
|
{
|
||||||
|
"id": "025f7cb5-83a7-40d3-9628-05eda18f5568",
|
||||||
|
"name": "start",
|
||||||
|
"displayName": "Start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "12f5b09e-a23a-43ee-ba4b-8b0f34792496",
|
||||||
|
"name": "stop",
|
||||||
|
"displayName": "Stop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "9e641015-67bd-4879-aa58-7b6849c58178",
|
||||||
|
"name": "beanContainerEmpty",
|
||||||
|
"displayName": "Bean container empty"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2ea6dd16-86ad-4e55-9281-ae55646eb869",
|
||||||
|
"name": "waterTankEmpty",
|
||||||
|
"displayName": "Water tank empty"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "1f360c77-01a5-411c-b347-aa3f0a5c9ba5",
|
||||||
|
"name": "dripTrayFull",
|
||||||
|
"displayName": "Drip tray full"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -530,18 +619,33 @@
|
|||||||
"displayNameEvent": "Selected program changed",
|
"displayNameEvent": "Selected program changed",
|
||||||
"defaultValue": "None",
|
"defaultValue": "None",
|
||||||
"type": "QString"
|
"type": "QString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "6586f2d9-daec-43fa-8f7f-f3afc9d70046",
|
||||||
|
"name": "endTime",
|
||||||
|
"displayName": "End time",
|
||||||
|
"displayNameEvent": "End time changed",
|
||||||
|
"defaultValue": "00:00:00",
|
||||||
|
"type": "QString"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
{
|
{
|
||||||
"id": "aedd85a6-0f9a-4bc4-b2ba-90ba11d1a955",
|
"id": "aedd85a6-0f9a-4bc4-b2ba-90ba11d1a955",
|
||||||
"name": "pause",
|
"name": "start",
|
||||||
"displayName": "Pause"
|
"displayName": "Start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "8c9923f6-2a2d-48bb-aaf4-5f887565c58a",
|
"id": "8c9923f6-2a2d-48bb-aaf4-5f887565c58a",
|
||||||
"name": "resume",
|
"name": "stop",
|
||||||
"displayName": "Resume"
|
"displayName": "Stop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "09c6269d-015f-4f83-895f-9dea1ac11c43",
|
||||||
|
"name": "programFinished",
|
||||||
|
"displayName": "Program finished"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -630,6 +734,23 @@
|
|||||||
"writable": true,
|
"writable": true,
|
||||||
"unit": "DegreeCelsius"
|
"unit": "DegreeCelsius"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "1c2ca8d8-3d51-4303-b749-93dc71b1a696",
|
||||||
|
"name": "doorAlarmRefrigerator",
|
||||||
|
"displayName": "Door alarm refrigerator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "702e6401-6dd1-4c29-9bb7-36173284b6ab",
|
||||||
|
"name": "doorAlarmFreezer",
|
||||||
|
"displayName": "Door alarm freezer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b4e68a37-0d38-4ae0-babb-3c8e3bc4cf6c",
|
||||||
|
"name": "temperatureAlarmFreezer",
|
||||||
|
"displayName": "Temperature alarm freezer"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -746,18 +867,26 @@
|
|||||||
"displayNameEvent": "Spin speed changed",
|
"displayNameEvent": "Spin speed changed",
|
||||||
"defaultValue": "Unknown",
|
"defaultValue": "Unknown",
|
||||||
"type": "QString"
|
"type": "QString"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e9b93ad1-fe9e-4ba2-ac7c-9407fa80c846",
|
||||||
|
"name": "endTime",
|
||||||
|
"displayName": "End time",
|
||||||
|
"displayNameEvent": "End time changed",
|
||||||
|
"defaultValue": "00:00:00",
|
||||||
|
"type": "QString"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"actionTypes": [
|
"actionTypes": [
|
||||||
{
|
{
|
||||||
"id": "c87d6825-f37d-4da6-8545-945bd589dbc2",
|
"id": "c87d6825-f37d-4da6-8545-945bd589dbc2",
|
||||||
"name": "pause",
|
"name": "start",
|
||||||
"displayName": "Pause"
|
"displayName": "Start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "044582ca-30e6-4d37-9377-809fb5fa120a",
|
"id": "044582ca-30e6-4d37-9377-809fb5fa120a",
|
||||||
"name": "resume",
|
"name": "stop",
|
||||||
"displayName": "Resume"
|
"displayName": "Stop"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -840,6 +969,23 @@
|
|||||||
"cached": false,
|
"cached": false,
|
||||||
"type": "bool"
|
"type": "bool"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"eventTypes": [
|
||||||
|
{
|
||||||
|
"id": "35548e9e-5c41-40e1-add6-e6d2911d4a2a",
|
||||||
|
"name": "emptyDustBoxAndCleanFilter",
|
||||||
|
"displayName": "Empty dust box and clean filter"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e55cb32a-a8ee-4f1d-958e-f15ae0ad6c42",
|
||||||
|
"name": "robotIsStuck",
|
||||||
|
"displayName": "Robot is stuck"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "4507655c-bc98-4437-acba-8ce701ba7b5f",
|
||||||
|
"name": "dockingStationNotFound",
|
||||||
|
"displayName": "Docking station not found"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user