diff --git a/debian/control b/debian/control index a86febd3..38c91786 100644 --- a/debian/control +++ b/debian/control @@ -478,6 +478,21 @@ Description: guh.io plugin for TCP commander This package will install the guh.io plugin for TCP commander +Package: guh-plugin-simulation +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends}, + guh-plugins-translations, +Description: guh.io plugin for simulated devices + The guh daemon is a plugin based IoT (Internet of Things) server. The + server works like a translator for devices, things and services and + allows them to interact. + With the powerful rule engine you are able to connect any device available + in the system and create individual scenes and behaviors for your environment. + . + This package will install the guh.io plugin for simulated devices + + Package: guh-plugin-elgato Architecture: any Depends: ${shlibs:Depends}, diff --git a/debian/guh-plugin-simulation.install.in b/debian/guh-plugin-simulation.install.in new file mode 100644 index 00000000..76112969 --- /dev/null +++ b/debian/guh-plugin-simulation.install.in @@ -0,0 +1 @@ +usr/lib/@DEB_HOST_MULTIARCH@/guh/plugins/libguh_devicepluginsimulation.so diff --git a/guh-plugins.pro b/guh-plugins.pro index cd9293ac..febe0e95 100644 --- a/guh-plugins.pro +++ b/guh-plugins.pro @@ -35,6 +35,7 @@ PLUGIN_DIRS = \ multisensor \ gpio \ snapd \ + simulation \ CONFIG+=all diff --git a/simulation/devicepluginsimulation.cpp b/simulation/devicepluginsimulation.cpp new file mode 100644 index 00000000..ed38b7e8 --- /dev/null +++ b/simulation/devicepluginsimulation.cpp @@ -0,0 +1,234 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * Copyright (C) 2018 Simon Stürz * + * * + * 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" + + +DevicePluginSimulation::DevicePluginSimulation() +{ + +} + +void DevicePluginSimulation::init() +{ + m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10); + connect(m_pluginTimer, &PluginTimer::timeout, this, &DevicePluginSimulation::onPluginTimer); +} + +DeviceManager::DeviceSetupStatus DevicePluginSimulation::setupDevice(Device *device) +{ + Q_UNUSED(device) + qCDebug(dcSimulation) << device->params(); + + return DeviceManager::DeviceSetupStatusSuccess; +} + + +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() == simpleButtonTriggerActionTypeId) { + + + // Emit the "button pressed" event + Event event(simpleButtonPressedEventTypeId, device->id()); + emit emitEvent(event); + + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + // Check the DeviceClassId for "Alternative Button" + if (device->deviceClassId() == alternativeButtonDeviceClassId) { + + // check if this is the "set power" action + if (action.actionTypeId() == alternativeButtonPowerActionTypeId) { + + // get the param value + Param powerParam = action.param(alternativeButtonPowerStateParamTypeId); + bool power = powerParam.value().toBool(); + + qCDebug(dcSimulation) << "ActionTypeId :" << action.actionTypeId().toString(); + qCDebug(dcSimulation) << "StateTypeId :" << alternativeButtonPowerStateTypeId.toString(); + + // Set the "power" state + device->setStateValue(alternativeButtonPowerStateTypeId, power); + + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == heatingDeviceClassId) { + + // check if this is the "set power" action + if (action.actionTypeId() == heatingPowerActionTypeId) { + + // get the param value + Param powerParam = action.param(heatingPowerStateParamTypeId); + bool power = powerParam.value().toBool(); + // Set the "power" state + device->setStateValue(heatingPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == heatingTargetTemperatureActionTypeId) { + + // get the param value + Param temperatureParam = action.param(heatingTargetTemperatureStateParamTypeId); + int temperature = temperatureParam.value().toInt(); + + // Set the "temperature" state + device->setStateValue(heatingTargetTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == evChargerDeviceClassId){ + + if (action.actionTypeId() == evChargerPowerActionTypeId){ + // get the param value + Param powerParam = action.param(evChargerPowerStateParamTypeId); + bool power = powerParam.value().toBool(); + // Set the "power" state + device->setStateValue(evChargerPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + + } else if(action.actionTypeId() == evChargerCurrentActionTypeId){ + // get the param value + Param currentParam = action.param(evChargerCurrentStateParamTypeId); + int current = currentParam.value().toInt(); + // Set the "current" state + device->setStateValue(evChargerCurrentStateTypeId, 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() == colorBulbDeviceClassId){ + + if(action.actionTypeId() == colorBulbBrightnessActionTypeId){ + int brightness = action.param(colorBulbBrightnessStateParamTypeId).value().toInt(); + device->setStateValue(colorBulbBrightnessStateTypeId, brightness); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == colorBulbColorTemperatureActionTypeId){ + int temperature = action.param(colorBulbColorTemperatureStateParamTypeId).value().toInt(); + device->setStateValue(colorBulbColorTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == colorBulbColorActionTypeId) { + QVariant color = action.param(colorBulbColorStateParamTypeId).value(); + device->setStateValue(colorBulbColorStateTypeId, color); + return DeviceManager::DeviceErrorNoError; + + } else if (action.actionTypeId() == colorBulbPowerActionTypeId) { + bool power = action.param(colorBulbPowerStateParamTypeId).value().toBool(); + device->setStateValue(colorBulbPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + } + + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == heatingRodDeviceClassId) { + + if (action.actionTypeId() == heatingRodPowerActionTypeId) { + bool power = action.param(heatingRodPowerStateParamTypeId).value().toBool(); + device->setStateValue(heatingRodPowerStateTypeId, power); + return DeviceManager::DeviceErrorNoError; + } else if (action.actionTypeId() == heatingRodWaterTemperatureActionTypeId) { + int temperature = action.param(heatingRodWaterTemperatureStateParamTypeId).value().toInt(); + device->setStateValue(heatingRodWaterTemperatureStateTypeId, temperature); + return DeviceManager::DeviceErrorNoError; + } else if (action.actionTypeId() == heatingRodMaxPowerActionTypeId) { + double maxPower = action.param(heatingRodMaxPowerStateParamTypeId).value().toDouble(); + device->setStateValue(heatingRodMaxPowerStateTypeId, maxPower); + return DeviceManager::DeviceErrorNoError; + } + + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + if (device->deviceClassId() == batteryDeviceClassId) { + if (action.actionTypeId() == batteryMaxChargingActionTypeId) { + int maxCharging = action.param(batteryMaxChargingStateParamTypeId).value().toInt(); + device->setStateValue(batteryMaxChargingStateTypeId, maxCharging); + device->setStateValue(batteryChargingStateTypeId, ((double)maxCharging-10)/1000); + return DeviceManager::DeviceErrorNoError; + } + return DeviceManager::DeviceErrorActionTypeNotFound; + } + + return DeviceManager::DeviceErrorDeviceClassNotFound; +} + +int DevicePluginSimulation::getRandomNumber(const int Min, const int Max) +{ + 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){ + + } + } +} + diff --git a/simulation/devicepluginsimulation.h b/simulation/devicepluginsimulation.h new file mode 100644 index 00000000..271f76d1 --- /dev/null +++ b/simulation/devicepluginsimulation.h @@ -0,0 +1,54 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * + * Copyright (C) 2017 Bernhard Trinnes * + * Copyright (C) 2018 Simon Stürz * + * * + * 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" +#include "plugintimer.h" + +class DevicePluginSimulation : public DevicePlugin +{ + Q_OBJECT + + Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginsimulation.json") + Q_INTERFACES(DevicePlugin) + + +public: + explicit DevicePluginSimulation(); + + void init() override; + DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; + DeviceManager::DeviceError executeAction(Device *device, const Action &action) override; + +private: + PluginTimer *m_pluginTimer = nullptr; + + int getRandomNumber(const int min, const int max); + +private slots: + void onPluginTimer(); + +}; + +#endif // DEVICEPLUGINSIMMULATION_H diff --git a/simulation/devicepluginsimulation.json b/simulation/devicepluginsimulation.json new file mode 100644 index 00000000..290d963e --- /dev/null +++ b/simulation/devicepluginsimulation.json @@ -0,0 +1,650 @@ +{ + "name": "Simulation", + "displayName": "Simulation", + "id": "b7368429-e312-4c82-9eab-e1cd996e43d6", + "vendors": [ + { + "name": "simulation", + "displayName": "Simulation", + "id": "fd2ae067-2c3d-4332-9c4b-ee0af653bcaf", + "interfaces": ["simplebutton"], + "deviceClasses": [ + { + "id": "73bb670b-e7a3-40da-bd6f-3260f017ec80", + "name": "simpleButton", + "displayName": "Simple Button", + "createMethods": ["user"], + "deviceIcon": "Switch", + "interfaces": ["simplebutton", "outputtrigger"], + "basicTags": [ + "Device" + ], + "paramTypes": [ ], + "actionTypes": [ + { + "id": "64c4ced5-9a1a-4858-81dd-1b5c94dba495", + "name": "trigger", + "displayName": "Press the button" + } + ], + "eventTypes": [ + { + "id": "f9652210-9aed-4f38-8c19-2fd54f703fbe", + "name": "pressed", + "displayName": "Button pressed" + } + ] + }, + { + "id": "910b2f58-70dc-4da3-89ae-9e7393290ccb", + "name": "alternativeButton", + "displayName": "Power Button", + "createMethods": ["user"], + "deviceIcon": "Switch", + "basicTags": [ + "Device" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "fa63c0b9-10e5-4280-9cc2-243bf27c05ad", + "name": "power", + "displayName": "Power", + "type": "bool", + "displayNameEvent": "Power changed", + "displayNameAction": "Set power", + "defaultValue": false, + "index" : 0, + "writable": true + } + ] + }, + { + "id": "77c6ccff-84e8-4983-b69e-5e1a3f4723f2", + "name": "temperatureSensor", + "displayName": "Temperature sensor", + "createMethods": ["user"], + "deviceIcon": "Thermometer", + "interfaces": ["temperaturesensor", "humiditysensor", "battery", "connectable"], + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "169d7a2a-d1c9-4578-bb30-fc7d25690e59", + "name": "temperature", + "displayName": "Temperature", + "displayNameEvent": "Temperature changed", + "type": "double", + "unit": "DegreeCelsius", + "defaultValue": 0 + }, + { + "id": "10c735fd-7b81-484a-a148-76ea0da840f0", + "name": "humidity", + "displayName": "Humidity", + "displayNameEvent": "Humidity changed", + "type": "double", + "minValue": 0, + "maxValue": 100, + "unit": "Percentage", + "defaultValue": 0 + }, + { + "id": "45c0de32-b519-47d7-9f82-e5f09d1542d4", + "name": "batteryLevel", + "displayName": "Battery", + "displayNameEvent": "Battery level changed", + "type": "int", + "minValue": 0, + "maxValue": 100, + "unit": "Percentage", + "defaultValue": 0 + }, + { + "id": "295b9a17-a4b1-4cc9-8ebb-2309b72c75f6", + "name": "batteryCritical", + "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", + "defaultValue": true + } + ] + }, + { + "id": "990fc2ba-260a-4648-9a93-e803e219da4f", + "name": "motionDetector", + "displayName": "Motion Detector", + "createMethods": ["user"], + "interfaces": ["battery", "connectable"], + "deviceIcon": "MotionDetectors", + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "5ab00bfc-7345-44a2-90d4-852c810e59ec", + "name": "active", + "displayName": "Active", + "displayNameEvent": "Motion detected", + "type": "bool", + "defaultValue": false + }, + { + "id": "4d66c81e-6293-4997-9685-8b44d7e5c1bd", + "name": "batteryLevel", + "displayName": "Battery", + "displayNameEvent": "Battery level changed", + "type": "int", + "unit": "Percentage", + "minValue": 0, + "maxValue": 100, + "defaultValue": 95 + }, + { + "id": "1c621a6f-86fe-4351-bf9e-03c3deaef6ad", + "name": "batteryCritical", + "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", + "defaultValue": true + } + ] + }, + { + "id": "62e302f4-b92a-4b55-bd18-a1e0cc56362a", + "name": "heating", + "displayName": "Heating", + "createMethods": ["user"], + "deviceIcon": "Radiator", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "e1910c53-a6bc-434b-9caa-0d08e214c122", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Power changed", + "displayNameAction": "Set power", + "type": "bool", + "defaultValue": 0, + "writable": true + }, + { + "id": "47a16375-1027-42cc-82d3-56cbfdb1193c", + "name": "heatingActive", + "displayName": "Active", + "displayNameEvent": "Active status changed", + "type": "bool", + "defaultValue": false + }, + { + "id": "8256a670-85c5-4043-9133-05518812848c", + "name": "targetTemperature", + "displayName": "Target temperature", + "displayNameEvent": "target temperature changed", + "displayNameAction": "change target temperature", + "type": "int", + "unit": "DegreeCelsius", + "defaultValue": 0, + "writable": true + } + ] + }, + { + "id": "1fa40afa-6a07-4a97-918b-76e3944ea0fb", + "name": "evCharger", + "displayName": "EV Charging Station", + "createMethods": ["user"], + "deviceIcon": "Energy", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "b786029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Power changed", + "displayNameAction": "Set power", + "type": "bool", + "defaultValue": 0, + "writable": true + }, + { + "id": "87600986-da37-4032-af37-015995910368", + "name": "current", + "displayName": "Current", + "displayNameEvent": "Current changed", + "displayNameAction": "Set current", + "type": "int", + "unit": "Ampere", + "minValue": 6, + "maxValue": 64, + "defaultValue": 6, + "writable": true + }, + { + "id": "9d3f56e1-bb73-4efd-814c-50477c609c17", + "name": "evCharging", + "displayName": "charging", + "type": "bool", + "displayNameEvent": "charging status changed", + "defaultValue": false + } + ] + }, + { + "id": "cfb44bcf-b4b9-4bef-89f7-3a55baf35668", + "name": "garageDoor", + "displayName": "Garage Door", + "createMethods": ["user"], + "deviceIcon": "Garage", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "f786029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "door", + "displayName": "Garage door", + "displayNameEvent": "Garage door status changed", + "type": "bool", + "defaultValue": false + } + ], + "actionTypes": [ + { + "id": "1786029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "open", + "displayName": "Open", + "type": "bool" + }, + { + "id": "2786029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "stop", + "displayName": "Stop", + "type": "bool" + }, + { + "id": "3786029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "close", + "displayName": "Close", + "type": "bool" + } + ] + }, + { + "id": "1039b7ee-5351-400b-a477-5b8fc1447138", + "name": "rollerShutter", + "displayName": "Roller Shutter", + "createMethods": ["user"], + "deviceIcon": "RollerShutter", + "basicTags": [ + "Device", + "Actuator", + "Shading" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "1386029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "shutterStatus", + "displayName": "Status", + "type": "int", + "unit": "Percentage", + "displayNameEvent": "Shutter status changed", + "defaultValue": 0 + } + ], + "actionTypes": [ + { + "id": "17860291-f3a6-4b47-978a-ac1a581aac0f", + "name": "open", + "displayName": "Open", + "type": "bool" + }, + { + "id": "27860292-f3a6-4b47-978a-ac1a581aac0f", + "name": "stop", + "displayName": "stop", + "type": "bool" + }, + { + "id": "37860293-f3a6-4b47-978a-ac1a581aac0f", + "name": "close", + "displayName": "close", + "type": "bool" + } + ] + }, + { + "id": "1039b7ee-5121-400b-a477-5b8fc14471ff", + "name": "colorBulb", + "displayName": "Color Bulb", + "createMethods": ["user"], + "deviceIcon": "LightBulb", + "interfaces": ["colorlight"], + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "9faaffe5-6a76-47d2-a14a-550f60390245", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Power changed", + "displayNameAction": "Set power", + "type": "bool", + "defaultValue": false, + "writable": true + }, + { + "id": "cff4206f-f219-4f06-93c4-4ca515a56f79", + "name": "colorTemperature", + "displayName": "Color temperature", + "displayNameEvent": "Color temperature changed", + "displayNameAction": "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", + "name": "color", + "displayName": "Color", + "displayNameEvent": "Color changed", + "displayNameAction": "Set color", + "type": "QColor", + "ruleRelevant": false, + "eventRuleRelevant": false, + "defaultValue": "#000000", + "writable": true + }, + { + "id": "90e91f11-a208-468c-a5a2-7f47e08229e2", + "name": "brightness", + "displayName": "Brightness", + "displayNameEvent": "Brightness changed", + "displayNameAction": "Set brigtness", + "type": "int", + "ruleRelevant": false, + "eventRuleRelevant": false, + "unit": "Percentage", + "defaultValue": 0, + "minValue": 0, + "maxValue": 100, + "writable": true + } + ] + }, + { + "id": "1039b7ee-5351-400b-a477-5b8fc14471ff", + "name": "socket", + "displayName": "Socket", + "createMethods": ["user"], + "deviceIcon": "Socket", + "basicTags": [ + "Device", + "Actuator" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "b7ff029d-f3a6-4b47-978a-ac1a581aac0f", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Power changed", + "displayNameAction": "Set power", + "type": "bool", + "defaultValue": false, + "writable": true + } + ] + }, + { + "id": "45906fb3-9bf5-4331-9b69-0a0407b8511e", + "name": "fingerPrintSensor", + "displayName": "Finger Print Sensor", + "createMethods": ["user"], + "interfaces": ["connectable"], + "deviceIcon": "Network", + "basicTags": [ + "Device", + "Sensor" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "name": "connected", + "displayName": "Connected", + "displayNameEvent": "Connected changed", + "type": "bool", + "defaultValue": true + } + ], + "eventTypes": [ + { + "id": "1d2dde79-7121-4f8c-b7c1-904ced66a79e", + "name": "accessGranted", + "displayName": "Access granted" + }, + { + "id": "992b7742-af0c-447c-bd94-9ec70b872268", + "name": "accessDenied", + "displayName": "Access denied" + } + ] + }, + { + "id": "c242f229-d3f4-4d3d-854c-817b52aa18ab", + "name": "smartMeter", + "displayName": "Smart Meter", + "createMethods": ["user"], + "deviceIcon": "Energy", + "interfaces": ["connectable"], + "basicTags": [ + "Device" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "name": "connected", + "displayName": "Reachable", + "displayNameEvent": "Reachable changed", + "type": "bool", + "defaultValue": true + }, + { + "id": "d57f4d9c-759e-40eb-999e-a1acbc8df2b1", + "name": "powerConsumption", + "displayName": "Power consumtion", + "displayNameEvent": "Power consumption changed", + "type": "double", + "unit": "KiloWatt", + "eventRuleRelevant": false, + "defaultValue": 3.70 + }, + { + "id": "5ac91819-c855-441c-a734-ee5cc0514822", + "name": "energyToday", + "displayName": "Today's energy production", + "displayNameEvent": "Today's energy production changed", + "type": "double", + "unit": "KiloWatt", + "ruleRelevant": false, + "eventRuleRelevant": false, + "defaultValue": 13.45 + } + ] + }, + { + "id": "280c481e-757a-4af7-b1d3-dc9cfc1d46a5", + "name": "battery", + "displayName": "Battery", + "createMethods": ["user"], + "deviceIcon": "Battery", + "interfaces": ["battery", "connectable"], + "basicTags": [ + "Device" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "name": "connected", + "displayName": "Reachable", + "displayNameEvent": "Reachable changed", + "type": "bool", + "defaultValue": true + }, + { + "id": "30fd9fd9-1a6b-4698-93ac-6b2a1ba18500", + "name": "batteryLevel", + "displayName": "Battery level", + "displayNameEvent": "Battery level changed", + "type": "int", + "unit": "Percentage", + "defaultValue": 91, + "minValue": 0, + "maxValue": 100 + }, + { + "id": "c977e60a-e820-4647-addb-cf0b39732ffb", + "name": "charging", + "displayName": "Charging", + "displayNameEvent": "Charging amount changed", + "type": "double", + "unit": "KiloWatt", + "eventRuleRelevant": false, + "defaultValue": 0.70 + }, + { + "id": "bdf328a6-eebc-4b67-8165-551bc21e9be6", + "name": "maxCharging", + "displayName": "Max charging power", + "displayNameEvent": "Max charging power changed", + "displayNameAction": "Set max charging power", + "type": "int", + "unit": "Watt", + "defaultValue": 700, + "minValue": 0, + "maxValue": 2000, + "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", + "name": "heatingRod", + "displayName": "Heating Rod", + "createMethods": ["user"], + "deviceIcon": "Thermometer", + "interfaces": ["connectable"], + "basicTags": [ + "Device" + ], + "paramTypes": [ ], + "stateTypes": [ + { + "id": "e66aba37-2647-4b6b-8740-d59eb98d846c", + "name": "connected", + "displayName": "Reachable", + "displayNameEvent": "Reachable changed", + "type": "bool", + "defaultValue": true + }, + { + "id": "e1910c53-a6bc-434b-9caa-0d08e214c122", + "name": "power", + "displayName": "Power", + "displayNameEvent": "Power changed", + "displayNameAction": "Power", + "type": "bool", + "defaultValue": false, + "writable": true + }, + { + "id": "2ab2a0fa-ea66-426c-ba22-d23b42c80883", + "name": "maxPower", + "displayName": "Max power", + "displayNameEvent": "Max power changed", + "displayNameAction": "Set max power", + "type": "int", + "unit": "Watt", + "defaultValue": 2000, + "minValue": 0, + "maxValue": 2000, + "writable": true + }, + { + "id": "49388b11-8076-4698-8091-5c5f5762fd08", + "name": "waterTemperature", + "displayName": "Target water temperature", + "displayNameEvent": "Target water temperature changed", + "displayNameAction": "Set target water temperature", + "type": "int", + "unit": "DegreeCelsius", + "minValue": 0, + "maxValue": 80, + "defaultValue": 65, + "writable": true + }, + { + "id": "47a16375-1027-42cc-82d3-56cbfdb1193c", + "name": "heatingActive", + "displayName": "Active", + "displayNameEvent": "Active status changed", + "type": "bool", + "defaultValue": false + } + ] + } + ] + } + ] +} diff --git a/simulation/simulation.pro b/simulation/simulation.pro new file mode 100644 index 00000000..84b8b21f --- /dev/null +++ b/simulation/simulation.pro @@ -0,0 +1,9 @@ +include(../plugins.pri) + +TARGET = $$qtLibraryTarget(guh_devicepluginsimulation) + +SOURCES += \ + devicepluginsimulation.cpp \ + +HEADERS += \ + devicepluginsimulation.h \ diff --git a/simulation/translations/de_DE.ts b/simulation/translations/de_DE.ts new file mode 100644 index 00000000..1552582e --- /dev/null +++ b/simulation/translations/de_DE.ts @@ -0,0 +1,4 @@ + + + + diff --git a/simulation/translations/en_US.ts b/simulation/translations/en_US.ts new file mode 100644 index 00000000..6401616d --- /dev/null +++ b/simulation/translations/en_US.ts @@ -0,0 +1,4 @@ + + + +