diff --git a/flowercare/README.md b/flowercare/README.md
index ac89f491..ad232906 100644
--- a/flowercare/README.md
+++ b/flowercare/README.md
@@ -1,4 +1,9 @@
# Flowercare
-This pluggin provides support for the Bluetooth LE [Xiaomi Flower Care Monitor](https://xiaomi-mi.com/sockets-and-sensors/xiaomi-huahuacaocao-flower-care-smart-monitor/).
+This plugin provides support for the Bluetooth LE
+[Xiaomi Flower Care Monitor](https://xiaomi-mi.com/sockets-and-sensors/xiaomi-huahuacaocao-flower-care-smart-monitor/).
+
+The Xiaomi Flower Care sensor will provide information about temperature, soil moisture and conductivity as well as light intensity.
+By default, the sensor value is refreshed from the sensor every 20 minutes. This setting can be changed to poll the sensor more or
+less often, depending if more precise measurements or longer battery life are more important.
diff --git a/flowercare/devicepluginflowercare.cpp b/flowercare/devicepluginflowercare.cpp
index faee3ec7..2f9303b6 100644
--- a/flowercare/devicepluginflowercare.cpp
+++ b/flowercare/devicepluginflowercare.cpp
@@ -117,6 +117,15 @@ void DevicePluginFlowercare::setupDevice(DeviceSetupInfo *info)
connect(m_reconnectTimer, &PluginTimer::timeout, this, &DevicePluginFlowercare::onPluginTimer);
}
+ // Update refresh schedule when the refresh rate setting is changed
+ connect(device, &Device::settingChanged, flowerCare, [this, device] {
+ FlowerCare *flowerCare = m_list.value(device);
+ int refreshInterval = device->setting(flowerCareSettingsRefreshRateParamTypeId).toInt();
+ if (m_refreshMinutes[flowerCare] > refreshInterval) {
+ m_refreshMinutes[flowerCare] = refreshInterval;
+ }
+ });
+
info->finish(Device::DeviceErrorNoError);
}
@@ -183,5 +192,5 @@ void DevicePluginFlowercare::onSensorDataReceived(quint8 batteryLevel, double de
device->setStateValue(flowerCareMoistureStateTypeId, moisture);
device->setStateValue(flowerCareConductivityStateTypeId, fertility);
- m_refreshMinutes[flowerCare] = 20;
+ m_refreshMinutes[flowerCare] = device->setting(flowerCareSettingsRefreshRateParamTypeId).toInt();
}
diff --git a/flowercare/devicepluginflowercare.json b/flowercare/devicepluginflowercare.json
index 468aa2eb..6f66846b 100644
--- a/flowercare/devicepluginflowercare.json
+++ b/flowercare/devicepluginflowercare.json
@@ -23,6 +23,15 @@
"inputType": "MacAddress"
}
],
+ "settingsTypes": [
+ {
+ "id": "e892d118-336e-4495-ae41-0c7cc907efe8",
+ "name": "refreshRate",
+ "displayName": "Refresh rate (minutes)",
+ "type": "uint",
+ "defaultValue": 20
+ }
+ ],
"stateTypes": [
{
"id": "6254103a-ff8b-4f62-afda-6b5be1c933ec",
diff --git a/flowercare/translations/74e2106a-3407-4e89-a27a-1c890d78bee7-en_US.ts b/flowercare/translations/74e2106a-3407-4e89-a27a-1c890d78bee7-en_US.ts
index 7855b217..20626da9 100644
--- a/flowercare/translations/74e2106a-3407-4e89-a27a-1c890d78bee7-en_US.ts
+++ b/flowercare/translations/74e2106a-3407-4e89-a27a-1c890d78bee7-en_US.ts
@@ -119,5 +119,10 @@ The name of the StateType ({7e0a3b3d-72f4-4547-bd1e-2711be61c1a7}) of DeviceClas
The name of the StateType ({f77608b3-8b5b-43a9-aab6-0dc35c694ec3}) of DeviceClass flowerCare
+
+ Refresh rate (minutes)
+ The name of the ParamType (DeviceClass: flowerCare, Type: settings, ID: {e892d118-336e-4495-ae41-0c7cc907efe8})
+
+