Skip to content
This repository has been archived by the owner on Dec 8, 2019. It is now read-only.

fix #36, now with humidity>1 #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions bruh_mqtt_multisensor_github/bruh_mqtt_multisensor_github.ino
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ float humValue;

int pirValue;
int pirStatus;
String motionStatus;
String motionStatus="standby";

char message_buff[100];

Expand Down Expand Up @@ -145,6 +145,9 @@ void setup() {
pinMode(PIRPIN, INPUT);
pinMode(DHTPIN, INPUT);
pinMode(LDRPIN, INPUT);
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);

Serial.begin(115200);
delay(10);
Expand Down Expand Up @@ -345,14 +348,14 @@ void sendState() {
color["g"] = green;
color["b"] = blue;


root["brightness"] = brightness;
root["humidity"] = (String)humValue;
root["motion"] = (String)motionStatus;
root["ldr"] = (String)LDR;
root["temperature"] = (String)tempValue;
root["heatIndex"] = (String)calculateHeatIndex(humValue, tempValue);

if (humValue>1) { //only transmit valid values
root["humidity"] = (String)humValue;
root["temperature"] = (String)tempValue;
root["heatIndex"] = (String)calculateHeatIndex(humValue, tempValue);
}

char buffer[root.measureLength() + 1];
root.printTo(buffer, sizeof(buffer));
Expand Down