From 55d66b763c1212907f4fe3f52720919062da65b1 Mon Sep 17 00:00:00 2001 From: Ollo Date: Tue, 16 Feb 2021 22:29:07 +0100 Subject: [PATCH] Chip temperature is published, too --- esp32/include/HomieConfiguration.h | 1 + esp32/src/main.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/esp32/include/HomieConfiguration.h b/esp32/include/HomieConfiguration.h index a364c4b..508da87 100644 --- a/esp32/include/HomieConfiguration.h +++ b/esp32/include/HomieConfiguration.h @@ -28,6 +28,7 @@ #define TEMPERATUR_SENSOR_LIPO "lipo" #define TEMPERATUR_SENSOR_WATER "water" #define TEMPERATUR_SENSOR_OUTSIDE "temp" +#define TEMPERATUR_SENSOR_CHIP "chip" #define TEMPERATURE_NAME "Temperature" #define TEMPERATURE_UNIT "°C" diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index e6ce79a..50e726e 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -387,6 +387,11 @@ void mode2MQTT() } } + if (! isnan(mChipTemp)) { + sensorTemp.setProperty(TEMPERATUR_SENSOR_CHIP).send(String(mChipTemp)); + Serial << "Chip Temperatur " << mChipTemp << " °C " << endl; + } + /* deactivate the sensors */ digitalWrite(OUTPUT_SENSOR, LOW); } @@ -798,6 +803,10 @@ void systemInit() .setName(TEMPERATURE_NAME) .setDatatype(NUMBER_TYPE) .setUnit(TEMPERATURE_UNIT); + sensorTemp.advertise(TEMPERATUR_SENSOR_CHIP) + .setName(TEMPERATURE_NAME) + .setDatatype(NUMBER_TYPE) + .setUnit(TEMPERATURE_UNIT); sensorLipo.advertise("percent") .setName("Percent")