From ad53d6bf3a4e640a2446475634adf1ef4d317fbf Mon Sep 17 00:00:00 2001 From: "Horn, Benjamin Manfred" Date: Thu, 18 Jul 2019 18:38:19 +0200 Subject: [PATCH 1/5] Fixes smaller typos in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb8992f..c59ebef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## flora -This arduino sketch implements an ESP32 BLE client for XIaomi Mi Flora Plant sensors, pushing the meaasurements to an MQTT server. +This arduino sketch implements an ESP32 BLE client for Xiaomi Mi Flora Plant sensors, pushing the meassurements to an MQTT server. ## Technical requirements From d5756b2efe7b7810e14f76da881c255a54d50d8d Mon Sep 17 00:00:00 2001 From: "Horn, Benjamin Manfred" Date: Thu, 18 Jul 2019 18:49:16 +0200 Subject: [PATCH 2/5] Fix unrealistic negative temperatures --- flora/flora.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flora/flora.ino b/flora/flora.ino index 1cda8a5..720f6a1 100644 --- a/flora/flora.ino +++ b/flora/flora.ino @@ -206,7 +206,7 @@ bool readFloraDataCharacteristic(BLERemoteService* floraService, String baseTopi Serial.print("-- Conductivity: "); Serial.println(conductivity); - if (temperature > 200) { + if (temperature > 100 || temperature < -100) { Serial.println("-- Unreasonable values received, skip publish"); return false; } From 145021bbbee4a00dbf93f49893e27d2e269664bd Mon Sep 17 00:00:00 2001 From: "Horn, Benjamin Manfred" Date: Thu, 18 Jul 2019 18:55:22 +0200 Subject: [PATCH 3/5] Added json-style state topic --- flora/flora.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flora/flora.ino b/flora/flora.ino index 720f6a1..5cfffa3 100644 --- a/flora/flora.ino +++ b/flora/flora.ino @@ -215,12 +215,22 @@ bool readFloraDataCharacteristic(BLERemoteService* floraService, String baseTopi snprintf(buffer, 64, "%f", temperature); client.publish((baseTopic + "temperature").c_str(), buffer); + char state[] = "{temperature:"; + strcat(state,buffer); snprintf(buffer, 64, "%d", moisture); client.publish((baseTopic + "moisture").c_str(), buffer); + strcat(state,",moisture:"); + strcat(state,buffer); snprintf(buffer, 64, "%d", light); client.publish((baseTopic + "light").c_str(), buffer); + strcat(state,",light:"); + strcat(state,buffer); snprintf(buffer, 64, "%d", conductivity); client.publish((baseTopic + "conductivity").c_str(), buffer); + strcat(state,",conductivity:"); + strcat(state,buffer); + strcat(state,"}"); + client.publish((baseTopic + "state").c_str(), state); return true; } From a8efc15c8786684d0ec389636131e9e4ac437bbc Mon Sep 17 00:00:00 2001 From: "Horn, Benjamin Manfred" Date: Thu, 18 Jul 2019 18:56:59 +0200 Subject: [PATCH 4/5] Added some additional delays between mqtt publish --- flora/flora.ino | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flora/flora.ino b/flora/flora.ino index 5cfffa3..21d399e 100644 --- a/flora/flora.ino +++ b/flora/flora.ino @@ -217,20 +217,25 @@ bool readFloraDataCharacteristic(BLERemoteService* floraService, String baseTopi client.publish((baseTopic + "temperature").c_str(), buffer); char state[] = "{temperature:"; strcat(state,buffer); + delay(100); snprintf(buffer, 64, "%d", moisture); client.publish((baseTopic + "moisture").c_str(), buffer); strcat(state,",moisture:"); strcat(state,buffer); + delay(100); snprintf(buffer, 64, "%d", light); client.publish((baseTopic + "light").c_str(), buffer); strcat(state,",light:"); strcat(state,buffer); + delay(100); snprintf(buffer, 64, "%d", conductivity); client.publish((baseTopic + "conductivity").c_str(), buffer); strcat(state,",conductivity:"); strcat(state,buffer); strcat(state,"}"); + delay(100); client.publish((baseTopic + "state").c_str(), state); + delay(100); return true; } From 4f9956dc4ae613b595d2ed80a61dca1ead0bed41 Mon Sep 17 00:00:00 2001 From: BMHorn <47857531+bmhorn@users.noreply.github.com> Date: Thu, 18 Jul 2019 19:06:05 +0200 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c59ebef..78291c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## flora -This arduino sketch implements an ESP32 BLE client for Xiaomi Mi Flora Plant sensors, pushing the meassurements to an MQTT server. +This arduino sketch implements an ESP32 BLE client for Xiaomi Mi Flora Plant sensors, pushing the measurements to an MQTT server. ## Technical requirements