diff --git a/genericthings/integrationplugingenericthings.cpp b/genericthings/integrationplugingenericthings.cpp
index 4698727..8e93f0d 100644
--- a/genericthings/integrationplugingenericthings.cpp
+++ b/genericthings/integrationplugingenericthings.cpp
@@ -891,6 +891,15 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
info->finish(Thing::ThingErrorNoError);
return;
}
+ } else if (thing->thingClassId() == carThingClassId) {
+ if (action.actionTypeId() == carCapacityActionTypeId) {
+ thing->setStateValue(carCapacityStateTypeId, action.paramValue(carCapacityActionCapacityParamTypeId));
+ info->finish(Thing::ThingErrorNoError);
+ } else if (action.actionTypeId() == carBatteryLevelActionTypeId) {
+ thing->setStateValue(carBatteryLevelStateTypeId, action.paramValue(carBatteryLevelActionBatteryLevelParamTypeId));
+ thing->setStateValue(carBatteryCriticalStateTypeId, action.paramValue(carBatteryLevelActionBatteryLevelParamTypeId).toInt() < 10);
+ info->finish(Thing::ThingErrorNoError);
+ }
} else {
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
}
diff --git a/genericthings/integrationplugingenericthings.json b/genericthings/integrationplugingenericthings.json
index a4f0ff5..ac56cf0 100644
--- a/genericthings/integrationplugingenericthings.json
+++ b/genericthings/integrationplugingenericthings.json
@@ -1774,6 +1774,47 @@
"defaultValue": false
}
]
+ },
+ {
+ "id": "dbe0a9ff-94ba-4a94-ae52-51da3f05c717",
+ "name": "car",
+ "displayName": "Generic electric car",
+ "createMethods": ["user"],
+ "interfaces": ["electricvehicle"],
+ "stateTypes": [
+ {
+ "id": "363a2a39-61b6-4109-9cd9-aca7367d12c7",
+ "name": "capacity",
+ "displayName": "Capacity",
+ "displayNameEvent": "Capacity changed",
+ "displayNameAction": "Set capacity",
+ "type": "double",
+ "unit": "KiloWattHour",
+ "defaultValue": 50,
+ "writable": true
+ },
+ {
+ "id": "d33982d6-6467-4281-b448-68c1b1db088d",
+ "name": "batteryCritical",
+ "displayName": "Battery level critical",
+ "displayNameEvent": "Battery entered or left critical state",
+ "type": "bool",
+ "defaultValue": false
+ },
+ {
+ "id": "3f1cca10-8988-4ec6-b937-0775653cde12",
+ "name": "batteryLevel",
+ "displayName": "Battery level",
+ "displayNameEvent": "Battery level changed",
+ "displayNameAction": "Set battery level",
+ "type": "int",
+ "unit": "Percentage",
+ "writable": true,
+ "minValue": 0,
+ "maxValue": 100,
+ "defaultValue": 100
+ }
+ ]
}
]
}
diff --git a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts
index 0a47a36..606eaa8 100644
--- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts
+++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-de.ts
@@ -1154,14 +1154,22 @@ The name of the StateType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass
Battery level
- The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
+ The name of the ParamType (ThingClass: car, ActionType: batteryLevel, ID: {3f1cca10-8988-4ec6-b937-0775653cde12})
+----------
+The name of the ParamType (ThingClass: car, EventType: batteryLevel, ID: {3f1cca10-8988-4ec6-b937-0775653cde12})
+----------
+The name of the StateType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
----------
The name of the StateType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass batteryBatterieladungBattery level changed
- The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery
+ The name of the EventType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass batteryBatterieladung geändert
@@ -1199,7 +1207,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
Battery entered or left critical state
- The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass battery
+ The name of the EventType ({d33982d6-6467-4281-b448-68c1b1db088d}) of ThingClass car
+----------
+The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass batteryBatterieladung kritisch geändert
@@ -1209,7 +1219,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
Set battery level
- The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass battery
+ The name of the ActionType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass batterySetze Batterieladung
@@ -1500,6 +1512,37 @@ The name of the EventType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass
The name of the StateType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass waterSensor
Wasser erkannt
+
+ Battery level critical
+ The name of the ParamType (ThingClass: car, EventType: batteryCritical, ID: {d33982d6-6467-4281-b448-68c1b1db088d})
+----------
+The name of the StateType ({d33982d6-6467-4281-b448-68c1b1db088d}) of ThingClass car
+ Batterieladung kritisch
+
+
+ Capacity
+ The name of the ParamType (ThingClass: car, ActionType: capacity, ID: {363a2a39-61b6-4109-9cd9-aca7367d12c7})
+----------
+The name of the ParamType (ThingClass: car, EventType: capacity, ID: {363a2a39-61b6-4109-9cd9-aca7367d12c7})
+----------
+The name of the StateType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+ Kapazität
+
+
+ Capacity changed
+ The name of the EventType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+ Kapazität geändert
+
+
+ Generic electric car
+ The name of the ThingClass ({dbe0a9ff-94ba-4a94-ae52-51da3f05c717})
+ Generisches Elektroauto
+
+
+ Set capacity
+ The name of the ActionType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+ Setze Kapazität
+ IntegrationPluginGenericThings
diff --git a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts
index dc720ff..166bdc6 100644
--- a/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts
+++ b/genericthings/translations/b3188696-2585-4806-bf98-30ab576ce5c8-en_US.ts
@@ -1154,14 +1154,22 @@ The name of the StateType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass
Battery level
- The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
+ The name of the ParamType (ThingClass: car, ActionType: batteryLevel, ID: {3f1cca10-8988-4ec6-b937-0775653cde12})
+----------
+The name of the ParamType (ThingClass: car, EventType: batteryLevel, ID: {3f1cca10-8988-4ec6-b937-0775653cde12})
+----------
+The name of the StateType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
----------
The name of the StateType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass batteryBattery level changed
- The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery
+ The name of the EventType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery
@@ -1199,7 +1207,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
Battery entered or left critical state
- The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass battery
+ The name of the EventType ({d33982d6-6467-4281-b448-68c1b1db088d}) of ThingClass car
+----------
+The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass battery
@@ -1209,7 +1219,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
Set battery level
- The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass battery
+ The name of the ActionType ({3f1cca10-8988-4ec6-b937-0775653cde12}) of ThingClass car
+----------
+The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass battery
@@ -1500,6 +1512,37 @@ The name of the EventType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass
The name of the StateType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass waterSensor
+
+ Battery level critical
+ The name of the ParamType (ThingClass: car, EventType: batteryCritical, ID: {d33982d6-6467-4281-b448-68c1b1db088d})
+----------
+The name of the StateType ({d33982d6-6467-4281-b448-68c1b1db088d}) of ThingClass car
+
+
+
+ Capacity
+ The name of the ParamType (ThingClass: car, ActionType: capacity, ID: {363a2a39-61b6-4109-9cd9-aca7367d12c7})
+----------
+The name of the ParamType (ThingClass: car, EventType: capacity, ID: {363a2a39-61b6-4109-9cd9-aca7367d12c7})
+----------
+The name of the StateType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+
+
+
+ Capacity changed
+ The name of the EventType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+
+
+
+ Generic electric car
+ The name of the ThingClass ({dbe0a9ff-94ba-4a94-ae52-51da3f05c717})
+
+
+
+ Set capacity
+ The name of the ActionType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car
+
+ IntegrationPluginGenericThings