Migrate simulation plugin

This commit is contained in:
Simon Stürz 2018-02-09 19:12:45 +01:00 committed by Michael Zanetti
parent 7e57a7b5fb
commit 4f74cfd77f
5 changed files with 299 additions and 279 deletions

1
debian/control vendored
View File

@ -430,6 +430,7 @@ Description: guh.io plugin for TCP commander
. .
This package will install the guh.io plugin for TCP commander This package will install the guh.io plugin for TCP commander
Package: guh-plugin-simulation Package: guh-plugin-simulation
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, Depends: ${shlibs:Depends},

View File

@ -1,6 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> * * Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
* * * *
* This file is part of guh. * * This file is part of guh. *
* * * *
@ -24,15 +25,15 @@
DevicePluginSimulation::DevicePluginSimulation() DevicePluginSimulation::DevicePluginSimulation()
{ {
} }
void DevicePluginSimulation::init()
DeviceManager::HardwareResources DevicePluginSimulation::requiredHardware() const
{ {
return DeviceManager::HardwareResourceTimer; m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10);
connect(m_pluginTimer, &PluginTimer::timeout, this, &DevicePluginSimulation::onPluginTimer);
} }
DeviceManager::DeviceSetupStatus DevicePluginSimulation::setupDevice(Device *device) DeviceManager::DeviceSetupStatus DevicePluginSimulation::setupDevice(Device *device)
{ {
Q_UNUSED(device) Q_UNUSED(device)
@ -49,7 +50,7 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
if (device->deviceClassId() == simpleButtonDeviceClassId ) { if (device->deviceClassId() == simpleButtonDeviceClassId ) {
// check if this is the "press" action // check if this is the "press" action
if (action.actionTypeId() == pressSimpleButtonActionTypeId) { if (action.actionTypeId() == simpleButtonTriggerActionTypeId) {
// Emit the "button pressed" event // Emit the "button pressed" event
@ -61,21 +62,21 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;
} }
// Check the DeviceClassId for "Alternative Power Button" // Check the DeviceClassId for "Alternative Button"
if (device->deviceClassId() == alternativePowerButtonDeviceClassId) { if (device->deviceClassId() == alternativeButtonDeviceClassId) {
// check if this is the "set power" action // check if this is the "set power" action
if (action.actionTypeId() == alternativePowerActionTypeId) { if (action.actionTypeId() == alternativeButtonPowerActionTypeId) {
// get the param value // get the param value
Param powerParam = action.param(alternativePowerStateParamTypeId); Param powerParam = action.param(alternativeButtonPowerStateParamTypeId);
bool power = powerParam.value().toBool(); bool power = powerParam.value().toBool();
qCDebug(dcSimulation) << "ActionTypeId :" << action.actionTypeId().toString(); qCDebug(dcSimulation) << "ActionTypeId :" << action.actionTypeId().toString();
qCDebug(dcSimulation) << "StateTypeId :" << alternativePowerStateTypeId.toString(); qCDebug(dcSimulation) << "StateTypeId :" << alternativeButtonPowerStateTypeId.toString();
// Set the "power" state // Set the "power" state
device->setStateValue(alternativePowerStateTypeId, power); device->setStateValue(alternativeButtonPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
@ -85,44 +86,44 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
if (device->deviceClassId() == heatingDeviceClassId) { if (device->deviceClassId() == heatingDeviceClassId) {
// check if this is the "set power" action // check if this is the "set power" action
if (action.actionTypeId() == powerActionTypeId) { if (action.actionTypeId() == heatingPowerActionTypeId) {
// get the param value // get the param value
Param powerParam = action.param(powerStateParamTypeId); Param powerParam = action.param(heatingPowerStateParamTypeId);
bool power = powerParam.value().toBool(); bool power = powerParam.value().toBool();
// Set the "power" state // Set the "power" state
device->setStateValue(powerStateTypeId, power); device->setStateValue(heatingPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
}else if (action.actionTypeId() == targetTemperatureActionTypeId) { } else if (action.actionTypeId() == heatingTargetTemperatureActionTypeId) {
// get the param value // get the param value
Param temperatureParam = action.param(targetTemperatureStateParamTypeId); Param temperatureParam = action.param(heatingTargetTemperatureStateParamTypeId);
int temperature = temperatureParam.value().toInt(); int temperature = temperatureParam.value().toInt();
// Set the "temperature" state // Set the "temperature" state
device->setStateValue(targetTemperatureStateTypeId, temperature); device->setStateValue(heatingTargetTemperatureStateTypeId, temperature);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;
} }
if(device->deviceClassId() == evChargerDeviceClassId){ if (device->deviceClassId() == evChargerDeviceClassId){
if(action.actionTypeId() == evPowerActionTypeId){ if (action.actionTypeId() == evChargerPowerActionTypeId){
// get the param value // get the param value
Param powerParam = action.param(evPowerStateParamTypeId); Param powerParam = action.param(evChargerPowerStateParamTypeId);
bool power = powerParam.value().toBool(); bool power = powerParam.value().toBool();
// Set the "power" state // Set the "power" state
device->setStateValue(evPowerStateTypeId, power); device->setStateValue(evChargerPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
}else if(action.actionTypeId() == evCurrentActionTypeId){ } else if(action.actionTypeId() == evChargerCurrentActionTypeId){
// get the param value // get the param value
Param currentParam = action.param(evCurrentStateParamTypeId); Param currentParam = action.param(evChargerCurrentStateParamTypeId);
int current = currentParam.value().toInt(); int current = currentParam.value().toInt();
// Set the "current" state // Set the "current" state
device->setStateValue(evCurrentStateTypeId, current); device->setStateValue(evChargerCurrentStateTypeId, current);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;
@ -141,26 +142,26 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;
} }
if(device->deviceClassId() == rgbBulbDeviceClassId){ if(device->deviceClassId() == colorBulbDeviceClassId){
if(action.actionTypeId() == bulbBrightnessActionTypeId){ if(action.actionTypeId() == colorBulbBrightnessActionTypeId){
int brightness = action.param(bulbBrightnessStateParamTypeId).value().toInt(); int brightness = action.param(colorBulbBrightnessStateParamTypeId).value().toInt();
device->setStateValue(bulbBrightnessStateTypeId, brightness); device->setStateValue(colorBulbBrightnessStateTypeId, brightness);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if (action.actionTypeId() == bulbTemperatureActionTypeId){ } else if (action.actionTypeId() == colorBulbColorTemperatureActionTypeId){
int temperature = action.param(bulbTemperatureStateParamTypeId).value().toInt(); int temperature = action.param(colorBulbColorTemperatureStateParamTypeId).value().toInt();
device->setStateValue(bulbTemperatureStateTypeId, temperature); device->setStateValue(colorBulbColorTemperatureStateTypeId, temperature);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if (action.actionTypeId() == bulbColorActionTypeId) { } else if (action.actionTypeId() == colorBulbColorActionTypeId) {
QVariant color = action.param(bulbColorStateParamTypeId).value(); QVariant color = action.param(colorBulbColorStateParamTypeId).value();
device->setStateValue(bulbColorStateTypeId, color); device->setStateValue(colorBulbColorStateTypeId, color);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if (action.actionTypeId() == bulbPowerActionTypeId) { } else if (action.actionTypeId() == colorBulbPowerActionTypeId) {
bool power = action.param(bulbPowerStateParamTypeId).value().toBool(); bool power = action.param(colorBulbPowerStateParamTypeId).value().toBool();
device->setStateValue(bulbPowerStateTypeId, power); device->setStateValue(colorBulbPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
@ -169,17 +170,17 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
if (device->deviceClassId() == heatingRodDeviceClassId) { if (device->deviceClassId() == heatingRodDeviceClassId) {
if (action.actionTypeId() == powerActionTypeId) { if (action.actionTypeId() == heatingRodPowerActionTypeId) {
bool power = action.param(powerStateParamTypeId).value().toBool(); bool power = action.param(heatingRodPowerStateParamTypeId).value().toBool();
device->setStateValue(powerStateTypeId, power); device->setStateValue(heatingRodPowerStateTypeId, power);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if (action.actionTypeId() == waterTemperatureActionTypeId) { } else if (action.actionTypeId() == heatingRodWaterTemperatureActionTypeId) {
int temperature = action.param(waterTemperatureStateParamTypeId).value().toInt(); int temperature = action.param(heatingRodWaterTemperatureStateParamTypeId).value().toInt();
device->setStateValue(waterTemperatureStateTypeId, temperature); device->setStateValue(heatingRodWaterTemperatureStateTypeId, temperature);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} else if (action.actionTypeId() == maxPowerActionTypeId) { } else if (action.actionTypeId() == heatingRodMaxPowerActionTypeId) {
double maxPower = action.param(maxPowerStateParamTypeId).value().toDouble(); double maxPower = action.param(heatingRodMaxPowerStateParamTypeId).value().toDouble();
device->setStateValue(maxPowerStateTypeId, maxPower); device->setStateValue(heatingRodMaxPowerStateTypeId, maxPower);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
@ -187,46 +188,47 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device,
} }
if (device->deviceClassId() == batteryDeviceClassId) { if (device->deviceClassId() == batteryDeviceClassId) {
if (action.actionTypeId() == maxChargingActionTypeId) { if (action.actionTypeId() == batteryMaxChargingActionTypeId) {
int maxCharging = action.param(maxChargingStateParamTypeId).value().toInt(); int maxCharging = action.param(batteryMaxChargingStateParamTypeId).value().toInt();
device->setStateValue(maxChargingStateTypeId, maxCharging); device->setStateValue(batteryMaxChargingStateTypeId, maxCharging);
device->setStateValue(chargingBatteryStateTypeId, ((double)maxCharging-10)/1000); device->setStateValue(batteryChargingStateTypeId, ((double)maxCharging-10)/1000);
return DeviceManager::DeviceErrorNoError; return DeviceManager::DeviceErrorNoError;
} }
return DeviceManager::DeviceErrorActionTypeNotFound; return DeviceManager::DeviceErrorActionTypeNotFound;
} }
return DeviceManager::DeviceErrorDeviceClassNotFound; return DeviceManager::DeviceErrorDeviceClassNotFound;
} }
void DevicePluginSimulation::guhTimer(){
foreach (Device *device, myDevices()) {
if (device->deviceClassId() == temperatureSensorDeviceClassId) {
//generate Random Number
double temperature = ((double)getRandomNumber(200, 230)/10.0);
device->setStateValue(temperatureStateTypeId, temperature);
device->setStateValue(humidityStateTypeId, getRandomNumber(40, 60));
device->setStateValue(batteryStateTypeId, 93);
device->setStateValue(reachableStateTypeId, true);
}else if(device->deviceClassId() == motionDetectorDeviceClassId){
bool active = true;
if(getRandomNumber(0, 60)){
active = false;
}
device->setStateValue(activeStateTypeId, active);
device->setStateValue(batteryStateTypeId, 82);
device->setStateValue(reachableStateTypeId, true);
}else if(device->deviceClassId() == evChargerDeviceClassId){
}
}
}
int DevicePluginSimulation::getRandomNumber(const int Min, const int Max) int DevicePluginSimulation::getRandomNumber(const int Min, const int Max)
{ {
return ((qrand() % ((Max + 1) - Min)) + Min); return ((qrand() % ((Max + 1) - Min)) + Min);
} }
void DevicePluginSimulation::onPluginTimer()
{
foreach (Device *device, myDevices()) {
if (device->deviceClassId() == temperatureSensorDeviceClassId) {
//generate Random Number
double temperature = ((double)getRandomNumber(200, 230)/10.0);
device->setStateValue(temperatureSensorTemperatureStateTypeId, temperature);
device->setStateValue(temperatureSensorHumidityStateTypeId, getRandomNumber(40, 60));
device->setStateValue(temperatureSensorBatteryLevelStateTypeId, getRandomNumber(10, 100));
device->setStateValue(temperatureSensorBatteryCriticalStateTypeId, device->stateValue(temperatureSensorBatteryLevelStateTypeId).toDouble() <= 30);
device->setStateValue(temperatureSensorConnectedStateTypeId, true);
} else if(device->deviceClassId() == motionDetectorDeviceClassId){
bool active = true;
if(getRandomNumber(0, 60)){
active = false;
}
device->setStateValue(motionDetectorActiveStateTypeId, active);
device->setStateValue(motionDetectorBatteryLevelStateTypeId, getRandomNumber(10, 100));
device->setStateValue(motionDetectorBatteryCriticalStateTypeId, device->stateValue(motionDetectorBatteryLevelStateTypeId).toDouble() <= 30);
device->setStateValue(motionDetectorConnectedStateTypeId, true);
} else if(device->deviceClassId() == evChargerDeviceClassId){
}
}
}

View File

@ -1,6 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> * * Copyright (C) 2017 Bernhard Trinnes <bernhard.trinnes@guh.io> *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> *
* * * *
* This file is part of guh. * * This file is part of guh. *
* * * *
@ -23,6 +24,7 @@
#include "plugin/deviceplugin.h" #include "plugin/deviceplugin.h"
#include "devicemanager.h" #include "devicemanager.h"
#include "plugintimer.h"
class DevicePluginSimulation : public DevicePlugin class DevicePluginSimulation : public DevicePlugin
{ {
@ -35,15 +37,18 @@ class DevicePluginSimulation : public DevicePlugin
public: public:
explicit DevicePluginSimulation(); explicit DevicePluginSimulation();
DeviceManager::HardwareResources requiredHardware() const override; void init() override;
DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; DeviceManager::DeviceSetupStatus setupDevice(Device *device) override;
DeviceManager::DeviceError executeAction(Device *device, const Action &action) override; DeviceManager::DeviceError executeAction(Device *device, const Action &action) override;
void guhTimer() override;
private: private:
PluginTimer *m_pluginTimer = nullptr;
int getRandomNumber(const int min, const int max); int getRandomNumber(const int min, const int max);
private slots:
void onPluginTimer();
}; };
#endif // DEVICEPLUGINSIMMULATION_H #endif // DEVICEPLUGINSIMMULATION_H

View File

@ -1,58 +1,58 @@
{ {
"name": "Simulation", "name": "Simulation",
"idName": "Simulation", "displayName": "Simulation",
"id": "b7368429-e312-4c82-9eab-e1cd996e43d6", "id": "b7368429-e312-4c82-9eab-e1cd996e43d6",
"vendors": [ "vendors": [
{ {
"name": "Simulated Devices", "name": "simulation",
"idName": "simulation", "displayName": "Simulation",
"id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf", "id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf",
"interfaces": ["simplebutton"],
"deviceClasses": [ "deviceClasses": [
{ {
"id": "73bb670b-e7a3-40da-bd6f-3260f017ec80", "id": "73bb670b-e7a3-40da-bd6f-3260f017ec80",
"idName": "simpleButton", "name": "simpleButton",
"name": "Simple Button", "displayName": "Simple Button",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Switch", "deviceIcon": "Switch",
"interfaces": ["simplebutton", "outputtrigger"],
"basicTags": [ "basicTags": [
"Device" "Device"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"actionTypes": [ "actionTypes": [
{ {
"id": "64c4ced5-9a1a-4858-81dd-1b5c94dba495", "id": "64c4ced5-9a1a-4858-81dd-1b5c94dba495",
"idName": "pressSimpleButton", "name": "trigger",
"name": "press the button" "displayName": "Press the button"
} }
], ],
"eventTypes": [ "eventTypes": [
{ {
"id": "f9652210-9aed-4f38-8c19-2fd54f703fbe", "id": "f9652210-9aed-4f38-8c19-2fd54f703fbe",
"idName": "simpleButtonPressed", "name": "pressed",
"name": "button pressed" "displayName": "Button pressed"
} }
] ]
}, },
{ {
"id": "910b2f58-70dc-4da3-89ae-9e7393290ccb", "id": "910b2f58-70dc-4da3-89ae-9e7393290ccb",
"idName": "alternativePowerButton", "name": "alternativeButton",
"name": "Power Button", "displayName": "Power Button",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Switch", "deviceIcon": "Switch",
"basicTags": [ "basicTags": [
"Device" "Device"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "fa63c0b9-10e5-4280-9cc2-243bf27c05ad", "id": "fa63c0b9-10e5-4280-9cc2-243bf27c05ad",
"idName": "alternativePower",
"name": "power", "name": "power",
"displayName": "Power",
"type": "bool", "type": "bool",
"eventTypeName": "power changed", "displayNameEvent": "Power changed",
"actionTypeName": "set power", "displayNameAction": "Set power",
"defaultValue": false, "defaultValue": false,
"index" : 0, "index" : 0,
"writable": true "writable": true
@ -61,135 +61,154 @@
}, },
{ {
"id": "77c6ccff-84e8-4983-b69e-5e1a3f4723f2", "id": "77c6ccff-84e8-4983-b69e-5e1a3f4723f2",
"idName": "temperatureSensor", "name": "temperatureSensor",
"name": "Temperature Sensor", "displayName": "Temperature sensor",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Thermometer", "deviceIcon": "Thermometer",
"criticalStateTypeId": "e66aba37-2647-4b6b-8740-d59eb98d846c", "interfaces": ["temperaturesensor", "humiditysensor", "battery", "connectable"],
"primaryStateTypeId": "169d7a2a-d1c9-4578-bb30-fc7d25690e59",
"basicTags": [ "basicTags": [
"Device", "Device",
"Sensor" "Sensor"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "169d7a2a-d1c9-4578-bb30-fc7d25690e59", "id": "169d7a2a-d1c9-4578-bb30-fc7d25690e59",
"idName": "temperature",
"name": "temperature", "name": "temperature",
"displayName": "Temperature",
"displayNameEvent": "Temperature changed",
"type": "double", "type": "double",
"unit": "DegreeCelsius", "unit": "DegreeCelsius",
"eventTypeName": "temperature changed",
"defaultValue": 0 "defaultValue": 0
}, },
{ {
"id": "10c735fd-7b81-484a-a148-76ea0da840f0", "id": "10c735fd-7b81-484a-a148-76ea0da840f0",
"idName": "humidity",
"name": "humidity", "name": "humidity",
"type": "int", "displayName": "Humidity",
"displayNameEvent": "Humidity changed",
"type": "double",
"minValue": 0,
"maxValue": 100,
"unit": "Percentage", "unit": "Percentage",
"eventTypeName": "humidity changed",
"defaultValue": 0 "defaultValue": 0
}, },
{ {
"id": "45c0de32-b519-47d7-9f82-e5f09d1542d4", "id": "45c0de32-b519-47d7-9f82-e5f09d1542d4",
"idName": "battery", "name": "batteryLevel",
"name": "battery", "displayName": "Battery",
"displayNameEvent": "Battery level changed",
"type": "int", "type": "int",
"minValue": 0,
"maxValue": 100,
"unit": "Percentage", "unit": "Percentage",
"eventTypeName": "battery changed",
"defaultValue": 0 "defaultValue": 0
}, },
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "295b9a17-a4b1-4cc9-8ebb-2309b72c75f6",
"idName": "reachable", "name": "batteryCritical",
"name": "reachable", "displayName": "Battery critical",
"displayNameEvent": "Battery critical changed",
"type": "bool",
"defaultValue": false
},
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
} }
] ]
}, },
{ {
"id": "990fc2ba-260a-4648-9a93-e803e219da4f", "id": "990fc2ba-260a-4648-9a93-e803e219da4f",
"idName": "motionDetector", "name": "motionDetector",
"name": "Motion Detector", "displayName": "Motion Detector",
"createMethods": ["user"], "createMethods": ["user"],
"interfaces": ["battery", "connectable"],
"deviceIcon": "MotionDetectors", "deviceIcon": "MotionDetectors",
"basicTags": [ "basicTags": [
"Device", "Device",
"Sensor" "Sensor"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "5ab00bfc-7345-44a2-90d4-852c810e59ec", "id": "5ab00bfc-7345-44a2-90d4-852c810e59ec",
"idName": "active",
"name": "active", "name": "active",
"displayName": "Active",
"displayNameEvent": "Motion detected",
"type": "bool", "type": "bool",
"eventTypeName": "motion detected",
"defaultValue": false "defaultValue": false
}, },
{ {
"id": "45c0de32-b519-47d7-9f82-e5f09d1542d4", "id": "4d66c81e-6293-4997-9685-8b44d7e5c1bd",
"idName": "battery", "name": "batteryLevel",
"name": "battery", "displayName": "Battery",
"displayNameEvent": "Battery level changed",
"type": "int", "type": "int",
"unit": "Percentage", "unit": "Percentage",
"eventTypeName": "battery changed", "minValue": 0,
"defaultValue": 100 "maxValue": 100,
"defaultValue": 95
}, },
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "1c621a6f-86fe-4351-bf9e-03c3deaef6ad",
"idName": "reachable", "name": "batteryCritical",
"name": "reachable", "displayName": "Battery critical",
"displayNameEvent": "Battery critical changed",
"type": "bool",
"defaultValue": false
},
{
"id": "b481b6e7-77c1-40b0-859a-286876b05959",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
} }
] ]
}, },
{ {
"id": "62e302f4-b92a-4b55-bd18-a1e0cc56362a", "id": "62e302f4-b92a-4b55-bd18-a1e0cc56362a",
"idName": "heating", "name": "heating",
"name": "Heating", "displayName": "Heating",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Radiator", "deviceIcon": "Radiator",
"basicTags": [ "basicTags": [
"Device", "Device",
"Actuator" "Actuator"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "e1910c53-a6bc-434b-9caa-0d08e214c122", "id": "e1910c53-a6bc-434b-9caa-0d08e214c122",
"idName": "power",
"name": "power", "name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool", "type": "bool",
"eventTypeName": "power changed",
"actionTypeName": "change power",
"defaultValue": 0, "defaultValue": 0,
"writable": true "writable": true
}, },
{ {
"id": "47a16375-1027-42cc-82d3-56cbfdb1193c", "id": "47a16375-1027-42cc-82d3-56cbfdb1193c",
"idName": "heatingActive", "name": "heatingActive",
"name": "active", "displayName": "Active",
"displayNameEvent": "Active status changed",
"type": "bool", "type": "bool",
"eventTypeName": "active status changed",
"defaultValue": false "defaultValue": false
}, },
{ {
"id": "8256a670-85c5-4043-9133-05518812848c", "id": "8256a670-85c5-4043-9133-05518812848c",
"idName": "targetTemperature", "name": "targetTemperature",
"name": "target", "displayName": "Target temperature",
"displayNameEvent": "target temperature changed",
"displayNameAction": "change target temperature",
"type": "int", "type": "int",
"unit": "DegreeCelsius", "unit": "DegreeCelsius",
"eventTypeName": "target temperature changed",
"actionTypeName": "change target temperature",
"defaultValue": 0, "defaultValue": 0,
"writable": true "writable": true
} }
@ -197,100 +216,95 @@
}, },
{ {
"id": "1fa40afa-6a07-4a97-918b-76e3944ea0fb", "id": "1fa40afa-6a07-4a97-918b-76e3944ea0fb",
"idName": "evCharger", "name": "evCharger",
"name": "EV Charging Station", "displayName": "EV Charging Station",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Energy", "deviceIcon": "Energy",
"basicTags": [ "basicTags": [
"Device", "Device",
"Actuator" "Actuator"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "b786029d-f3a6-4b47-978a-ac1a581aac0f", "id": "b786029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "evPower",
"name": "power", "name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool", "type": "bool",
"eventTypeName": "power changed",
"actionTypeName": "change power",
"defaultValue": 0, "defaultValue": 0,
"writable": true "writable": true
}, },
{ {
"id": "87600986-da37-4032-af37-015995910368", "id": "87600986-da37-4032-af37-015995910368",
"idName": "evCurrent",
"name": "current", "name": "current",
"displayName": "Current",
"displayNameEvent": "Current changed",
"displayNameAction": "Set current",
"type": "int", "type": "int",
"unit": "Ampere", "unit": "Ampere",
"minValue": 6, "minValue": 6,
"maxValue": 64, "maxValue": 64,
"eventTypeName": "target temperature changed",
"actionTypeName": "change target temperature",
"defaultValue": 6, "defaultValue": 6,
"writable": true "writable": true
}, },
{ {
"id": "9d3f56e1-bb73-4efd-814c-50477c609c17", "id": "9d3f56e1-bb73-4efd-814c-50477c609c17",
"idName": "evCharging", "name": "evCharging",
"name": "charging", "displayName": "charging",
"type": "bool", "type": "bool",
"eventTypeName": "charging status changed", "displayNameEvent": "charging status changed",
"defaultValue": false "defaultValue": false
} }
] ]
}, },
{ {
"id": "cfb44bcf-b4b9-4bef-89f7-3a55baf35668", "id": "cfb44bcf-b4b9-4bef-89f7-3a55baf35668",
"idName": "garageDoor", "name": "garageDoor",
"name": "Garage Door", "displayName": "Garage Door",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Garage", "deviceIcon": "Garage",
"basicTags": [ "basicTags": [
"Device", "Device",
"Actuator" "Actuator"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "f786029d-f3a6-4b47-978a-ac1a581aac0f", "id": "f786029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "door",
"name": "door", "name": "door",
"displayName": "Garage door",
"displayNameEvent": "Garage door status changed",
"type": "bool", "type": "bool",
"eventTypeName": "door status changed",
"defaultValue": false "defaultValue": false
} }
], ],
"actionTypes": [ "actionTypes": [
{ {
"id": "1786029d-f3a6-4b47-978a-ac1a581aac0f", "id": "1786029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "garageOpen",
"name": "open", "name": "open",
"type": "bool", "displayName": "Open",
"eventTypeName": "door opening" "type": "bool"
}, },
{ {
"id": "2786029d-f3a6-4b47-978a-ac1a581aac0f", "id": "2786029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "garageStop",
"name": "stop", "name": "stop",
"type": "bool", "displayName": "Stop",
"eventTypeName": "door stopping" "type": "bool"
}, },
{ {
"id": "3786029d-f3a6-4b47-978a-ac1a581aac0f", "id": "3786029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "garageClose",
"name": "close", "name": "close",
"type": "bool", "displayName": "Close",
"eventTypeName": "door closing" "type": "bool"
} }
] ]
}, },
{ {
"id": "1039b7ee-5351-400b-a477-5b8fc1447138", "id": "1039b7ee-5351-400b-a477-5b8fc1447138",
"idName": "rollerShutter", "name": "rollerShutter",
"name": "Roller Shutter", "displayName": "Roller Shutter",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "RollerShutter", "deviceIcon": "RollerShutter",
"basicTags": [ "basicTags": [
@ -298,72 +312,68 @@
"Actuator", "Actuator",
"Shading" "Shading"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "1386029d-f3a6-4b47-978a-ac1a581aac0f", "id": "1386029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "shutterStatus", "name": "shutterStatus",
"name": "status", "displayName": "Status",
"type": "int", "type": "int",
"unit": "Percentage", "unit": "Percentage",
"eventTypeName": "shutter status changed", "displayNameEvent": "Shutter status changed",
"defaultValue": 0 "defaultValue": 0
} }
], ],
"actionTypes": [ "actionTypes": [
{ {
"id": "17860291-f3a6-4b47-978a-ac1a581aac0f", "id": "17860291-f3a6-4b47-978a-ac1a581aac0f",
"idName": "shutterOpen",
"name": "open", "name": "open",
"type": "bool", "displayName": "Open",
"eventTypeName": "shutter opening" "type": "bool"
}, },
{ {
"id": "27860292-f3a6-4b47-978a-ac1a581aac0f", "id": "27860292-f3a6-4b47-978a-ac1a581aac0f",
"idName": "shutterStop",
"name": "stop", "name": "stop",
"type": "bool", "displayName": "stop",
"eventTypeName": "shutter stopping" "type": "bool"
}, },
{ {
"id": "37860293-f3a6-4b47-978a-ac1a581aac0f", "id": "37860293-f3a6-4b47-978a-ac1a581aac0f",
"idName": "shutterClose",
"name": "close", "name": "close",
"type": "bool", "displayName": "close",
"eventTypeName": "shutter closing" "type": "bool"
} }
] ]
}, },
{ {
"id": "1039b7ee-5121-400b-a477-5b8fc14471ff", "id": "1039b7ee-5121-400b-a477-5b8fc14471ff",
"idName": "rgbBulb", "name": "colorBulb",
"name": "Color Bulb", "displayName": "Color Bulb",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "LightBulb", "deviceIcon": "LightBulb",
"interfaces": ["colorlight"],
"basicTags": [ "basicTags": [
"Device", "Device",
"Actuator" "Actuator"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "9faaffe5-6a76-47d2-a14a-550f60390245", "id": "9faaffe5-6a76-47d2-a14a-550f60390245",
"idName": "bulbPower",
"name": "power", "name": "power",
"eventTypeName": "power changed", "displayName": "Power",
"actionTypeName": "Set power", "displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool", "type": "bool",
"defaultValue": false, "defaultValue": false,
"writable": true "writable": true
}, },
{ {
"id": "cff4206f-f219-4f06-93c4-4ca515a56f79", "id": "cff4206f-f219-4f06-93c4-4ca515a56f79",
"idName": "bulbTemperature", "name": "colorTemperature",
"name": "color temperature", "displayName": "Color temperature",
"eventTypeName": "color temperature changed", "displayNameEvent": "Color temperature changed",
"actionTypeName": "Set color temperature", "displayNameAction": "Set color temperature",
"type": "int", "type": "int",
"unit": "Mired", "unit": "Mired",
"defaultValue": 170, "defaultValue": 170,
@ -375,23 +385,22 @@
}, },
{ {
"id": "df5423f1-b924-4b20-80b6-77eecc65d089", "id": "df5423f1-b924-4b20-80b6-77eecc65d089",
"idName": "bulbColor",
"name": "color", "name": "color",
"eventTypeName": "color changed", "displayName": "Color",
"actionTypeName": "Set color", "displayNameEvent": "Color changed",
"displayNameAction": "Set color",
"type": "QColor", "type": "QColor",
"ruleRelevant": false, "ruleRelevant": false,
"eventRuleRelevant": false, "eventRuleRelevant": false,
"defaultValue": "#000000", "defaultValue": "#000000",
"writable": true "writable": true
}, },
{ {
"id": "90e91f11-a208-468c-a5a2-7f47e08229e2", "id": "90e91f11-a208-468c-a5a2-7f47e08229e2",
"idName": "bulbBrightness",
"name": "brightness", "name": "brightness",
"eventTypeName": "brightness changed", "displayName": "Brightness",
"actionTypeName": "Set brigtness", "displayNameEvent": "Brightness changed",
"displayNameAction": "Set brigtness",
"type": "int", "type": "int",
"ruleRelevant": false, "ruleRelevant": false,
"eventRuleRelevant": false, "eventRuleRelevant": false,
@ -405,24 +414,23 @@
}, },
{ {
"id": "1039b7ee-5351-400b-a477-5b8fc14471ff", "id": "1039b7ee-5351-400b-a477-5b8fc14471ff",
"idName": "socket", "name": "socket",
"name": "Socket", "displayName": "Socket",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Socket", "deviceIcon": "Socket",
"basicTags": [ "basicTags": [
"Device", "Device",
"Actuator" "Actuator"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "b7ff029d-f3a6-4b47-978a-ac1a581aac0f", "id": "b7ff029d-f3a6-4b47-978a-ac1a581aac0f",
"idName": "socketPower",
"name": "power", "name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",
"displayNameAction": "Set power",
"type": "bool", "type": "bool",
"eventTypeName": "power changed",
"actionTypeName": "change power",
"defaultValue": false, "defaultValue": false,
"writable": true "writable": true
} }
@ -430,76 +438,76 @@
}, },
{ {
"id": "45906fb3-9bf5-4331-9b69-0a0407b8511e", "id": "45906fb3-9bf5-4331-9b69-0a0407b8511e",
"idName": "fingerPrintSensor", "name": "fingerPrintSensor",
"name": "Finger Print Sensor", "displayName": "Finger Print Sensor",
"createMethods": ["user"], "createMethods": ["user"],
"interfaces": ["connectable"],
"deviceIcon": "Network", "deviceIcon": "Network",
"basicTags": [ "basicTags": [
"Device", "Device",
"Sensor" "Sensor"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"idName": "reachable", "name": "connected",
"name": "reachable", "displayName": "Connected",
"displayNameEvent": "Connected changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
} }
], ],
"eventTypes": [ "eventTypes": [
{ {
"id": "1d2dde79-7121-4f8c-b7c1-904ced66a79e", "id": "1d2dde79-7121-4f8c-b7c1-904ced66a79e",
"idName": "accessGranted", "name": "accessGranted",
"name": "access granted" "displayName": "Access granted"
}, },
{ {
"id": "992b7742-af0c-447c-bd94-9ec70b872268", "id": "992b7742-af0c-447c-bd94-9ec70b872268",
"idName": "accessDenied", "name": "accessDenied",
"name": "access denied" "displayName": "Access denied"
} }
] ]
}, },
{ {
"id": "c242f229-d3f4-4d3d-854c-817b52aa18ab", "id": "c242f229-d3f4-4d3d-854c-817b52aa18ab",
"idName": "smartMeter", "name": "smartMeter",
"name": "Smart Meter", "displayName": "Smart Meter",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Energy", "deviceIcon": "Energy",
"interfaces": ["connectable"],
"basicTags": [ "basicTags": [
"Device" "Device"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"idName": "reachable", "name": "connected",
"name": "reachable", "displayName": "Reachable",
"displayNameEvent": "Reachable changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
}, },
{ {
"id": "d57f4d9c-759e-40eb-999e-a1acbc8df2b1", "id": "d57f4d9c-759e-40eb-999e-a1acbc8df2b1",
"idName": "powerSmartMeter", "name": "powerConsumption",
"name": "Power", "displayName": "Power consumtion",
"displayNameEvent": "Power consumption changed",
"type": "double", "type": "double",
"unit": "KiloWatt", "unit": "KiloWatt",
"eventTypeName": "power consumption changed",
"eventRuleRelevant": false, "eventRuleRelevant": false,
"defaultValue": 3.70 "defaultValue": 3.70
}, },
{ {
"id": "5ac91819-c855-441c-a734-ee5cc0514822", "id": "5ac91819-c855-441c-a734-ee5cc0514822",
"idName": "energyTodaySmartMeter", "name": "energyToday",
"name": "Energy Today", "displayName": "Today's energy production",
"displayNameEvent": "Today's energy production changed",
"type": "double", "type": "double",
"unit": "KiloWatt", "unit": "KiloWatt",
"eventTypeName": "today's energy production changed",
"ruleRelevant": false, "ruleRelevant": false,
"eventRuleRelevant": false, "eventRuleRelevant": false,
"defaultValue": 13.45 "defaultValue": 13.45
@ -508,29 +516,29 @@
}, },
{ {
"id": "280c481e-757a-4af7-b1d3-dc9cfc1d46a5", "id": "280c481e-757a-4af7-b1d3-dc9cfc1d46a5",
"idName": "battery", "name": "battery",
"name": "Battery", "displayName": "Battery",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Battery", "deviceIcon": "Battery",
"interfaces": ["battery", "connectable"],
"basicTags": [ "basicTags": [
"Device" "Device"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"idName": "reachable", "name": "connected",
"name": "reachable", "displayName": "Reachable",
"displayNameEvent": "Reachable changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
}, },
{ {
"id": "30fd9fd9-1a6b-4698-93ac-6b2a1ba18500", "id": "30fd9fd9-1a6b-4698-93ac-6b2a1ba18500",
"idName": "batteryStatus", "name": "batteryLevel",
"name": "Battery Status", "displayName": "Battery level",
"eventTypeName": "battery status changed", "displayNameEvent": "Battery level changed",
"type": "int", "type": "int",
"unit": "Percentage", "unit": "Percentage",
"defaultValue": 91, "defaultValue": 91,
@ -539,65 +547,73 @@
}, },
{ {
"id": "c977e60a-e820-4647-addb-cf0b39732ffb", "id": "c977e60a-e820-4647-addb-cf0b39732ffb",
"idName": "chargingBattery", "name": "charging",
"name": "Charging", "displayName": "Charging",
"displayNameEvent": "Charging amount changed",
"type": "double", "type": "double",
"unit": "KiloWatt", "unit": "KiloWatt",
"eventTypeName": "charging amount changed",
"eventRuleRelevant": false, "eventRuleRelevant": false,
"defaultValue": 0.70 "defaultValue": 0.70
}, },
{ {
"id": "bdf328a6-eebc-4b67-8165-551bc21e9be6", "id": "bdf328a6-eebc-4b67-8165-551bc21e9be6",
"idName": "maxCharging", "name": "maxCharging",
"name": "Max Charging Power", "displayName": "Max charging power",
"eventTypeName": "max charging power changed", "displayNameEvent": "Max charging power changed",
"actionTypeName": "Set max charging power", "displayNameAction": "Set max charging power",
"type": "int", "type": "int",
"unit": "Watt", "unit": "Watt",
"defaultValue": 700, "defaultValue": 700,
"minValue": 0, "minValue": 0,
"maxValue": 2000, "maxValue": 2000,
"writable": true "writable": true
},
{
"id": "4857f2b4-0840-4c7e-82ff-bd881ae32cf9",
"name": "batteryCritical",
"displayName": "Battery critical",
"displayNameEvent": "Battery critical changed",
"type": "bool",
"defaultValue": false
} }
] ]
}, },
{ {
"id": "b2565887-443a-45ae-a2e7-67fb1b1003d8", "id": "b2565887-443a-45ae-a2e7-67fb1b1003d8",
"idName": "heatingRod", "name": "heatingRod",
"name": "Heating Rod", "displayName": "Heating Rod",
"createMethods": ["user"], "createMethods": ["user"],
"deviceIcon": "Thermometer", "deviceIcon": "Thermometer",
"interfaces": ["connectable"],
"basicTags": [ "basicTags": [
"Device" "Device"
], ],
"paramTypes": [ "paramTypes": [ ],
],
"stateTypes": [ "stateTypes": [
{ {
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c", "id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"idName": "reachable", "name": "connected",
"name": "reachable", "displayName": "Reachable",
"displayNameEvent": "Reachable changed",
"type": "bool", "type": "bool",
"eventTypeName": "reachable changed",
"defaultValue": true "defaultValue": true
}, },
{ {
"id": "e1910c53-a6bc-434b-9caa-0d08e214c122", "id": "e1910c53-a6bc-434b-9caa-0d08e214c122",
"idName": "power",
"name": "power", "name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",
"displayNameAction": "Power",
"type": "bool", "type": "bool",
"eventTypeName": "power changed",
"actionTypeName": "power",
"defaultValue": false, "defaultValue": false,
"writable": true "writable": true
}, },
{ {
"id": "2ab2a0fa-ea66-426c-ba22-d23b42c80883", "id": "2ab2a0fa-ea66-426c-ba22-d23b42c80883",
"idName": "maxPower", "name": "maxPower",
"name": "Max Power", "displayName": "Max power",
"eventTypeName": "max power changed", "displayNameEvent": "Max power changed",
"actionTypeName": "Set max power", "displayNameAction": "Set max power",
"type": "int", "type": "int",
"unit": "Watt", "unit": "Watt",
"defaultValue": 2000, "defaultValue": 2000,
@ -607,12 +623,12 @@
}, },
{ {
"id": "49388b11-8076-4698-8091-5c5f5762fd08", "id": "49388b11-8076-4698-8091-5c5f5762fd08",
"idName": "waterTemperature", "name": "waterTemperature",
"name": "target water temperature", "displayName": "Target water temperature",
"displayNameEvent": "Target water temperature changed",
"displayNameAction": "Set target water temperature",
"type": "int", "type": "int",
"unit": "DegreeCelsius", "unit": "DegreeCelsius",
"eventTypeName": "target water temperature changed",
"actionTypeName": "change target water temperature",
"minValue": 0, "minValue": 0,
"maxValue": 80, "maxValue": 80,
"defaultValue": 65, "defaultValue": 65,
@ -620,10 +636,10 @@
}, },
{ {
"id": "47a16375-1027-42cc-82d3-56cbfdb1193c", "id": "47a16375-1027-42cc-82d3-56cbfdb1193c",
"idName": "heatingActive", "name": "heatingActive",
"name": "active", "displayName": "Active",
"displayNameEvent": "Active status changed",
"type": "bool", "type": "bool",
"eventTypeName": "active status changed",
"defaultValue": false "defaultValue": false
} }
] ]

View File

@ -1,7 +1,3 @@
TRANSLATIONS = translations/en_US.ts \
translations/de_DE.ts
# Note: include after the TRANSLATIONS definition
include(../plugins.pri) include(../plugins.pri)
TARGET = $$qtLibraryTarget(guh_devicepluginsimulation) TARGET = $$qtLibraryTarget(guh_devicepluginsimulation)