mirror of https://github.com/arendst/Tasmota.git
Command ``SetOption146 1`` to enable display of ESP32 internal temperature
This commit is contained in:
parent
6400c9d650
commit
684584a5e5
|
@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Support for Ethernet in ESP32 safeboot firmware (#16388)
|
- Support for Ethernet in ESP32 safeboot firmware (#16388)
|
||||||
- Flowrate meter flow amount/duration, show values in table format (#16385)
|
- Flowrate meter flow amount/duration, show values in table format (#16385)
|
||||||
- Zigbee prepare for Green Power support (#16407)
|
- Zigbee prepare for Green Power support (#16407)
|
||||||
|
- Command ``SetOption146 1`` to enable display of ESP32 internal temperature
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- TasmotaModbus library from v3.5.0 to v3.6.0 (#16351)
|
- TasmotaModbus library from v3.5.0 to v3.6.0 (#16351)
|
||||||
|
|
|
@ -109,6 +109,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
||||||
|
|
||||||
## Changelog v12.1.1.1
|
## Changelog v12.1.1.1
|
||||||
### Added
|
### Added
|
||||||
|
- Command ``SetOption146 1`` to enable display of ESP32 internal temperature
|
||||||
- Command ``StatusRetain`` [#11109](https://github.com/arendst/Tasmota/issues/11109)
|
- Command ``StatusRetain`` [#11109](https://github.com/arendst/Tasmota/issues/11109)
|
||||||
- Support for SGP40 gas and air quality sensor [#16341](https://github.com/arendst/Tasmota/issues/16341)
|
- Support for SGP40 gas and air quality sensor [#16341](https://github.com/arendst/Tasmota/issues/16341)
|
||||||
- Support for Modbus writing using ModbusBridge by JeroenSt [#16351](https://github.com/arendst/Tasmota/issues/16351)
|
- Support for Modbus writing using ModbusBridge by JeroenSt [#16351](https://github.com/arendst/Tasmota/issues/16351)
|
||||||
|
|
|
@ -179,7 +179,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||||
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
|
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
|
||||||
uint32_t data; // Allow bit manipulation using SetOption
|
uint32_t data; // Allow bit manipulation using SetOption
|
||||||
struct { // SetOption146 .. SetOption177
|
struct { // SetOption146 .. SetOption177
|
||||||
uint32_t spare00 : 1; // bit 0
|
uint32_t use_esp32_temperature : 1; // bit 0 (v12.1.1.1) - SetOption146 - (ESP32) Show ESP32 internal temperature sensor
|
||||||
uint32_t spare01 : 1; // bit 1
|
uint32_t spare01 : 1; // bit 1
|
||||||
uint32_t spare02 : 1; // bit 2
|
uint32_t spare02 : 1; // bit 2
|
||||||
uint32_t spare03 : 1; // bit 3
|
uint32_t spare03 : 1; // bit 3
|
||||||
|
|
|
@ -54,63 +54,71 @@ void Esp32SensorInit(void) {
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
#endif // CONFIG_IDF_TARGET_ESP32
|
||||||
|
|
||||||
void Esp32SensorShow(bool json) {
|
void Esp32SensorShow(bool json) {
|
||||||
static bool add_global_temp = false;
|
bool json_end = false;
|
||||||
|
|
||||||
if (json) {
|
if (Settings->flag6.use_esp32_temperature) { // SetOption146 - (ESP32) Show ESP32 internal temperature sensor
|
||||||
add_global_temp = !ResponseContains_P(PSTR(D_JSON_TEMPERATURE));
|
float c = CpuTemperature(); // in Celsius
|
||||||
|
float t = ConvertTempToFahrenheit(c);
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
if (!ResponseContains_P(PSTR(D_JSON_TEMPERATURE))) {
|
||||||
|
UpdateGlobalTemperature(c);
|
||||||
|
}
|
||||||
|
ResponseAppend_P(PSTR(",\"ESP32\":{\"" D_JSON_TEMPERATURE "\":%*_f"), Settings->flag2.temperature_resolution, &t);
|
||||||
|
json_end = true;
|
||||||
|
|
||||||
|
#ifdef USE_DOMOTICZ
|
||||||
|
// Instead of below code use a rule like 'on tele-esp32#temperature do dzsend1 9988,%value% endon'
|
||||||
|
// where 9988 is the domoticz sensor Idx
|
||||||
|
// if (0 == TasmotaGlobal.tele_period) {
|
||||||
|
// if (!ResponseContains_P(PSTR(D_JSON_TEMPERATURE))) { // Only send if no other sensor already did
|
||||||
|
// DomoticzFloatSensor(DZ_TEMP, t);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
#endif // USE_DOMOTICZ
|
||||||
|
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
|
} else {
|
||||||
|
WSContentSend_Temp("ESP32", t);
|
||||||
|
#endif // USE_WEBSERVER
|
||||||
|
}
|
||||||
}
|
}
|
||||||
float c = CpuTemperature(); // in Celsius
|
|
||||||
if (add_global_temp) {
|
|
||||||
UpdateGlobalTemperature(c);
|
|
||||||
}
|
|
||||||
float t = ConvertTempToFahrenheit(c);
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
int value = 0;
|
|
||||||
if (HEData.present) {
|
if (HEData.present) {
|
||||||
|
int value = 0;
|
||||||
for (uint32_t i = 0; i < HALLEFFECT_SAMPLE_COUNT; i++) {
|
for (uint32_t i = 0; i < HALLEFFECT_SAMPLE_COUNT; i++) {
|
||||||
value += hallRead();
|
value += hallRead();
|
||||||
}
|
}
|
||||||
value /= HALLEFFECT_SAMPLE_COUNT;
|
value /= HALLEFFECT_SAMPLE_COUNT;
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
if (!json_end) {
|
||||||
|
ResponseAppend_P(PSTR(",\"ESP32\":{"));
|
||||||
|
} else {
|
||||||
|
ResponseAppend_P(PSTR(","));
|
||||||
|
}
|
||||||
|
ResponseAppend_P(PSTR("\"" D_JSON_HALLEFFECT "\":%d"), value);
|
||||||
|
json_end = true;
|
||||||
|
|
||||||
|
#ifdef USE_DOMOTICZ
|
||||||
|
// Instead of below code use a rule like 'on tele-esp32#halleffect do dzsend1 9988,%value% endon'
|
||||||
|
// where 9988 is the domoticz sensor Idx
|
||||||
|
// if (0 == TasmotaGlobal.tele_period) {
|
||||||
|
// DomoticzSensor(DZ_COUNT, value);
|
||||||
|
// }
|
||||||
|
#endif // USE_DOMOTICZ
|
||||||
|
|
||||||
|
#ifdef USE_WEBSERVER
|
||||||
|
} else {
|
||||||
|
WSContentSend_P(HTTP_SNS_HALL_EFFECT, "ESP32", value);
|
||||||
|
#endif // USE_WEBSERVER
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
#endif // CONFIG_IDF_TARGET_ESP32
|
||||||
|
|
||||||
if (json) {
|
if (json_end) {
|
||||||
bool temperature_present = (ResponseContains_P(PSTR(D_JSON_TEMPERATURE)));
|
|
||||||
ResponseAppend_P(PSTR(",\"ESP32\":{\"" D_JSON_TEMPERATURE "\":%*_f"), Settings->flag2.temperature_resolution, &t);
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
|
||||||
if (HEData.present) {
|
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_HALLEFFECT "\":%d"), value);
|
|
||||||
}
|
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
|
||||||
|
|
||||||
ResponseJsonEnd();
|
ResponseJsonEnd();
|
||||||
#ifdef USE_DOMOTICZ
|
|
||||||
if (0 == TasmotaGlobal.tele_period) {
|
|
||||||
if (!temperature_present) { // Only send if no other sensor already did
|
|
||||||
DomoticzFloatSensor(DZ_TEMP, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
|
||||||
if (HEData.present) {
|
|
||||||
DomoticzSensor(DZ_COUNT, value);
|
|
||||||
}
|
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif // USE_DOMOTICZ
|
|
||||||
#ifdef USE_WEBSERVER
|
|
||||||
} else {
|
|
||||||
WSContentSend_Temp("ESP32", t);
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
|
||||||
if (HEData.present) {
|
|
||||||
WSContentSend_P(HTTP_SNS_HALL_EFFECT, "ESP32", value);
|
|
||||||
}
|
|
||||||
#endif // CONFIG_IDF_TARGET_ESP32
|
|
||||||
|
|
||||||
#endif // USE_WEBSERVER
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,8 @@ a_setoption = [[
|
||||||
"(Zigbee) Include time in `ZbReceived` messages like other sensors",
|
"(Zigbee) Include time in `ZbReceived` messages like other sensors",
|
||||||
"(MQTT) Retain on Status"
|
"(MQTT) Retain on Status"
|
||||||
],[
|
],[
|
||||||
"","","","",
|
"(ESP32) Show ESP32 internal temperature sensor",
|
||||||
|
"","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
|
@ -319,7 +320,7 @@ else:
|
||||||
obj = json.load(fp)
|
obj = json.load(fp)
|
||||||
|
|
||||||
def StartDecode():
|
def StartDecode():
|
||||||
print ("\n*** decode-status.py v12.1.0.1 by Theo Arends and Jacek Ziolkowski ***")
|
print ("\n*** decode-status.py v12.1.1.1 by Theo Arends and Jacek Ziolkowski ***")
|
||||||
|
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue