Show power status in state message always with power index number like ``POWER1``

Add state information to influxdb
This commit is contained in:
Theo Arends 2021-08-14 17:35:31 +02:00
parent 64c527e3c3
commit 59a13644b9
4 changed files with 16 additions and 1 deletions

View File

@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- Prometheus: All metrics are prefixed with ``tasmota_`` (#12842) - Prometheus: All metrics are prefixed with ``tasmota_`` (#12842)
Memory metrics have been cleaned up to work consistently between ESP8266 and ESP32 Memory metrics have been cleaned up to work consistently between ESP8266 and ESP32
The device name is reported as an info metric The device name is reported as an info metric
- Show power status in state message always with power index number like ``POWER1``
### Fixed ### Fixed
- Neopool communication error (#12813) - Neopool communication error (#12813)

View File

@ -133,6 +133,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Disable PSRAM on unsupported hardware - Disable PSRAM on unsupported hardware
- ESP32 remove GPIO initialization to INPUT from not used GPIOs to allow JTAG support - ESP32 remove GPIO initialization to INPUT from not used GPIOs to allow JTAG support
- Relax NTP poll if no ntpserver can be resolved by DNS - Relax NTP poll if no ntpserver can be resolved by DNS
- Show power status in state message always with power index number like ``POWER1``
- Make Sonoff L1 MusicSync persistent [#12008](https://github.com/arendst/Tasmota/issues/12008) - Make Sonoff L1 MusicSync persistent [#12008](https://github.com/arendst/Tasmota/issues/12008)
- Simplified configuration for ir-full and removal of tasmota-ircustom [#12428](https://github.com/arendst/Tasmota/issues/12428) - Simplified configuration for ir-full and removal of tasmota-ircustom [#12428](https://github.com/arendst/Tasmota/issues/12428)
- Refactor platformio [#12442](https://github.com/arendst/Tasmota/issues/12442) - Refactor platformio [#12442](https://github.com/arendst/Tasmota/issues/12442)

View File

@ -753,7 +753,7 @@ void MqttShowState(void)
if (i == LightDevice()) { ResponseLightState(1); } // call it only once if (i == LightDevice()) { ResponseLightState(1); } // call it only once
} else { } else {
#endif #endif
ResponseAppend_P(PSTR(",\"%s\":\"%s\""), GetPowerDevice(stemp1, i, sizeof(stemp1), Settings->flag.device_index_enable), // SetOption26 - Switch between POWER or POWER1 ResponseAppend_P(PSTR(",\"%s\":\"%s\""), GetPowerDevice(stemp1, i, sizeof(stemp1), 1), // SetOption26 - Switch between POWER or POWER1
GetStateText(bitRead(TasmotaGlobal.power, i-1))); GetStateText(bitRead(TasmotaGlobal.power, i-1)));
#ifdef USE_SONOFF_IFAN #ifdef USE_SONOFF_IFAN
if (IsModuleIfan()) { if (IsModuleIfan()) {

View File

@ -39,6 +39,11 @@
* IfxToken - Set Influxdb v2 and token * IfxToken - Set Influxdb v2 and token
* *
* Set influxdb update interval with command teleperiod * Set influxdb update interval with command teleperiod
*
* The following triggers result in automatic influxdb numeric feeds without appended time:
* - this driver initiated state message
* - this driver initiated teleperiod data
* - power commands
\*********************************************************************************************/ \*********************************************************************************************/
#define XDRV_59 59 #define XDRV_59 59
@ -361,10 +366,18 @@ void InfluxDbLoop(void) {
} }
} }
} else { } else {
// {"Time":"2021-08-14T17:19:33","Uptime":"0T00:24:09","UptimeSec":1449,"Heap":29,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"ON","Wifi":{"AP":1,"SSId":"indebuurt_IoT","BSSId":"98:38:C9:CA:17:C1","Channel":11,"Mode":"11n","RSSI":100,"Signal":-44,"LinkCount":1,"Downtime":"0T00:00:03"}}
ResponseClear();
MqttShowState(); // Pull state data
InfluxDbProcessJson();
// {"Time":"2021-08-14T17:19:33","Switch1":"ON","Switch2":"OFF","ANALOG":{"Temperature":184.72},"DS18B20":{"Id":"01144A0CB2AA","Temperature":27.50},"HTU21":{"Temperature":28.23,"Humidity":39.7,"DewPoint":13.20},"Global":{"Temperature":27.50,"Humidity":39.7,"DewPoint":12.55},"TempUnit":"C"}
ResponseClear(); ResponseClear();
if (MqttShowSensor()) { // Pull sensor data if (MqttShowSensor()) { // Pull sensor data
InfluxDbProcessJson(); InfluxDbProcessJson();
}; };
} }
} }
} }