Tasmota/sonoff/xsns_interface.ino
arendst 9c9a80f7b6 v5.11.0
5.11.0 20180107
 * Minor webpage HTML optimizations (#1358)
 * Updated
German translation (#1438)
 * Change Sonoff Pow Energy MQTT data message
and consolidate Status 8 into Status 10
 * Change ADS1115 default
voltage range from +/-2V to +/-6V (#1289)
 * Change text to Active for 3
minutes (#1364)
 * Change Wemo SetBinaryState to distinguish from
GetBinaryState (#1357)
 * Change output of HTTP command to valid JSON
and Array only (#1363)
 * Removed all MQTT, JSON and Command language
defines from locale files and set fixed to English (#1473)
 * Renamed
commands Color2,3,4 to Color3,4,5
 * Fix BME280 calculation (#1051)
 *
Fix Sonoff Bridge missed learned key if learned data contains 0x55 (End
of Transmission) flag (#1095, #1294)
 * Fix PWM initialization in
Dimmer/Color mode (#1321)
 * Fix Wemo Emulation (#1357)
 * Fix display
of build date and time in non-english locale (#1465)
 * Fix Wemo and Hue
emulation by adding M-Search response delay (#1486)
 * Add libraries
Adafruit_BME680-1.0.5, Adafruit_Sensor-1.0.2.02, TasmotaSerial-1.0.0 and
TSL2561-Arduino-Library
 * Add command Color2 to set color while keeping
same dimmer value
 * Add device function pointers
 * Add support for
SenseAir S8 CO2 sensor
 * Add color led signal to Carbon Dioxide (CO2)
sensors using defines CO2_LOW and CO2_HIGH in user_config.h
 * Add
support for Domoticz Air Quality sensor to be used by MH-Z19(B) and
SenseAir sensors
 * Add support for PZEM004T energy sensor
 * Add
support for iTead SI7021 temperature and humidity sensor by
consolidating DHT22 into AM2301 and using former DHT22 as SI7021 (#735)

* Add support for BME680 using adafruit libraries (#1212)
 * Add support
for MH-Z19(B) CO2 sensor (#561, #1248)
 * Add multipress support and
more user configurable GPIO to Sonoff Dual R2 (#1291)
 * Add support for
TSL2561 using adafruit library (#661, #1311)
 * Add support for SHT3x
(#1314)
 * Add support for Arilux LC06 (#1414)
 * Add Italian language
file (#1449)
 * Add 2nd Gen Alexa support to Wemo emulation discovery
(#1357, #1450)
 * Add define for additional number of WS2812 schemes
(#1463)
2018-01-07 14:40:37 +01:00

127 lines
2.7 KiB
C++

/*
xsns_interface.ino - External sensor interface support for Sonoff-Tasmota
Copyright (C) 2018 Theo Arends inspired by ESPEasy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
void XSnsInit()
{
for (byte i = 0; i < XSNS_MAX; i++) {
xsns_func_ptr[i] = NULL;
}
xsns_present = 0;
#ifdef XSNS_01
xsns_func_ptr[xsns_present++] = &Xsns01;
#endif
#ifdef XSNS_02
xsns_func_ptr[xsns_present++] = &Xsns02;
#endif
#ifdef XSNS_03
xsns_func_ptr[xsns_present++] = &Xsns03;
#endif
#ifdef XSNS_04
xsns_func_ptr[xsns_present++] = &Xsns04;
#endif
#ifdef XSNS_05
xsns_func_ptr[xsns_present++] = &Xsns05;
#endif
#ifdef XSNS_06
xsns_func_ptr[xsns_present++] = &Xsns06;
#endif
#ifdef XSNS_07
xsns_func_ptr[xsns_present++] = &Xsns07;
#endif
#ifdef XSNS_08
xsns_func_ptr[xsns_present++] = &Xsns08;
#endif
#ifdef XSNS_09
xsns_func_ptr[xsns_present++] = &Xsns09;
#endif
#ifdef XSNS_10
xsns_func_ptr[xsns_present++] = &Xsns10;
#endif
#ifdef XSNS_11
xsns_func_ptr[xsns_present++] = &Xsns11;
#endif
#ifdef XSNS_12
xsns_func_ptr[xsns_present++] = &Xsns12;
#endif
#ifdef XSNS_13
xsns_func_ptr[xsns_present++] = &Xsns13;
#endif
#ifdef XSNS_14
xsns_func_ptr[xsns_present++] = &Xsns14;
#endif
#ifdef XSNS_15
xsns_func_ptr[xsns_present++] = &Xsns15;
#endif
#ifdef XSNS_16
xsns_func_ptr[xsns_present++] = &Xsns16;
#endif
#ifdef XSNS_17
xsns_func_ptr[xsns_present++] = &Xsns17;
#endif
#ifdef XSNS_18
xsns_func_ptr[xsns_present++] = &Xsns18;
#endif
#ifdef XSNS_19
xsns_func_ptr[xsns_present++] = &Xsns19;
#endif
#ifdef XSNS_20
xsns_func_ptr[xsns_present++] = &Xsns20;
#endif
// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "Sensors found %d"), xsns_present);
// AddLog(LOG_LEVEL_DEBUG);
XsnsCall(FUNC_INIT);
}
/*********************************************************************************************\
* Function call to all xsns
\*********************************************************************************************/
boolean XsnsCall(byte Function)
{
boolean result = false;
for (byte x = 0; x < xsns_present; x++) {
xsns_func_ptr[x](Function);
}
return result;
}