Add heater sensors
authorEmmanuel Lacour <elacour@easter-eggs.com>
Sun, 4 Dec 2022 11:04:27 +0000 (12:04 +0100)
committerEmmanuel Lacour <elacour@easter-eggs.com>
Sun, 4 Dec 2022 11:04:27 +0000 (12:04 +0100)
garage/garage.ino

index 44f2c49..9a663f5 100644 (file)
@@ -100,9 +100,29 @@ void loop() {
         Serial.println("DEBUG wifi connected, start temp measure");
 
         sensors.requestTemperatures(); 
-        float tempC = sensors.getTempCByIndex(0);
+        float tempC = sensors.getTempCByIndex(1);
+        float heater_out_tempC = sensors.getTempCByIndex(0);
+        float heater_in_tempC = sensors.getTempCByIndex(2);
         
-        if(tempC == DEVICE_DISCONNECTED_C) 
+        if(tempC == DEVICE_DISCONNECTED_C) {
+          // Error
+        } else {
+            sendToInfluxDB("temperature,city="+city+",location=serre_semis", "value", String(tempC));
+        }
+        
+        if(heater_out_tempC == DEVICE_DISCONNECTED_C) {
+          // Error
+        } else {
+            sendToInfluxDB("temperature,city="+city+",location=heater,direction=out", "value", String(heater_out_tempC));
+        }
+        
+        if(heater_in_tempC == DEVICE_DISCONNECTED_C) {
+          // Error
+        } else {
+            sendToInfluxDB("temperature,city="+city+",location=heater,direction=in", "value", String(heater_in_tempC));
+        }
+        
+        if(tempC == DEVICE_DISCONNECTED_C) {
           // Error
         } else {
             sendToInfluxDB("temperature,city="+city+",location=serre_semis", "value", String(tempC));