From a43eaef01be11431d00d16ee41388d87402e7b20 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 2 Sep 2022 15:26:44 +0200 Subject: [PATCH] Add influxdb support to zigbee (#16417) --- tasmota/include/tasmota_configurations.h | 2 ++ tasmota/include/tasmota_configurations_ESP32.h | 2 ++ .../tasmota_xdrv_driver/xdrv_23_zigbee_2a_devices_impl.ino | 4 ++++ tasmota/tasmota_xdrv_driver/xdrv_59_influxdb.ino | 6 +++--- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tasmota/include/tasmota_configurations.h b/tasmota/include/tasmota_configurations.h index 5fbf62f63..58cb80798 100644 --- a/tasmota/include/tasmota_configurations.h +++ b/tasmota/include/tasmota_configurations.h @@ -500,6 +500,8 @@ #undef FALLBACK_MODULE #define FALLBACK_MODULE SONOFF_ZB_BRIDGE // [Module2] Select default module on fast reboot where USER_MODULE is user template +#define USE_INFLUXDB // Enable influxdb support (+5k code) + #undef SERIAL_LOG_LEVEL #define SERIAL_LOG_LEVEL LOG_LEVEL_NONE // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE) diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index 34db4eff8..dc827d7e1 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -459,6 +459,8 @@ #undef FALLBACK_MODULE #define FALLBACK_MODULE WEMOS // [Module2] Select default module on fast reboot where USER_MODULE is user template +#define USE_INFLUXDB // Enable influxdb support (+5k code) + #undef USE_DOMOTICZ #undef USE_HOME_ASSISTANT #define USE_TASMOTA_DISCOVERY // Enable Tasmota Discovery support (+2k code) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_2a_devices_impl.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_2a_devices_impl.ino index 80156abaa..ab3057106 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_2a_devices_impl.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_2a_devices_impl.ino @@ -565,6 +565,10 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l ResponseAppend_P(PSTR("}")); } +#ifdef USE_INFLUXDB + InfluxDbProcess(1); // Use a copy of ResponseData +#endif + if (Settings->flag4.zigbee_distinct_topics) { char subtopic[TOPSZ]; if (Settings->flag4.zb_topic_fname && friendlyName && strlen(friendlyName)) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_59_influxdb.ino b/tasmota/tasmota_xdrv_driver/xdrv_59_influxdb.ino index 48adb935c..d98011399 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_59_influxdb.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_59_influxdb.ino @@ -373,7 +373,7 @@ void InfluxDbProcessJson(bool use_copy = false) { } void InfluxDbProcess(bool use_copy) { - if (Settings->sbflag1.influxdb_sensor) { + if (Settings->sbflag1.influxdb_sensor) { // IfxSensor InfluxDbProcessJson(use_copy); } } @@ -476,9 +476,9 @@ void CmndInfluxDbState(void) { void CmndInfluxDbSensor(void) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { - Settings->sbflag1.influxdb_sensor = XdrvMailbox.payload; + Settings->sbflag1.influxdb_sensor = XdrvMailbox.payload; // IfxSensor } - ResponseCmndStateText(Settings->sbflag1.influxdb_sensor); + ResponseCmndStateText(Settings->sbflag1.influxdb_sensor); // IfxSensor } void CmndInfluxDbLog(void) {