diff --git a/simulation/devicepluginsimulation.cpp b/simulation/devicepluginsimulation.cpp new file mode 100644 index 00000000..9bf34741 --- /dev/null +++ b/simulation/devicepluginsimulation.cpp @@ -0,0 +1,246 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2015 Simon Stuerz * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "devicepluginsimulation.h" +#include "plugininfo.h" + +// Note: You can find the tutorial for this code here -> http://dev.guh.guru/write-plugins.html + +/* The constructor of this device plugin. */ +DevicePluginSimulation::DevicePluginSimulation() +{ +} + +/* This method will be called from the devicemanager to get + * information about this plugin which device resource will be needed. + * + * For multiple resources use the OR operator: + * Example: + * + * return DeviceManager::HardwareResourceTimer | DeviceManager::HardwareResourceNetworkManager; + */ +DeviceManager::HardwareResources DevicePluginSimulation::requiredHardware() const +{ + return DeviceManager::HardwareResourceTimer; +} + +/* This method will be called from the devicemanager while he + * is setting up a new device. Here the developer has the chance to + * perform the setup on the actual device and report the result. + */ +DeviceManager::DeviceSetupStatus DevicePluginSimulation::setupDevice(Device *device) +{ + Q_UNUSED(device) + qCDebug(dcSimulation) << device->params(); + + return DeviceManager::DeviceSetupStatusSuccess; +} + +/* This method will be called whenever a client or the RuleEngine want's to execute + * an action on the given device. + */ +DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device, const Action &action) +{ + + // Check the DeviceClassId for "Simple Button" + if (device->deviceClassId() == simpleButtonDeviceClassId ) { + + // check if this is the "press" action + if (action.actionTypeId() == pressSimpleButtonActionTypeId) { + + + // Emit the "button pressed" event + Event event(simpleButtonPressedEventTypeId, device->id()); + emit emitEvent(event); + + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + // Check the DeviceClassId for "Alternative Power Button" + if (device->deviceClassId() == alternativePowerButtonDeviceClassId) { + + // check if this is the "set power" action + if (action.actionTypeId() == alternativePowerActionTypeId) { + + // get the param value + Param powerParam = action.param(alternativePowerStateParamTypeId); + bool power = powerParam.value().toBool(); + + qCDebug(dcSimulation) << "ActionTypeId :" << action.actionTypeId().toString(); + qCDebug(dcSimulation) << "StateTypeId :" << alternativePowerStateTypeId.toString(); + + // Set the "power" state + device->setStateValue(alternativePowerStateTypeId, power); + + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == heatingDeviceClassId) { + + // check if this is the "set power" action + if (action.actionTypeId() == powerActionTypeId) { + + // get the param value + Param powerParam = action.param(powerStateParamTypeId); + bool power = powerParam.value().toBool(); + // Set the "power" state + device->setStateValue(powerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + + }else if (action.actionTypeId() == targetTemperatureActionTypeId) { + + // get the param value + Param temperatureParam = action.param(targetTemperatureStateParamTypeId); + int temperature = temperatureParam.value().toInt(); + + // Set the "temperature" state + device->setStateValue(targetTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if(device->deviceClassId() == evChargerDeviceClassId){ + + if(action.actionTypeId() == evPowerActionTypeId){ + // get the param value + Param powerParam = action.param(evPowerStateParamTypeId); + bool power = powerParam.value().toBool(); + // Set the "power" state + device->setStateValue(evPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + + }else if(action.actionTypeId() == evCurrentActionTypeId){ + // get the param value + Param currentParam = action.param(evCurrentStateParamTypeId); + int current = currentParam.value().toInt(); + // Set the "current" state + device->setStateValue(evCurrentStateTypeId, current); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if(device->deviceClassId() == socketDeviceClassId){ + + if(action.actionTypeId() == socketPowerActionTypeId){ + // get the param value + Param powerParam = action.param(socketPowerStateParamTypeId); + bool power = powerParam.value().toBool(); + // Set the "power" state + device->setStateValue(socketPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if(device->deviceClassId() == rgbBulbDeviceClassId){ + + if(action.actionTypeId() == bulbBrightnessActionTypeId){ + int brightness = action.param(bulbBrightnessStateParamTypeId).value().toInt(); + device->setStateValue(bulbBrightnessStateTypeId, brightness); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == bulbTemperatureActionTypeId){ + int temperature = action.param(bulbTemperatureStateParamTypeId).value().toInt(); + device->setStateValue(bulbTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == bulbColorActionTypeId) { + QVariant color = action.param(bulbColorStateParamTypeId).value(); + device->setStateValue(bulbColorStateTypeId, color); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == bulbPowerActionTypeId) { + bool power = action.param(bulbPowerStateParamTypeId).value().toBool(); + device->setStateValue(bulbPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + } + + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == heatingRodDeviceClassId) { + + if (action.actionTypeId() == powerActionTypeId) { + bool power = action.param(powerStateParamTypeId).value().toBool(); + device->setStateValue(powerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + } else if (action.actionTypeId() == waterTemperatureActionTypeId) { + int temperature = action.param(waterTemperatureStateParamTypeId).value().toInt(); + device->setStateValue(waterTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + } else if (action.actionTypeId() == maxPowerActionTypeId) { + double maxPower = action.param(maxPowerStateParamTypeId).value().toDouble(); + device->setStateValue(maxPowerStateTypeId, maxPower); + return DeviceManager::DeviceErrorNoError; + } + + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == batteryDeviceClassId) { + if (action.actionTypeId() == maxChargingActionTypeId) { + int maxCharging = action.param(maxChargingStateParamTypeId).value().toInt(); + device->setStateValue(maxChargingStateTypeId, maxCharging); + device->setStateValue(chargingBatteryStateTypeId, ((double)maxCharging-10)/1000); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + + 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) +{ + return ((qrand() % ((Max + 1) - Min)) + Min); +} + diff --git a/simulation/devicepluginsimulation.h b/simulation/devicepluginsimulation.h new file mode 100644 index 00000000..ee712fc0 --- /dev/null +++ b/simulation/devicepluginsimulation.h @@ -0,0 +1,49 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2015 Simon Stuerz * + * * + * This file is part of guh. * + * * + * Guh is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, version 2 of the License. * + * * + * Guh is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with guh. If not, see . * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef DEVICEPLUGINSIMMULATION_H +#define DEVICEPLUGINSIMMULATION_H + +#include "plugin/deviceplugin.h" +#include "devicemanager.h" + +class DevicePluginSimulation : public DevicePlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginsimulation.json") + Q_INTERFACES(DevicePlugin) + + +public: + explicit DevicePluginSimulation(); + + DeviceManager::HardwareResources requiredHardware() const override; + DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; + + DeviceManager::DeviceError executeAction(Device *device, const Action &action) override; + void guhTimer() override; + +private: + + int getRandomNumber(const int min, const int max); +}; + +#endif // DEVICEPLUGINSIMMULATION_H diff --git a/simulation/devicepluginsimulation.json b/simulation/devicepluginsimulation.json new file mode 100644 index 00000000..a080e0a6 --- /dev/null +++ b/simulation/devicepluginsimulation.json @@ -0,0 +1,634 @@ +{ + "name": "Simulation", + "idName": "Simulation", + "id": "b7368429-e312-4c82-9eab-e1cd996e43d6", + "vendors": [ + { + "name": "Simulated Devices", + "idName": "simulation", + "id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf", + "deviceClasses": [ + { + "id": "73bb670b-e7a3-40da-bd6f-3260f017ec80", + "idName": "simpleButton", + "name": "Simple Button", + "createMethods": ["user"], + "deviceIcon": "Switch", + "basicTags": [ + "Device" + ], + "paramTypes": [ + ], + "actionTypes": [ + { + "id": "64c4ced5-9a1a-4858-81dd-1b5c94dba495", + "idName": "pressSimpleButton", + "name": "press the button" + } + ], + "eventTypes": [ + { + "id": "f9652210-9aed-4f38-8c19-2fd54f703fbe", + "idName": "simpleButtonPressed", + "name": "button pressed" + } + ] + }, + { + "id": "910b2f58-70dc-4da3-89ae-9e7393290ccb", + "idName": "alternativePowerButton", + "name": "Power Button", + "createMethods": ["user"], + "deviceIcon": "Switch", + "basicTags": [ + "Device" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "fa63c0b9-10e5-4280-9cc2-243bf27c05ad", + "idName": "alternativePower", + "name": "power", + "type": "bool", + "eventTypeName": "power changed", + "actionTypeName": "set power", + "defaultValue": false, + "index" : 0, + "writable": true + } + ] + }, + { + "id": "77c6ccff-84e8-4983-b69e-5e1a3f4723f2", + "idName": "temperatureSensor", + "name": "Temperature Sensor", + "createMethods": ["user"], + "deviceIcon": "Thermometer", + "criticalStateTypeId": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "primaryStateTypeId": "169d7a2a-d1c9-4578-bb30-fc7d25690e59", + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "169d7a2a-d1c9-4578-bb30-fc7d25690e59", + "idName": "temperature", + "name": "temperature", + "type": "double", + "unit": "DegreeCelsius", + "eventTypeName": "temperature changed", + "defaultValue": 0 + }, + { + "id": "10c735fd-7b81-484a-a148-76ea0da840f0", + "idName": "humidity", + "name": "humidity", + "type": "int", + "unit": "Percentage", + "eventTypeName": "humidity changed", + "defaultValue": 0 + }, + { + "id": "45c0de32-b519-47d7-9f82-e5f09d1542d4", + "idName": "battery", + "name": "battery", + "type": "int", + "unit": "Percentage", + "eventTypeName": "battery changed", + "defaultValue": 0 + }, + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + } + ] + }, + { + "id": "990fc2ba-260a-4648-9a93-e803e219da4f", + "idName": "motionDetector", + "name": "Motion Detector", + "createMethods": ["user"], + "deviceIcon": "MotionDetectors", + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "5ab00bfc-7345-44a2-90d4-852c810e59ec", + "idName": "active", + "name": "active", + "type": "bool", + "eventTypeName": "motion detected", + "defaultValue": false + }, + { + "id": "45c0de32-b519-47d7-9f82-e5f09d1542d4", + "idName": "battery", + "name": "battery", + "type": "int", + "unit": "Percentage", + "eventTypeName": "battery changed", + "defaultValue": 100 + }, + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + } + ] + }, + { + "id": "62e302f4-b92a-4b55-bd18-a1e0cc56362a", + "idName": "heating", + "name": "Heating", + "createMethods": ["user"], + "deviceIcon": "Radiator", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "e1910c53-a6bc-434b-9caa-0d08e214c122", + "idName": "power", + "name": "power", + "type": "bool", + "eventTypeName": "power changed", + "actionTypeName": "change power", + "defaultValue": 0, + "writable": true + }, + { + "id": "47a16375-1027-42cc-82d3-56cbfdb1193c", + "idName": "heatingActive", + "name": "active", + "type": "bool", + "eventTypeName": "active status changed", + "defaultValue": false + }, + { + "id": "8256a670-85c5-4043-9133-05518812848c", + "idName": "targetTemperature", + "name": "target", + "type": "int", + "unit": "DegreeCelsius", + "eventTypeName": "target temperature changed", + "actionTypeName": "change target temperature", + "defaultValue": 0, + "writable": true + } + ] + }, + { + "id": "1fa40afa-6a07-4a97-918b-76e3944ea0fb", + "idName": "evCharger", + "name": "EV Charging Station", + "createMethods": ["user"], + "deviceIcon": "Energy", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "b786029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "evPower", + "name": "power", + "type": "bool", + "eventTypeName": "power changed", + "actionTypeName": "change power", + "defaultValue": 0, + "writable": true + }, + { + "id": "87600986-da37-4032-af37-015995910368", + "idName": "evCurrent", + "name": "current", + "type": "int", + "unit": "Ampere", + "minValue": 6, + "maxValue": 64, + "eventTypeName": "target temperature changed", + "actionTypeName": "change target temperature", + "defaultValue": 6, + "writable": true + }, + { + "id": "9d3f56e1-bb73-4efd-814c-50477c609c17", + "idName": "evCharging", + "name": "charging", + "type": "bool", + "eventTypeName": "charging status changed", + "defaultValue": false + } + ] + }, + { + "id": "cfb44bcf-b4b9-4bef-89f7-3a55baf35668", + "idName": "garageDoor", + "name": "Garage Door", + "createMethods": ["user"], + "deviceIcon": "Garage", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "f786029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "door", + "name": "door", + "type": "bool", + "eventTypeName": "door status changed", + "defaultValue": false + } + ], + "actionTypes": [ + { + "id": "1786029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "garageOpen", + "name": "open", + "type": "bool", + "eventTypeName": "door opening" + }, + { + "id": "2786029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "garageStop", + "name": "stop", + "type": "bool", + "eventTypeName": "door stopping" + }, + { + "id": "3786029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "garageClose", + "name": "close", + "type": "bool", + "eventTypeName": "door closing" + } + ] + }, + { + "id": "1039b7ee-5351-400b-a477-5b8fc1447138", + "idName": "rollerShutter", + "name": "Roller Shutter", + "createMethods": ["user"], + "deviceIcon": "RollerShutter", + "basicTags": [ + "Device", + "Actuator", + "Shading" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "1386029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "shutterStatus", + "name": "status", + "type": "int", + "unit": "Percentage", + "eventTypeName": "shutter status changed", + "defaultValue": 0 + } + ], + "actionTypes": [ + { + "id": "17860291-f3a6-4b47-978a-ac1a581aac0f", + "idName": "shutterOpen", + "name": "open", + "type": "bool", + "eventTypeName": "shutter opening" + }, + { + "id": "27860292-f3a6-4b47-978a-ac1a581aac0f", + "idName": "shutterStop", + "name": "stop", + "type": "bool", + "eventTypeName": "shutter stopping" + }, + { + "id": "37860293-f3a6-4b47-978a-ac1a581aac0f", + "idName": "shutterClose", + "name": "close", + "type": "bool", + "eventTypeName": "shutter closing" + } + ] + }, + { + "id": "1039b7ee-5121-400b-a477-5b8fc14471ff", + "idName": "rgbBulb", + "name": "Color Bulb", + "createMethods": ["user"], + "deviceIcon": "LightBulb", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "9faaffe5-6a76-47d2-a14a-550f60390245", + "idName": "bulbPower", + "name": "power", + "eventTypeName": "power changed", + "actionTypeName": "Set power", + "type": "bool", + "defaultValue": false, + "writable": true + }, + { + "id": "cff4206f-f219-4f06-93c4-4ca515a56f79", + "idName": "bulbTemperature", + "name": "color temperature", + "eventTypeName": "color temperature changed", + "actionTypeName": "Set color temperature", + "type": "int", + "unit": "Mired", + "defaultValue": 170, + "ruleRelevant": false, + "eventRuleRelevant": false, + "minValue": 153, + "maxValue": 500, + "writable": true + }, + { + "id": "df5423f1-b924-4b20-80b6-77eecc65d089", + "idName": "bulbColor", + "name": "color", + "eventTypeName": "color changed", + "actionTypeName": "Set color", + "type": "QColor", + "ruleRelevant": false, + "eventRuleRelevant": false, + "defaultValue": "#000000", + "writable": true + + }, + { + "id": "90e91f11-a208-468c-a5a2-7f47e08229e2", + "idName": "bulbBrightness", + "name": "brightness", + "eventTypeName": "brightness changed", + "actionTypeName": "Set brigtness", + "type": "int", + "ruleRelevant": false, + "eventRuleRelevant": false, + "unit": "Percentage", + "defaultValue": 0, + "minValue": 0, + "maxValue": 100, + "writable": true + } + ] + }, + { + "id": "1039b7ee-5351-400b-a477-5b8fc14471ff", + "idName": "socket", + "name": "Socket", + "createMethods": ["user"], + "deviceIcon": "Socket", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "b7ff029d-f3a6-4b47-978a-ac1a581aac0f", + "idName": "socketPower", + "name": "power", + "type": "bool", + "eventTypeName": "power changed", + "actionTypeName": "change power", + "defaultValue": false, + "writable": true + } + ] + }, + { + "id": "45906fb3-9bf5-4331-9b69-0a0407b8511e", + "idName": "fingerPrintSensor", + "name": "Finger Print Sensor", + "createMethods": ["user"], + "deviceIcon": "Network", + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + } + ], + "eventTypes": [ + { + "id": "1d2dde79-7121-4f8c-b7c1-904ced66a79e", + "idName": "accessGranted", + "name": "access granted" + }, + { + "id": "992b7742-af0c-447c-bd94-9ec70b872268", + "idName": "accessDenied", + "name": "access denied" + } + ] + }, + { + "id": "c242f229-d3f4-4d3d-854c-817b52aa18ab", + "idName": "smartMeter", + "name": "Smart Meter", + "createMethods": ["user"], + "deviceIcon": "Energy", + "basicTags": [ + "Device" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + }, + { + "id": "d57f4d9c-759e-40eb-999e-a1acbc8df2b1", + "idName": "powerSmartMeter", + "name": "Power", + "type": "double", + "unit": "KiloWatt", + "eventTypeName": "power consumption changed", + "eventRuleRelevant": false, + "defaultValue": 3.70 + }, + { + "id": "5ac91819-c855-441c-a734-ee5cc0514822", + "idName": "energyTodaySmartMeter", + "name": "Energy Today", + "type": "double", + "unit": "KiloWatt", + "eventTypeName": "today's energy production changed", + "ruleRelevant": false, + "eventRuleRelevant": false, + "defaultValue": 13.45 + } + ] + }, + { + "id": "280c481e-757a-4af7-b1d3-dc9cfc1d46a5", + "idName": "battery", + "name": "Battery", + "createMethods": ["user"], + "deviceIcon": "Battery", + "basicTags": [ + "Device" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + }, + { + "id": "30fd9fd9-1a6b-4698-93ac-6b2a1ba18500", + "idName": "batteryStatus", + "name": "Battery Status", + "eventTypeName": "battery status changed", + "type": "int", + "unit": "Percentage", + "defaultValue": 91, + "minValue": 0, + "maxValue": 100 + }, + { + "id": "c977e60a-e820-4647-addb-cf0b39732ffb", + "idName": "chargingBattery", + "name": "Charging", + "type": "double", + "unit": "KiloWatt", + "eventTypeName": "charging amount changed", + "eventRuleRelevant": false, + "defaultValue": 0.70 + }, + { + "id": "bdf328a6-eebc-4b67-8165-551bc21e9be6", + "idName": "maxCharging", + "name": "Max Charging Power", + "eventTypeName": "max charging power changed", + "actionTypeName": "Set max charging power", + "type": "int", + "unit": "Watt", + "defaultValue": 700, + "minValue": 0, + "maxValue": 2000, + "writable": true + } + ] + }, + { + "id": "b2565887-443a-45ae-a2e7-67fb1b1003d8", + "idName": "heatingRod", + "name": "Heating Rod", + "createMethods": ["user"], + "deviceIcon": "Thermometer", + "basicTags": [ + "Device" + ], + "paramTypes": [ + ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "idName": "reachable", + "name": "reachable", + "type": "bool", + "eventTypeName": "reachable changed", + "defaultValue": true + }, + { + "id": "e1910c53-a6bc-434b-9caa-0d08e214c122", + "idName": "power", + "name": "power", + "type": "bool", + "eventTypeName": "power changed", + "actionTypeName": "power", + "defaultValue": false, + "writable": true + }, + { + "id": "2ab2a0fa-ea66-426c-ba22-d23b42c80883", + "idName": "maxPower", + "name": "Max Power", + "eventTypeName": "max power changed", + "actionTypeName": "Set max power", + "type": "int", + "unit": "Watt", + "defaultValue": 2000, + "minValue": 0, + "maxValue": 2000, + "writable": true + }, + { + "id": "49388b11-8076-4698-8091-5c5f5762fd08", + "idName": "waterTemperature", + "name": "target water temperature", + "type": "int", + "unit": "DegreeCelsius", + "eventTypeName": "target water temperature changed", + "actionTypeName": "change target water temperature", + "minValue": 0, + "maxValue": 80, + "defaultValue": 65, + "writable": true + }, + { + "id": "47a16375-1027-42cc-82d3-56cbfdb1193c", + "idName": "heatingActive", + "name": "active", + "type": "bool", + "eventTypeName": "active status changed", + "defaultValue": false + } + ] + } + ] + } + ] +} diff --git a/simulation/simulation.pro b/simulation/simulation.pro new file mode 100644 index 00000000..9c25423b --- /dev/null +++ b/simulation/simulation.pro @@ -0,0 +1,13 @@ +TRANSLATIONS = translations/en_US.ts \ + translations/de_DE.ts + +# Note: include after the TRANSLATIONS definition +include(../plugins.pri) + +TARGET = $$qtLibraryTarget(guh_devicepluginsimulation) + +SOURCES += \ + devicepluginsimulation.cpp \ + +HEADERS += \ + devicepluginsimulation.h \