Merge PR #176: FlowerCare: Add a refresh rate setting
commit
2673099aac
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>DevicePluginFlowercare</name>
|
||||
<message>
|
||||
<source>Cannot discover Bluetooth devices. Bluetooth is not available on this system.</source>
|
||||
<translation>Es kann nicht nach Bluetooth Geräten gesucht werden. Bluetooth ist auf diesem System nicht verfügbar.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cannot discover Bluetooth devices. Bluetooth is disabled.</source>
|
||||
<translation>Es kann nicht nach Bluetooth Geräten gesucht werden. Bluetooth ist deaktiviert.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>An error happened during Bluetooth discovery.</source>
|
||||
<translation>Beim Suchen von Bluetooth Geräten ist ein Fehler aufgetreten.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>flowerCare</name>
|
||||
<message>
|
||||
<source>Flower Care</source>
|
||||
<extracomment>The name of the DeviceClass ({297e2efa-168c-4eb8-bf3f-f8694dc0a2b9})
|
||||
----------
|
||||
The name of the plugin flowerCare ({74e2106a-3407-4e89-a27a-1c890d78bee7})</extracomment>
|
||||
<translation>Flower Care</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Xiaomi</source>
|
||||
<extracomment>The name of the vendor ({f037aa1a-f764-42f9-a613-338e683e4da5})</extracomment>
|
||||
<translation>Xiaomi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MAC address</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, Type: device, ID: {fe2dba0f-2a47-463e-a645-bcd55cf09750})</extracomment>
|
||||
<translation>MAC Adresse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reachable changed</source>
|
||||
<extracomment>The name of the EventType ({6254103a-ff8b-4f62-afda-6b5be1c933ec}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Erreichbar geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reachable</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: connected, ID: {6254103a-ff8b-4f62-afda-6b5be1c933ec})
|
||||
----------
|
||||
The name of the StateType ({6254103a-ff8b-4f62-afda-6b5be1c933ec}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Erreichbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Battery level changed</source>
|
||||
<extracomment>The name of the EventType ({801a00ab-ce3b-4b10-9236-2f845c469a26}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Batterieladung geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Battery level</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: batteryLevel, ID: {801a00ab-ce3b-4b10-9236-2f845c469a26})
|
||||
----------
|
||||
The name of the StateType ({801a00ab-ce3b-4b10-9236-2f845c469a26}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Batterieladung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Battery level critical changed</source>
|
||||
<extracomment>The name of the EventType ({700a83e6-9fbb-4330-b00e-e9d0874b4f66}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Batterieladung wird kritisch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Battery level critical</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: batteryCritical, ID: {700a83e6-9fbb-4330-b00e-e9d0874b4f66})
|
||||
----------
|
||||
The name of the StateType ({700a83e6-9fbb-4330-b00e-e9d0874b4f66}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Batterieladung kritisch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Temperature changed</source>
|
||||
<extracomment>The name of the EventType ({4577a032-bafd-49ca-8625-6dcf90819e88}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Temperatur geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Temperature</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: temperature, ID: {4577a032-bafd-49ca-8625-6dcf90819e88})
|
||||
----------
|
||||
The name of the StateType ({4577a032-bafd-49ca-8625-6dcf90819e88}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Temperatur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Soil moisture changed</source>
|
||||
<extracomment>The name of the EventType ({5e3ac82a-1dda-4399-888e-529b391a814a}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Bodenfeuchte geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Soil moisture</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: moisture, ID: {5e3ac82a-1dda-4399-888e-529b391a814a})
|
||||
----------
|
||||
The name of the StateType ({5e3ac82a-1dda-4399-888e-529b391a814a}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Bodenfeuchte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Light intensity changed</source>
|
||||
<extracomment>The name of the EventType ({7e0a3b3d-72f4-4547-bd1e-2711be61c1a7}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Lichtstärke geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Light intensity</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: lightIntensity, ID: {7e0a3b3d-72f4-4547-bd1e-2711be61c1a7})
|
||||
----------
|
||||
The name of the StateType ({7e0a3b3d-72f4-4547-bd1e-2711be61c1a7}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Lichtstärke</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Conductivity changed</source>
|
||||
<extracomment>The name of the EventType ({f77608b3-8b5b-43a9-aab6-0dc35c694ec3}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Leitfähigkeit geändert</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Conductivity</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, EventType: conductivity, ID: {f77608b3-8b5b-43a9-aab6-0dc35c694ec3})
|
||||
----------
|
||||
The name of the StateType ({f77608b3-8b5b-43a9-aab6-0dc35c694ec3}) of DeviceClass flowerCare</extracomment>
|
||||
<translation>Leitfähigkeit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh rate (minutes)</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, Type: settings, ID: {e892d118-336e-4495-ae41-0c7cc907efe8})</extracomment>
|
||||
<translation>Abtastrate (Minuten)</translation>
|
||||
</message>
|
||||
</context>
|
||||
</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</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Refresh rate (minutes)</source>
|
||||
<extracomment>The name of the ParamType (DeviceClass: flowerCare, Type: settings, ID: {e892d118-336e-4495-ae41-0c7cc907efe8})</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
|||
Loading…
Reference in New Issue