Merge PR #466: Generic Things: Add a generic electric car thing
This commit is contained in:
commit
c96abbeefa
@ -891,6 +891,15 @@ void IntegrationPluginGenericThings::executeAction(ThingActionInfo *info)
|
|||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
return;
|
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 {
|
} else {
|
||||||
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
Q_ASSERT_X(false, "executeAction", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1774,6 +1774,47 @@
|
|||||||
"defaultValue": false
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1154,14 +1154,22 @@ The name of the StateType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery level</source>
|
<source>Battery level</source>
|
||||||
<extracomment>The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
|
<extracomment>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 battery</extracomment>
|
The name of the StateType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery</extracomment>
|
||||||
<translation>Batterieladung</translation>
|
<translation>Batterieladung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery level changed</source>
|
<source>Battery level changed</source>
|
||||||
<extracomment>The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation>Batterieladung geändert</translation>
|
<translation>Batterieladung geändert</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -1199,7 +1207,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery entered or left critical state</source>
|
<source>Battery entered or left critical state</source>
|
||||||
<extracomment>The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation>Batterieladung kritisch geändert</translation>
|
<translation>Batterieladung kritisch geändert</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -1209,7 +1219,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set battery level</source>
|
<source>Set battery level</source>
|
||||||
<extracomment>The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation>Setze Batterieladung</translation>
|
<translation>Setze Batterieladung</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -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</extracomment>
|
The name of the StateType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass waterSensor</extracomment>
|
||||||
<translation>Wasser erkannt</translation>
|
<translation>Wasser erkannt</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Battery level critical</source>
|
||||||
|
<extracomment>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</extracomment>
|
||||||
|
<translation>Batterieladung kritisch</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Capacity</source>
|
||||||
|
<extracomment>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</extracomment>
|
||||||
|
<translation>Kapazität</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Capacity changed</source>
|
||||||
|
<extracomment>The name of the EventType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car</extracomment>
|
||||||
|
<translation>Kapazität geändert</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Generic electric car</source>
|
||||||
|
<extracomment>The name of the ThingClass ({dbe0a9ff-94ba-4a94-ae52-51da3f05c717})</extracomment>
|
||||||
|
<translation>Generisches Elektroauto</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Set capacity</source>
|
||||||
|
<extracomment>The name of the ActionType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car</extracomment>
|
||||||
|
<translation>Setze Kapazität</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>IntegrationPluginGenericThings</name>
|
<name>IntegrationPluginGenericThings</name>
|
||||||
|
|||||||
@ -1154,14 +1154,22 @@ The name of the StateType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery level</source>
|
<source>Battery level</source>
|
||||||
<extracomment>The name of the ParamType (ThingClass: battery, EventType: batteryLevel, ID: {d37eed4a-befc-40d4-b435-40a761f99314})
|
<extracomment>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 battery</extracomment>
|
The name of the StateType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery level changed</source>
|
<source>Battery level changed</source>
|
||||||
<extracomment>The name of the EventType ({d37eed4a-befc-40d4-b435-40a761f99314}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -1199,7 +1207,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Battery entered or left critical state</source>
|
<source>Battery entered or left critical state</source>
|
||||||
<extracomment>The name of the EventType ({e95dc037-002d-40a2-8c15-cd5489bd354a}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -1209,7 +1219,9 @@ The name of the StateType ({a61c0328-b982-46a5-9cc0-b4fa4d0ab84d}) of ThingClass
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set battery level</source>
|
<source>Set battery level</source>
|
||||||
<extracomment>The name of the ActionType ({3336f0c2-158b-4353-b74f-f1bb9c4e8447}) of ThingClass battery</extracomment>
|
<extracomment>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</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -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</extracomment>
|
The name of the StateType ({b2427b85-1f62-4635-b546-1961191426ef}) of ThingClass waterSensor</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Battery level critical</source>
|
||||||
|
<extracomment>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</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Capacity</source>
|
||||||
|
<extracomment>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</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Capacity changed</source>
|
||||||
|
<extracomment>The name of the EventType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Generic electric car</source>
|
||||||
|
<extracomment>The name of the ThingClass ({dbe0a9ff-94ba-4a94-ae52-51da3f05c717})</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Set capacity</source>
|
||||||
|
<extracomment>The name of the ActionType ({363a2a39-61b6-4109-9cd9-aca7367d12c7}) of ThingClass car</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>IntegrationPluginGenericThings</name>
|
<name>IntegrationPluginGenericThings</name>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user