mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
Add command `IfxSensor 1
` to send non-teleperiod data to influxdb
This commit is contained in:
parent
eacecb2339
commit
c84f5fe607
@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
## [11.0.0.5]
|
## [11.0.0.5]
|
||||||
### Added
|
### Added
|
||||||
- Support for improv as used by esp-web-tools
|
- Support for improv as used by esp-web-tools
|
||||||
- Non-teleperiod data to influxdb
|
- Command ``IfxSensor 1`` to send non-teleperiod data to influxdb
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes (#15280)
|
- Remove support for Internet Explorer by allowing ECMAScript6 syntax using less JavaScript code bytes (#15280)
|
||||||
|
@ -110,6 +110,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||||||
- Command ``SspmMap 0`` to reset Sonoff SPM default mapping
|
- Command ``SspmMap 0`` to reset Sonoff SPM default mapping
|
||||||
- Command ``TcpConnect <port><ip_address>`` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874)
|
- Command ``TcpConnect <port><ip_address>`` to add client connection mode [#14874](https://github.com/arendst/Tasmota/issues/14874)
|
||||||
- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 [#15061](https://github.com/arendst/Tasmota/issues/15061)
|
- Command ``RfTimeout 100..60000`` to disable duplicate RfReceive. Default 1000 [#15061](https://github.com/arendst/Tasmota/issues/15061)
|
||||||
|
- Command ``IfxSensor 1`` to send non-teleperiod data to influxdb
|
||||||
- Commands ``Sensor12 D0 .. D5, S0 .. S5`` allowing differential or single-ended modes [#15001](https://github.com/arendst/Tasmota/issues/15001)
|
- Commands ``Sensor12 D0 .. D5, S0 .. S5`` allowing differential or single-ended modes [#15001](https://github.com/arendst/Tasmota/issues/15001)
|
||||||
- NeoPool commands ``NPpHMin``, ``NPpHMax``, ``NPpH``, ``NPRedox``, ``NPHydrolysis``, ``NPIonization``, ``NPChlorine`` and ``NPControl`` [#15015](https://github.com/arendst/Tasmota/issues/15015)
|
- NeoPool commands ``NPpHMin``, ``NPpHMax``, ``NPpH``, ``NPRedox``, ``NPHydrolysis``, ``NPIonization``, ``NPChlorine`` and ``NPControl`` [#15015](https://github.com/arendst/Tasmota/issues/15015)
|
||||||
- NeoPool system voltages display
|
- NeoPool system voltages display
|
||||||
@ -120,7 +121,6 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||||||
- Support for PCF85363 RTC as used in Shelly 3EM [#13515](https://github.com/arendst/Tasmota/issues/13515)
|
- Support for PCF85363 RTC as used in Shelly 3EM [#13515](https://github.com/arendst/Tasmota/issues/13515)
|
||||||
- Full RTC chip integration and synchronisation when using UBX (=GPS), NTP or manual time
|
- Full RTC chip integration and synchronisation when using UBX (=GPS), NTP or manual time
|
||||||
- NeoPool JSON modules, power module, cell info, chlorine, conductivity and ionization
|
- NeoPool JSON modules, power module, cell info, chlorine, conductivity and ionization
|
||||||
- Non-teleperiod data to influxdb
|
|
||||||
- ESP32 Berry always enable rules
|
- ESP32 Berry always enable rules
|
||||||
- ESP32 Berry bootloop protection
|
- ESP32 Berry bootloop protection
|
||||||
- ESP32 support for BLE Mi scale V1 [#13517](https://github.com/arendst/Tasmota/issues/13517)
|
- ESP32 support for BLE Mi scale V1 [#13517](https://github.com/arendst/Tasmota/issues/13517)
|
||||||
|
@ -252,7 +252,7 @@ typedef union {
|
|||||||
uint32_t influxdb_state : 1; // bit 7 (v9.5.0.5) - CMND_IFX - Enable influxdb support
|
uint32_t influxdb_state : 1; // bit 7 (v9.5.0.5) - CMND_IFX - Enable influxdb support
|
||||||
uint32_t sspm_display : 1; // bit 8 (v10.0.0.4) - CMND_SSPMDISPLAY - Enable gui display of powered on relays only
|
uint32_t sspm_display : 1; // bit 8 (v10.0.0.4) - CMND_SSPMDISPLAY - Enable gui display of powered on relays only
|
||||||
uint32_t local_ntp_server : 1; // bit 9 (v11.0.0.4) - CMND_RTCNTPSERVER - Enable local NTP server
|
uint32_t local_ntp_server : 1; // bit 9 (v11.0.0.4) - CMND_RTCNTPSERVER - Enable local NTP server
|
||||||
uint32_t spare10 : 1; // bit 10
|
uint32_t influxdb_sensor : 1; // bit 10 (v11.0.0.5) - CMND_IFXSENSOR - Enable sensor support in addition to teleperiod support
|
||||||
uint32_t spare11 : 1; // bit 11
|
uint32_t spare11 : 1; // bit 11
|
||||||
uint32_t spare12 : 1; // bit 12
|
uint32_t spare12 : 1; // bit 12
|
||||||
uint32_t spare13 : 1; // bit 13
|
uint32_t spare13 : 1; // bit 13
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
* IfxOrg - Set Influxdb v2 and organization
|
* IfxOrg - Set Influxdb v2 and organization
|
||||||
* IfxToken - Set Influxdb v2 and token
|
* IfxToken - Set Influxdb v2 and token
|
||||||
* IfxPeriod - Set Influxdb period. If not set (or 0), use Teleperiod
|
* IfxPeriod - Set Influxdb period. If not set (or 0), use Teleperiod
|
||||||
|
* IfxSensor - Set Influxdb sensor logging off (0) or on (1)
|
||||||
*
|
*
|
||||||
* Set influxdb update interval with command teleperiod
|
* Set influxdb update interval with command teleperiod
|
||||||
*
|
*
|
||||||
@ -365,6 +366,12 @@ void InfluxDbProcessJson(bool use_copy = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InfluxDbProcess(bool use_copy = false) {
|
||||||
|
if (Settings->sbflag1.influxdb_sensor) {
|
||||||
|
InfluxDbProcessJson(use_copy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InfluxDbPublishPowerState(uint32_t device) {
|
void InfluxDbPublishPowerState(uint32_t device) {
|
||||||
Response_P(PSTR("{\"power%d\":\"%d\"}"), device, bitRead(TasmotaGlobal.power, device -1));
|
Response_P(PSTR("{\"power%d\":\"%d\"}"), device, bitRead(TasmotaGlobal.power, device -1));
|
||||||
InfluxDbProcessJson();
|
InfluxDbProcessJson();
|
||||||
@ -419,6 +426,7 @@ void InfluxDbLoop(void) {
|
|||||||
#define D_CMND_INFLUXDBDATABASE "Database"
|
#define D_CMND_INFLUXDBDATABASE "Database"
|
||||||
#define D_CMND_INFLUXDBBUCKET "Bucket"
|
#define D_CMND_INFLUXDBBUCKET "Bucket"
|
||||||
#define D_CMND_INFLUXDBPERIOD "Period"
|
#define D_CMND_INFLUXDBPERIOD "Period"
|
||||||
|
#define D_CMND_INFLUXDBSENSOR "Sensor"
|
||||||
|
|
||||||
const char kInfluxDbCommands[] PROGMEM = D_PRFX_INFLUXDB "|" // Prefix
|
const char kInfluxDbCommands[] PROGMEM = D_PRFX_INFLUXDB "|" // Prefix
|
||||||
"|" D_CMND_INFLUXDBLOG "|"
|
"|" D_CMND_INFLUXDBLOG "|"
|
||||||
@ -426,7 +434,7 @@ const char kInfluxDbCommands[] PROGMEM = D_PRFX_INFLUXDB "|" // Prefix
|
|||||||
D_CMND_INFLUXDBUSER "|" D_CMND_INFLUXDBORG "|"
|
D_CMND_INFLUXDBUSER "|" D_CMND_INFLUXDBORG "|"
|
||||||
D_CMND_INFLUXDBPASSWORD "|" D_CMND_INFLUXDBTOKEN "|"
|
D_CMND_INFLUXDBPASSWORD "|" D_CMND_INFLUXDBTOKEN "|"
|
||||||
D_CMND_INFLUXDBDATABASE "|" D_CMND_INFLUXDBBUCKET "|"
|
D_CMND_INFLUXDBDATABASE "|" D_CMND_INFLUXDBBUCKET "|"
|
||||||
D_CMND_INFLUXDBPERIOD;
|
D_CMND_INFLUXDBPERIOD "|" D_CMND_INFLUXDBSENSOR;
|
||||||
|
|
||||||
void (* const InfluxCommand[])(void) PROGMEM = {
|
void (* const InfluxCommand[])(void) PROGMEM = {
|
||||||
&CmndInfluxDbState, &CmndInfluxDbLog,
|
&CmndInfluxDbState, &CmndInfluxDbLog,
|
||||||
@ -434,7 +442,7 @@ void (* const InfluxCommand[])(void) PROGMEM = {
|
|||||||
&CmndInfluxDbUser, &CmndInfluxDbUser,
|
&CmndInfluxDbUser, &CmndInfluxDbUser,
|
||||||
&CmndInfluxDbPassword, &CmndInfluxDbPassword,
|
&CmndInfluxDbPassword, &CmndInfluxDbPassword,
|
||||||
&CmndInfluxDbDatabase, &CmndInfluxDbDatabase,
|
&CmndInfluxDbDatabase, &CmndInfluxDbDatabase,
|
||||||
&CmndInfluxDbPeriod };
|
&CmndInfluxDbPeriod, &CmndInfluxDbSensor };
|
||||||
|
|
||||||
void InfluxDbReinit(void) {
|
void InfluxDbReinit(void) {
|
||||||
IFDB.init = false;
|
IFDB.init = false;
|
||||||
@ -459,6 +467,13 @@ void CmndInfluxDbState(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CmndInfluxDbSensor(void) {
|
||||||
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) {
|
||||||
|
Settings->sbflag1.influxdb_sensor = XdrvMailbox.payload;
|
||||||
|
}
|
||||||
|
ResponseCmndStateText(Settings->sbflag1.influxdb_sensor);
|
||||||
|
}
|
||||||
|
|
||||||
void CmndInfluxDbLog(void) {
|
void CmndInfluxDbLog(void) {
|
||||||
if ((XdrvMailbox.payload >= LOG_LEVEL_NONE) && (XdrvMailbox.payload <= LOG_LEVEL_DEBUG_MORE)) {
|
if ((XdrvMailbox.payload >= LOG_LEVEL_NONE) && (XdrvMailbox.payload <= LOG_LEVEL_DEBUG_MORE)) {
|
||||||
IFDB.log_level = XdrvMailbox.payload;
|
IFDB.log_level = XdrvMailbox.payload;
|
||||||
|
@ -1095,7 +1095,7 @@ bool XdrvRulesProcess(bool teleperiod, const char* event) {
|
|||||||
bool XdrvRulesProcess(bool teleperiod) {
|
bool XdrvRulesProcess(bool teleperiod) {
|
||||||
#ifdef USE_INFLUXDB
|
#ifdef USE_INFLUXDB
|
||||||
if (!teleperiod) { // Only process ad-hoc data here
|
if (!teleperiod) { // Only process ad-hoc data here
|
||||||
InfluxDbProcessJson(1); // Use a copy
|
InfluxDbProcess(1); // Use a copy
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user