diff --git a/genericelements/integrationplugingenericelements.cpp b/genericelements/integrationplugingenericelements.cpp
index 7725ec8..6b60b9d 100644
--- a/genericelements/integrationplugingenericelements.cpp
+++ b/genericelements/integrationplugingenericelements.cpp
@@ -47,20 +47,35 @@ void IntegrationPluginGenericElements::executeAction(ThingActionInfo *info)
Thing *thing = info->thing();
Action action = info->action();
- // Toggle Button
- if (action.actionTypeId() == toggleButtonStateActionTypeId) {
- thing->setStateValue(toggleButtonStateStateTypeId, action.params().paramValue(toggleButtonStateActionStateParamTypeId).toBool());
+ // Power Button
+ if (thing->thingClassId() == powerButtonThingClassId) {
+ if (action.actionTypeId() == powerButtonPowerActionTypeId) {
+ thing->setStateValue(powerButtonPowerStateTypeId, action.params().paramValue(powerButtonPowerActionPowerParamTypeId).toBool());
+ }
}
+
// Button
- if (action.actionTypeId() == buttonButtonPressActionTypeId) {
- emit emitEvent(Event(buttonButtonPressedEventTypeId, thing->id()));
+ if (thing->thingClassId() == buttonThingClassId) {
+ if (action.actionTypeId() == buttonPressActionTypeId) {
+ emit emitEvent(Event(buttonPressedEventTypeId, thing->id()));
+ }
}
+
+ // Trigger button
+ if (thing->thingClassId() == triggerButtonThingClassId) {
+ if (action.actionTypeId() == triggerButtonTriggerActionTypeId) {
+ emit emitEvent(Event(triggerButtonPressedEventTypeId, thing->id()));
+ }
+ }
+
// ON/OFF Button
- if (action.actionTypeId() == onOffButtonOnActionTypeId) {
- emit emitEvent(Event(onOffButtonOnEventTypeId, thing->id()));
- }
- if (action.actionTypeId() == onOffButtonOffActionTypeId) {
- emit emitEvent(Event(onOffButtonOffEventTypeId, thing->id()));
+ if (thing->thingClassId() == onOffButtonThingClassId) {
+ if (action.actionTypeId() == onOffButtonOnActionTypeId) {
+ emit emitEvent(Event(onOffButtonPressedEventTypeId, thing->id(), ParamList() << Param(onOffButtonPressedEventButtonNameParamTypeId, "On")));
+ } else if (action.actionTypeId() == onOffButtonOffActionTypeId) {
+ emit emitEvent(Event(onOffButtonPressedEventTypeId, thing->id(), ParamList() << Param(onOffButtonPressedEventButtonNameParamTypeId, "Off")));
+ }
}
+
info->finish(Thing::ThingErrorNoError);
}
diff --git a/genericelements/integrationplugingenericelements.json b/genericelements/integrationplugingenericelements.json
index a755b86..b5051b4 100644
--- a/genericelements/integrationplugingenericelements.json
+++ b/genericelements/integrationplugingenericelements.json
@@ -10,20 +10,22 @@
"thingClasses": [
{
"id": "c0f511f9-70f5-499b-bd70-2c0e9ddd68c4",
- "name": "toggleButton",
- "displayName": "Toggle Button",
- "createMethods": ["user"],
+ "name": "powerButton",
+ "displayName": "Power Button",
+ "createMethods": [ "user" ],
+ "interfaces": [ "power" ],
"paramTypes": [ ],
"stateTypes": [
{
"id": "b5e90567-54aa-49bd-a78a-3c19fb38aaf5",
- "name": "state",
+ "name": "power",
"displayName": "state",
- "displayNameEvent": "state changed",
- "displayNameAction": "Set state",
+ "displayNameEvent": "power changed",
+ "displayNameAction": "set power",
"type": "bool",
"defaultValue": false,
- "writable": true
+ "writable": true,
+ "ioType": "digitalOutput"
}
]
},
@@ -31,51 +33,79 @@
"id": "820b2f2d-0d92-48c8-8fd4-f94ce8fc4103",
"name": "button",
"displayName": "Button",
- "createMethods": ["user"],
+ "createMethods": [ "user" ],
+ "interfaces": [ "button" ],
"paramTypes": [ ],
"actionTypes": [
{
"id": "01f38af1-b2ab-4ec3-844e-ef52f0f229a9",
- "name": "buttonPress",
+ "name": "press",
"displayName": "press"
}
],
"eventTypes": [
{
"id": "effdbc2d-e467-4b0b-80a9-9dda251bfa5c",
- "name": "buttonPressed",
+ "name": "pressed",
"displayName": "button pressed"
}
]
},
+ {
+ "id": "5f91923e-fc8e-48db-9de7-9a2fc36798dd",
+ "name": "triggerButton",
+ "displayName": "Trigger button",
+ "createMethods": [ "user" ],
+ "interfaces": [ "outputtrigger", "button" ],
+ "paramTypes": [ ],
+ "actionTypes": [
+ {
+ "id": "da322b8e-2116-4565-805a-03f7726373c8",
+ "name": "trigger",
+ "displayName": "trigger"
+ }
+ ],
+ "eventTypes": [
+ {
+ "id": "51197853-0559-42a0-a97b-6ead56ae22f6",
+ "name": "pressed",
+ "displayName": "triggered"
+ }
+ ]
+ },
{
"id": "430d188c-476d-4825-a9bd-86dfa3094b56",
"name": "onOffButton",
"displayName": "ON/OFF Button",
"createMethods": ["user"],
+ "interfaces": [ "multibutton" ],
"paramTypes": [ ],
"actionTypes": [
{
"id": "892596d2-0863-4807-97da-469b9f7003f2",
"name": "on",
- "displayName": "press ON"
+ "displayName": "on"
},
{
"id": "a8d64050-0b58-4ccf-b052-77ce2b7368ad",
"name": "off",
- "displayName": "press OFF"
+ "displayName": "off"
}
],
"eventTypes": [
{
"id": "4eeba6a2-e4c7-4a2e-8360-2797d98114e6",
- "name": "on",
- "displayName": "ON pressed"
- },
- {
- "id": "b636c5f3-2eb0-4682-96d4-88a4aa9d2c12",
- "name": "off",
- "displayName": "OFF pressed"
+ "name": "pressed",
+ "displayName": "Button pressed",
+ "paramTypes": [
+ {
+ "id": "2e6bc343-41a3-4634-b514-4512ae54afbc",
+ "name": "buttonName",
+ "displayName": "Button name",
+ "type": "QString",
+ "allowedValues": ["Off", "On"]
+ }
+ ]
}
]
}
diff --git a/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-de.ts b/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-de.ts
index fcb4153..0f73f20 100644
--- a/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-de.ts
+++ b/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-de.ts
@@ -4,94 +4,112 @@
GenericElements
-
+ Generic ElementsThe name of the plugin GenericElements ({6e22161e-39b7-4416-8623-39e730721efb})
-
+ nymeaThe name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6})
-
- Toggle Button
- The name of the ThingClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})
- Toggle Taster
-
-
-
- state changed
- The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
-
-
-
-
-
-
+
+
+ state
- The name of the ParamType (ThingClass: toggleButton, ActionType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
+ The name of the ParamType (ThingClass: powerButton, ActionType: power, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
-The name of the ParamType (ThingClass: toggleButton, EventType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
+The name of the ParamType (ThingClass: powerButton, EventType: power, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
-The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
+The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
-
- Set state
- The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
-
-
-
-
+ ButtonThe name of the ThingClass ({820b2f2d-0d92-48c8-8fd4-f94ce8fc4103})Taster
-
+
+ Button name
+ The name of the ParamType (ThingClass: onOffButton, EventType: pressed, ID: {2e6bc343-41a3-4634-b514-4512ae54afbc})
+
+
+
+
+ Button pressed
+ The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of ThingClass onOffButton
+
+
+
+
+ Power Button
+ The name of the ThingClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})
+
+
+
+
+ Trigger button
+ The name of the ThingClass ({5f91923e-fc8e-48db-9de7-9a2fc36798dd})
+
+
+
+
+ off
+ The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of ThingClass onOffButton
+
+
+
+
+ on
+ The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of ThingClass onOffButton
+
+
+
+
+ power changed
+ The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
+
+
+
+ pressThe name of the ActionType ({01f38af1-b2ab-4ec3-844e-ef52f0f229a9}) of ThingClass button
-
+
+ set power
+ The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
+
+
+
+
+ trigger
+ The name of the ActionType ({da322b8e-2116-4565-805a-03f7726373c8}) of ThingClass triggerButton
+
+
+
+
+ triggered
+ The name of the EventType ({51197853-0559-42a0-a97b-6ead56ae22f6}) of ThingClass triggerButton
+
+
+
+ button pressedThe name of the EventType ({effdbc2d-e467-4b0b-80a9-9dda251bfa5c}) of ThingClass button
-
+ ON/OFF ButtonThe name of the ThingClass ({430d188c-476d-4825-a9bd-86dfa3094b56})An/Aus Taster
-
-
- press ON
- The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of ThingClass onOffButton
-
-
-
-
- press OFF
- The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of ThingClass onOffButton
-
-
-
-
- ON pressed
- The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of ThingClass onOffButton
-
-
-
-
- OFF pressed
- The name of the EventType ({b636c5f3-2eb0-4682-96d4-88a4aa9d2c12}) of ThingClass onOffButton
-
-
diff --git a/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-en_US.ts b/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-en_US.ts
index 40bf713..d76697c 100644
--- a/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-en_US.ts
+++ b/genericelements/translations/6e22161e-39b7-4416-8623-39e730721efb-en_US.ts
@@ -4,94 +4,112 @@
GenericElements
-
+ Generic ElementsThe name of the plugin GenericElements ({6e22161e-39b7-4416-8623-39e730721efb})
-
+ nymeaThe name of the vendor ({2062d64d-3232-433c-88bc-0d33c0ba2ba6})
-
- Toggle Button
- The name of the ThingClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})
-
-
-
-
- state changed
- The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
-
-
-
-
-
-
+
+
+ state
- The name of the ParamType (ThingClass: toggleButton, ActionType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
+ The name of the ParamType (ThingClass: powerButton, ActionType: power, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
-The name of the ParamType (ThingClass: toggleButton, EventType: state, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
+The name of the ParamType (ThingClass: powerButton, EventType: power, ID: {b5e90567-54aa-49bd-a78a-3c19fb38aaf5})
----------
-The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
+The name of the StateType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
-
- Set state
- The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass toggleButton
-
-
-
-
+ ButtonThe name of the ThingClass ({820b2f2d-0d92-48c8-8fd4-f94ce8fc4103})
-
+
+ Button name
+ The name of the ParamType (ThingClass: onOffButton, EventType: pressed, ID: {2e6bc343-41a3-4634-b514-4512ae54afbc})
+
+
+
+
+ Button pressed
+ The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of ThingClass onOffButton
+
+
+
+
+ Power Button
+ The name of the ThingClass ({c0f511f9-70f5-499b-bd70-2c0e9ddd68c4})
+
+
+
+
+ Trigger button
+ The name of the ThingClass ({5f91923e-fc8e-48db-9de7-9a2fc36798dd})
+
+
+
+
+ off
+ The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of ThingClass onOffButton
+
+
+
+
+ on
+ The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of ThingClass onOffButton
+
+
+
+
+ power changed
+ The name of the EventType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
+
+
+
+ pressThe name of the ActionType ({01f38af1-b2ab-4ec3-844e-ef52f0f229a9}) of ThingClass button
-
+
+ set power
+ The name of the ActionType ({b5e90567-54aa-49bd-a78a-3c19fb38aaf5}) of ThingClass powerButton
+
+
+
+
+ trigger
+ The name of the ActionType ({da322b8e-2116-4565-805a-03f7726373c8}) of ThingClass triggerButton
+
+
+
+
+ triggered
+ The name of the EventType ({51197853-0559-42a0-a97b-6ead56ae22f6}) of ThingClass triggerButton
+
+
+
+ button pressedThe name of the EventType ({effdbc2d-e467-4b0b-80a9-9dda251bfa5c}) of ThingClass button
-
+ ON/OFF ButtonThe name of the ThingClass ({430d188c-476d-4825-a9bd-86dfa3094b56})
-
-
- press ON
- The name of the ActionType ({892596d2-0863-4807-97da-469b9f7003f2}) of ThingClass onOffButton
-
-
-
-
- press OFF
- The name of the ActionType ({a8d64050-0b58-4ccf-b052-77ce2b7368ad}) of ThingClass onOffButton
-
-
-
-
- ON pressed
- The name of the EventType ({4eeba6a2-e4c7-4a2e-8360-2797d98114e6}) of ThingClass onOffButton
-
-
-
-
- OFF pressed
- The name of the EventType ({b636c5f3-2eb0-4682-96d4-88a4aa9d2c12}) of ThingClass onOffButton
-
-