From 55455b4fce5e3aa1d7b43e12a08cfce3d8df07ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 23 Mar 2018 20:53:24 +0100 Subject: [PATCH] Update light value to illuminance --- simulation/devicepluginsimulation.cpp | 4 +--- simulation/devicepluginsimulation.json | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/simulation/devicepluginsimulation.cpp b/simulation/devicepluginsimulation.cpp index 51710ab3..dd2d6334 100644 --- a/simulation/devicepluginsimulation.cpp +++ b/simulation/devicepluginsimulation.cpp @@ -234,8 +234,6 @@ DeviceManager::DeviceError DevicePluginSimulation::executeAction(Device *device, int DevicePluginSimulation::generateRandomIntValue(int min, int max) { - // Seed the random generator with current time - qsrand(QDateTime::currentMSecsSinceEpoch() / 1000); int value = ((qrand() % ((max + 1) - min)) + min); // qCDebug(dcSimulation()) << "Generateed random int value: [" << min << ", " << max << "] -->" << value; return value; @@ -276,7 +274,7 @@ void DevicePluginSimulation::onPluginTimer20Seconds() // Garden sensor device->setStateValue(gardenSensorTemperatureStateTypeId, generateRandomDoubleValue(20, 23)); device->setStateValue(gardenSensorSoilMoistureStateTypeId, generateRandomIntValue(40, 60)); - device->setStateValue(gardenSensorLightIntensityStateTypeId, generateRandomIntValue(40, 60)); + device->setStateValue(gardenSensorIlluminanceStateTypeId, generateRandomIntValue(20, 80)); device->setStateValue(gardenSensorBatteryLevelStateTypeId, generateRandomIntValue(25, 90)); device->setStateValue(gardenSensorBatteryCriticalStateTypeId, device->stateValue(gardenSensorBatteryLevelStateTypeId).toDouble() <= 30); device->setStateValue(gardenSensorConnectedStateTypeId, true); diff --git a/simulation/devicepluginsimulation.json b/simulation/devicepluginsimulation.json index 691c36b3..d0cf974c 100644 --- a/simulation/devicepluginsimulation.json +++ b/simulation/devicepluginsimulation.json @@ -763,12 +763,12 @@ }, { "id": "9781f0a5-3478-4291-ab51-9daa1ba0e44e", - "name": "lightIntensity", - "displayName": "Light intensity", - "displayNameEvent": "Light intensity changed", + "name": "illuminance", + "displayName": "Illuminance", + "displayNameEvent": "Illuminance changed", "type": "double", - "unit": "Candela", - "defaultValue": 0 + "unit": "Lux", + "defaultValue": 20 }, { "id": "45c0de32-b519-47d7-9f82-e5f09d1542d4",