Prep for 6.5

Prep for 6.5
This commit is contained in:
Theo Arends 2019-03-15 14:53:19 +01:00
parent 5f1f5f8253
commit 39d81182d5
10 changed files with 114 additions and 276 deletions

View File

@ -107,100 +107,106 @@ Core version **2.4.2** binaries can be found at http://thehackbox.org/tasmota/
### Available Features and Sensors
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | Remarks
|--------------------------------|---------|-------|---------|--------|------|---------|--------
| MY_LANGUAGE en-GB | x | x | x | x | x | x |
| MQTT_LIBRARY_TYPE PUBSUBCLIENT | x | x | x | x | x | x |
| USE_WPS | - | - | x | - | - | - | WPS
| USE_SMARTCONFIG | - | - | x | - | - | - | SmartConfig
| USE_ARDUINO_OTA | - | - | - | - | - | - |
| USE_DOMOTICZ | - | - | x | x | x | x |
| USE_HOME_ASSISTANT | - | - | - | x | x | x |
| USE_MQTT_TLS | - | - | - | - | - | - |
| USE_KNX | - | - | - | - | x | - |
| USE_WEBSERVER | x | x | x | x | x | x | WifiManager
| USE_EMULATION | - | x | x | x | - | x |
| USE_DISCOVERY | - | - | x | x | x | x |
| WEBSERVER_ADVERTISE | - | - | x | x | x | x |
| MQTT_HOST_DISCOVERY | - | - | x | x | x | x |
| USE_TIMERS | - | x | - | x | x | x |
| USE_TIMERS_WEB | - | x | - | x | x | x |
| USE_SUNRISE | - | x | - | x | x | x |
| USE_RULES | - | x | - | x | x | x |
| USE_EXPRESSION | - | - | - | - | - | - |
| | | | | | |
| USE_ADC_VCC | x | x | x | x | x | - |
| USE_DS18B20 | - | - | - | - | - | - | Single sensor
| USE_DS18x20 | - | - | x | x | x | x | Multiple sensors
| USE_DS18x20_LEGACY | - | - | - | - | - | - | Multiple sensors
| | | | | | | |
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors |
| USE_I2C | - | - | - | x | x | x |
| USE_SHT | - | - | - | x | x | x |
| USE_HTU | - | - | - | x | x | x |
| USE_BMP | - | - | - | x | x | x |
| USE_BME680 | - | - | - | - | - | x |
| USE_BH1750 | - | - | - | x | x | x |
| USE_VEML6070 | - | - | - | - | - | x |
| USE_ADS1115 | - | - | - | - | - | x |
| USE_ADS1115_I2CDEV | - | - | - | - | - | - |
| USE_INA219 | - | - | - | - | - | x |
| USE_SHT3X | - | - | - | x | x | x |
| USE_TSL2561 | - | - | - | - | - | x |
| USE_MGS | - | - | - | - | - | x |
| USE_SGP30 | - | - | - | x | x | x |
| USE_SI1145 | - | - | - | - | - | - |
| USE_LM75AD | - | - | - | x | x | x |
| USE_APDS9960 | - | - | - | - | - | - |
| USE_MCP230xx | - | - | - | - | - | - |
| USE_PCA9685 | - | - | - | - | - | - |
| USE_MPR121 | - | - | - | - | - | - |
| USE_CCS811 | - | - | - | - | - | - |
| USE_MPU6050 | - | - | - | - | - | - |
| USE_DS3231 | - | - | - | - | - | - |
| USE_MGC3130 | - | - | - | - | - | - |
| USE_MAX44009 | - | - | - | - | - | - |
| USE_SCD30 | - | - | - | - | - | x |
| | | | | | | |
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors |
| USE_SPI | - | - | - | - | - | - |
| USE_MHZ19 | - | - | - | x | x | x |
| USE_SENSEAIR | - | - | - | x | x | x |
| USE_PMS5003 | - | - | - | x | x | x |
| USE_NOVA_SDS | - | - | - | x | x | x |
| USE_PZEM004T | - | - | - | x | x | x |
| USE_PZEM_AC | - | - | - | x | x | x |
| USE_PZEM_DC | - | - | - | x | x | x |
| USE_MCP39F501 | - | x | - | x | x | x |
| USE_SERIAL_BRIDGE | - | - | - | x | x | x |
| USE_SDM120 | - | - | - | - | - | x |
| USE_SDM630 | - | - | - | - | - | x |
| USE_MP3_PLAYER | - | - | - | - | - | x |
| USE_TUYA_DIMMER | - | x | - | x | x | x |
| USE_ARMTRONIX_DIMMERS | - | x | - | x | x | x |
| USE_PS_16_DZ | - | x | - | x | x | x |
| USE_AZ7798 | - | - | - | - | - | - |
| USE_PN532_HSU | - | - | - | - | - | x |
| USE_IR_REMOTE | - | - | - | x | x | x |
| USE_IR_HVAC | - | - | - | - | - | x |
| USE_IR_RECEIVE | - | - | - | x | x | x |
| USE_WS2812 | - | - | x | x | x | x |
| USE_WS2812_DMA | - | - | - | - | - | - |
| USE_ARILUX_RF | - | - | - | x | x | x |
| USE_SR04 | - | - | - | x | x | x |
| USE_TM1638 | - | - | - | - | - | x |
| USE_HX711 | - | - | - | x | x | x |
| USE_RF_FLASH | - | - | - | x | x | x |
| USE_TX20_WIND_SENSOR | - | - | - | x | x | x |
| USE_RC_SWITCH | - | - | - | x | x | x |
| USE_RF_SENSOR | - | - | - | - | - | x | AlectoV2 only
| USE_SM16716 | - | x | x | x | x | x |
| USE_DISPLAY | - | - | - | - | - | - |
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
|-----------------------|---------|-------|---------|--------|------|---------|---------|--------
| MY_LANGUAGE en-GB | x | x | x | x | x | x | x |
| USE_WPS | - | - | x | - | - | - | - | WPS
| USE_SMARTCONFIG | - | - | x | - | - | - | - | SmartConfig
| USE_ARDUINO_OTA | - | - | - | - | - | - | - |
| USE_DOMOTICZ | - | - | x | x | x | x | - |
| USE_HOME_ASSISTANT | - | - | - | x | x | x | - |
| USE_MQTT_TLS | - | - | - | - | - | - | - |
| USE_KNX | - | - | - | - | x | - | - |
| USE_WEBSERVER | x | x | x | x | x | x | x | WifiManager
| USE_EMULATION | - | x | x | x | - | x | - |
| USE_DISCOVERY | - | - | x | x | x | x | x |
| WEBSERVER_ADVERTISE | - | - | x | x | x | x | x |
| MQTT_HOST_DISCOVERY | - | - | x | x | x | x | x |
| USE_TIMERS | - | x | - | x | x | x | x |
| USE_TIMERS_WEB | - | x | - | x | x | x | x |
| USE_SUNRISE | - | x | - | x | x | x | x |
| USE_RULES | - | x | - | x | x | x | x |
| USE_EXPRESSION | - | - | - | - | - | - | - |
| | | | | | | | |
| USE_ADC_VCC | x | x | x | x | x | - | x |
| USE_DS18B20 | - | - | - | - | - | - | - | Single sensor
| USE_DS18x20 | - | - | x | x | x | x | x | Multiple sensors
| USE_DS18x20_LEGACY | - | - | - | - | - | - | - | Multiple sensors
| | | | | | | | |
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
| USE_I2C | - | - | - | x | x | x | x |
| USE_SHT | - | - | - | x | x | x | x |
| USE_HTU | - | - | - | x | x | x | x |
| USE_BMP | - | - | - | x | x | x | x |
| USE_BME680 | - | - | - | - | - | x | - |
| USE_BH1750 | - | - | - | x | x | x | x |
| USE_VEML6070 | - | - | - | - | - | x | - |
| USE_ADS1115 | - | - | - | - | - | x | - |
| USE_ADS1115_I2CDEV | - | - | - | - | - | - | - |
| USE_INA219 | - | - | - | - | - | x | - |
| USE_SHT3X | - | - | - | x | x | x | x |
| USE_TSL2561 | - | - | - | - | - | x | - |
| USE_MGS | - | - | - | - | - | x | - |
| USE_SGP30 | - | - | - | x | x | x | x |
| USE_SI1145 | - | - | - | - | - | - | - |
| USE_LM75AD | - | - | - | x | x | x | x |
| USE_APDS9960 | - | - | - | - | - | - | - |
| USE_MCP230xx | - | - | - | - | - | - | - |
| USE_PCA9685 | - | - | - | - | - | - | - |
| USE_MPR121 | - | - | - | - | - | - | - |
| USE_CCS811 | - | - | - | - | - | - | - |
| USE_MPU6050 | - | - | - | - | - | - | - |
| USE_DS3231 | - | - | - | - | - | - | - |
| USE_MGC3130 | - | - | - | - | - | - | - |
| USE_MAX44009 | - | - | - | - | - | - | - |
| USE_SCD30 | - | - | - | - | - | x | - |
| | | | | | | | |
| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks
| USE_SPI | - | - | - | - | - | - | x |
| USE_MHZ19 | - | - | - | x | x | x | x |
| USE_SENSEAIR | - | - | - | x | x | x | x |
| USE_PMS5003 | - | - | - | x | x | x | x |
| USE_NOVA_SDS | - | - | - | x | x | x | x |
| USE_ENERGY_SENSOR | - | x | x | x | x | x | - |
| USE_PZEM004T | - | - | - | x | x | x | - |
| USE_PZEM_AC | - | - | - | x | x | x | - |
| USE_PZEM_DC | - | - | - | x | x | x | - |
| USE_MCP39F501 | - | x | - | x | x | x | - |
| USE_SERIAL_BRIDGE | - | - | - | x | x | x | x |
| USE_SDM120 | - | - | - | - | - | x | - |
| USE_SDM630 | - | - | - | - | - | x | - |
| USE_MP3_PLAYER | - | - | - | - | - | x | - |
| USE_TUYA_DIMMER | - | x | - | x | x | x | x |
| USE_ARMTRONIX_DIMMERS | - | x | - | x | x | x | x |
| USE_PS_16_DZ | - | x | - | x | x | x | x |
| USE_AZ7798 | - | - | - | - | - | - | - |
| USE_PN532_HSU | - | - | - | - | - | x | - |
| USE_IR_REMOTE | - | - | - | x | x | x | x |
| USE_IR_HVAC | - | - | - | - | - | x | - |
| USE_IR_RECEIVE | - | - | - | x | x | x | x |
| USE_WS2812 | - | - | x | x | x | x | x |
| USE_WS2812_DMA | - | - | - | - | - | - | - |
| USE_ARILUX_RF | - | - | - | x | x | x | - |
| USE_SR04 | - | - | - | x | x | x | x |
| USE_TM1638 | - | - | - | - | - | x | - |
| USE_HX711 | - | - | - | x | x | x | x |
| USE_RF_FLASH | - | - | - | x | x | x | - |
| USE_TX20_WIND_SENSOR | - | - | - | x | x | x | x |
| USE_RC_SWITCH | - | - | - | x | x | x | x |
| USE_RF_SENSOR | - | - | - | - | - | x | - | AlectoV2 only
| USE_SM16716 | - | x | x | x | x | x | x |
| USE_DISPLAY | - | - | - | - | - | - | x |
| USE_DISPLAY_LCD | - | - | - | - | - | - | x |
| USE_DISPLAY_SSD1306 | - | - | - | - | - | - | x |
| USE_DISPLAY_MATRIX | - | - | - | - | - | - | x |
| USE_DISPLAY_ILI9341 | - | - | - | - | - | - | x |
| USE_DISPLAY_EPAPER_29 | - | - | - | - | - | - | x |
## Changelog
Version 6.5.0 20190319
* Remove commands SetOption14 and SetOption63 as it has been superseded by command Interlock
* Remove command SetOption35 0-255 for mDNS start-up delay (#4793)
* Remove support for MQTT_LIBRARY_TYPE, MQTT_ARDUINOMQTT and MQTT_TASMOTAMQTT (#5474)
* Change webserver content handling from single String to small Chunks increasing RAM
* Change code use of boolean to bool and byte to uint8_t
* Change code uint8_t flags to bool flags

View File

@ -1,6 +1,9 @@
/* 6.5.0 20190319
* New Release
*
* 6.4.2.22 20190315
* Remove support for MQTT_LIBRARY_TYPE, MQTT_ARDUINOMQTT and MQTT_TASMOTAMQTT (#5474)
*
* 6.4.1.21 20190309
* Fix exception on GUI Configure Logging and Configure Other (#5424)
* Add support for sensor SCD30 (#5434)

View File

@ -230,16 +230,6 @@
// -- OTA -----------------------------------------
//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)
/*-------------------------------------------------------------------------------------------*\
* Select ONE of possible MQTT library types below
\*-------------------------------------------------------------------------------------------*/
// Default MQTT driver for both non-TLS and TLS connections. Latest library version (20181016) does not block network if MQTT server is unavailable.
#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library
// Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support
//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 (core 2.3.0), +14k4 (core 2.4.2 lwip2) code, +4k mem) - non-TLS only
// Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested.
//#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem)
// -- MQTT ----------------------------------------
#define MQTT_TELE_RETAIN 0 // Tele messages may send retain flag (0 = off, 1 = on)

View File

@ -1682,8 +1682,8 @@ void PublishStatus(uint8_t payload)
}
if (((0 == payload) || (6 == payload)) && Settings.flag.mqtt_enabled) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS6_MQTT "\":{\"" D_CMND_MQTTHOST "\":\"%s\",\"" D_CMND_MQTTPORT "\":%d,\"" D_CMND_MQTTCLIENT D_JSON_MASK "\":\"%s\",\"" D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"MqttType\":%d,\"" D_JSON_MQTT_COUNT "\":%d,\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d}}"),
Settings.mqtt_host, Settings.mqtt_port, Settings.mqtt_client, mqtt_client, Settings.mqtt_user, MqttLibraryType(), MqttConnectCount(), MQTT_MAX_PACKET_SIZE, MQTT_KEEPALIVE);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS6_MQTT "\":{\"" D_CMND_MQTTHOST "\":\"%s\",\"" D_CMND_MQTTPORT "\":%d,\"" D_CMND_MQTTCLIENT D_JSON_MASK "\":\"%s\",\"" D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d,\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d}}"),
Settings.mqtt_host, Settings.mqtt_port, Settings.mqtt_client, mqtt_client, Settings.mqtt_user, MqttConnectCount(), MQTT_MAX_PACKET_SIZE, MQTT_KEEPALIVE);
MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "6"));
}

View File

@ -158,8 +158,6 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#ifndef USE_SMARTCONFIG
#define USE_SMARTCONFIG // Add support for Wifi SmartConfig as initial wifi configuration tool (+23k code, +0.6k mem)
#endif
#undef MQTT_LIBRARY_TYPE
#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library
#undef USE_ARDUINO_OTA // Disable support for Arduino OTA
//#undef USE_DOMOTICZ // Disable Domoticz
#undef USE_HOME_ASSISTANT // Disable Home Assistant

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_
#define VERSION 0x06050000
#define VERSION 0x06040116
#define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends"

View File

@ -56,10 +56,10 @@ void GetFeatures(void)
feature_drv1 |= 0x00000400; // xdrv_01_mqtt.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
feature_drv1 |= 0x00000800; // xdrv_01_mqtt.ino
// feature_drv1 |= 0x00000800; // xdrv_01_mqtt.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete since 6.2.1.11
feature_drv1 |= 0x00001000; // xdrv_01_mqtt.ino
// feature_drv1 |= 0x00001000; // xdrv_01_mqtt.ino
#endif
#ifdef MQTT_HOST_DISCOVERY
feature_drv1 |= 0x00002000; // xdrv_01_mqtt.ino
@ -116,7 +116,7 @@ void GetFeatures(void)
feature_drv1 |= 0x40000000; // support.ino
#endif
#if (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT)
feature_drv1 |= 0x80000000; // xdrv_01_mqtt.ino
// feature_drv1 |= 0x80000000; // xdrv_01_mqtt.ino
#endif
/*********************************************************************************************/

View File

@ -294,9 +294,7 @@ const char HTTP_FORM_LOGIN[] PROGMEM =
const char HTTP_FORM_TEMPLATE[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_TEMPLATE_PARAMETERS "&nbsp;</b></legend>"
"<form method='get' action='tp'>"
"<p><b>" D_TEMPLATE_NAME "</b><br/><input id='s1' name='s1' placeholder='" D_TEMPLATE_NAME "'></p>"
"<p></p><b>" D_BASE_TYPE "</b><br/><select id='g99' name='g99' onchange='st(this.value)'></select><br/>";
"<form method='get' action='tp'>";
const char HTTP_FORM_TEMPLATE_FLAG[] PROGMEM =
"<p></p>" // Keep close so do not use <br/>
"<fieldset><legend><b>&nbsp;" D_TEMPLATE_FLAGS "&nbsp;</b></legend><p>"
@ -1063,16 +1061,20 @@ void HandleTemplateConfiguration(void)
WSContentSend_P(HTTP_SCRIPT_TEMPLATE);
WSContentSendStyle();
WSContentSend_P(HTTP_FORM_TEMPLATE);
WSContentSend_P(PSTR("<br/><table>"));
WSContentSend_P(HTTP_TABLE100);
WSContentSend_P(PSTR("<tr><td><b>" D_TEMPLATE_NAME "</b></td><td style='width:200px'><input id='s1' name='s1' placeholder='" D_TEMPLATE_NAME "'></td></tr>"
"<tr><td><b>" D_BASE_TYPE "</b></td><td><select id='g99' name='g99' onchange='st(this.value)'></select></td></tr>"
"</table>"
"<hr/>"));
WSContentSend_P(HTTP_TABLE100);
for (uint8_t i = 0; i < 17; i++) {
if ((i < 6) || ((i > 8) && (i != 11))) { // Ignore flash pins GPIO06, 7, 8 and 11
WSContentSend_P(PSTR("<tr><td%s><b>" D_GPIO "%d</b></td><td>%s</td><td%s><select id='g%d' name='g%d'></select></td></tr>"),
(0==i)?" style='width:74px'":"", i, ((9==i)||(10==i))? "<font color='red'>ESP8285</font>" :"", (0==i)?" style='width:176px'":"", i, i);
bool esp8285 = ((9==i)||(10==i));
WSContentSend_P(PSTR("<tr><td><b>%s" D_GPIO "%d%s</b></td><td%s><select id='g%d' name='g%d'></select></td></tr>"),
(esp8285) ? "<font color='red'>" : "", i, (esp8285) ? "</font>" : "", (0==i) ? " style='width:200px'" : "", i, i);
}
}
WSContentSend_P(PSTR("</table>"));
WSContentSend_P(HTTP_FORM_TEMPLATE_FLAG);
WSContentSend_P(HTTP_FORM_END);
WSContentSpaceButton(BUTTON_CONFIGURATION);

View File

@ -19,42 +19,6 @@
#define XDRV_02 2
/*********************************************************************************************\
* Select ONE of possible MQTT library types below
\*********************************************************************************************/
// Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable.
//#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library
// Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support
//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 (core 2.3.0), +14k4 (core 2.4.2 lwip2) code, +4k mem) - non-TLS only
// Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested.
//#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem)
#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete as of v6.2.1.11
#undef MQTT_LIBRARY_TYPE
#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT
#endif
/*
#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
#undef MQTT_LIBRARY_TYPE
#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Obsolete in near future
#endif
*/
#ifdef USE_MQTT_TLS
#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
#undef MQTT_LIBRARY_TYPE
#endif
#ifndef MQTT_LIBRARY_TYPE
#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS
#endif
#endif // USE_MQTT_TLS
/*********************************************************************************************/
#ifdef USE_MQTT_TLS
#ifdef USE_MQTT_TLS_CA_CERT
#include "sonoff_letsencrypt.h" // LetsEncrypt certificate
@ -89,8 +53,6 @@ bool mqtt_allowed = false; // MQTT enabled and parameters valid
* void MqttLoop()
\*********************************************************************************************/
#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) /***********************************************/
#include <PubSubClient.h>
// Max message size calculated by PubSubClient is (MQTT_MAX_PACKET_SIZE < 5 + 2 + strlen(topic) + plength)
@ -134,96 +96,6 @@ void MqttLoop(void)
MqttClient.loop();
}
#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) /**********************************************/
#include <TasmotaMqtt.h>
TasmotaMqtt MqttClient;
bool MqttIsConnected(void)
{
return MqttClient.Connected();
}
void MqttDisconnect(void)
{
MqttClient.Disconnect();
}
void MqttDisconnectedCb(void)
{
MqttDisconnected(MqttClient.State()); // status codes are documented in file mqtt.h as tConnState
}
void MqttSubscribeLib(const char *topic)
{
MqttClient.Subscribe(topic, 0);
}
void MqttUnsubscribeLib(const char *topic)
{
MqttClient.Unsubscribe(topic, 0);
}
bool MqttPublishLib(const char* topic, bool retained)
{
return MqttClient.Publish(topic, mqtt_data, strlen(mqtt_data), 0, retained);
}
void MqttLoop(void)
{
}
#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT) /**********************************************/
#include <MQTTClient.h>
MQTTClient MqttClient(MQTT_MAX_PACKET_SIZE);
bool MqttIsConnected(void)
{
return MqttClient.connected();
}
void MqttDisconnect(void)
{
MqttClient.disconnect();
}
/*
void MqttMyDataCb(MQTTClient* client, char* topic, char* data, int data_len)
//void MqttMyDataCb(MQTTClient *client, char topic[], char data[], int data_len)
{
// MqttDataHandler((char*)topic, (uint8_t*)data, data_len);
}
*/
void MqttMyDataCb(String &topic, String &data)
{
MqttDataHandler((char*)topic.c_str(), (uint8_t*)data.c_str(), data.length());
}
void MqttSubscribeLib(const char *topic)
{
MqttClient.subscribe(topic, 0);
}
void MqttUnsubscribeLib(const char *topic)
{
MqttClient.unsubscribe(topic, 0);
}
bool MqttPublishLib(const char* topic, bool retained)
{
return MqttClient.publish(topic, mqtt_data, strlen(mqtt_data), retained, 0);
}
void MqttLoop(void)
{
MqttClient.loop();
// delay(10);
}
#endif // MQTT_LIBRARY_TYPE
/*********************************************************************************************/
#ifdef USE_DISCOVERY
@ -254,11 +126,6 @@ void MqttDiscoverServer(void)
#endif // MQTT_HOST_DISCOVERY
#endif // USE_DISCOVERY
int MqttLibraryType(void)
{
return (int)MQTT_LIBRARY_TYPE;
}
void MqttRetryCounter(uint8_t value)
{
mqtt_retry_counter = value;
@ -573,38 +440,20 @@ void MqttReconnect(void)
GetTopic_P(stopic, TELE, mqtt_topic, S_LWT);
snprintf_P(mqtt_data, sizeof(mqtt_data), S_OFFLINE);
//#ifdef ARDUINO_ESP8266_RELEASE_2_4_1
#ifdef USE_MQTT_TLS
EspClient = WiFiClientSecure(); // Wifi Secure Client reconnect issue 4497 (https://github.com/esp8266/Arduino/issues/4497)
#else
EspClient = WiFiClient(); // Wifi Client reconnect issue 4497 (https://github.com/esp8266/Arduino/issues/4497)
#endif
//#endif
if (2 == mqtt_initial_connection_state) { // Executed once just after power on and wifi is connected
#ifdef USE_MQTT_TLS
if (!MqttCheckTls()) return;
#endif // USE_MQTT_TLS
#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
MqttClient.InitConnection(Settings.mqtt_host, Settings.mqtt_port);
MqttClient.InitClient(mqtt_client, mqtt_user, mqtt_pwd, MQTT_KEEPALIVE);
MqttClient.InitLWT(stopic, mqtt_data, 1, true);
MqttClient.OnConnected(MqttConnected);
MqttClient.OnDisconnected(MqttDisconnectedCb);
MqttClient.OnData(MqttDataHandler);
#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT)
MqttClient.begin(Settings.mqtt_host, Settings.mqtt_port, EspClient);
MqttClient.setWill(stopic, mqtt_data, true, 1);
MqttClient.setOptions(MQTT_KEEPALIVE, true, MQTT_TIMEOUT);
// MqttClient.onMessageAdvanced(MqttMyDataCb);
MqttClient.onMessage(MqttMyDataCb);
#endif
mqtt_initial_connection_state = 1;
}
#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT)
MqttClient.setCallback(MqttDataHandler);
MqttClient.setServer(Settings.mqtt_host, Settings.mqtt_port);
if (MqttClient.connect(mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, true, mqtt_data)) {
@ -612,15 +461,6 @@ void MqttReconnect(void)
} else {
MqttDisconnected(MqttClient.state()); // status codes are documented here http://pubsubclient.knolleary.net/api.html#state
}
#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT)
MqttClient.Connect();
#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT)
if (MqttClient.connect(mqtt_client, mqtt_user, mqtt_pwd)) {
MqttConnected();
} else {
MqttDisconnected(MqttClient.lastError()); // status codes are documented here https://github.com/256dpi/lwmqtt/blob/master/include/lwmqtt.h#L11
}
#endif // MQTT_LIBRARY_TYPE
}
void MqttCheck(void)

View File

@ -434,7 +434,6 @@ const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM =
const char HTTP_FORM_DOMOTICZ[] PROGMEM =
"<fieldset><legend><b>&nbsp;" D_DOMOTICZ_PARAMETERS "&nbsp;</b></legend>"
"<form method='post' action='" WEB_HANDLE_DOMOTICZ "'>"
"<br/>"
"<table>";
const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM =
"<tr><td style='width:260px'><b>" D_DOMOTICZ_IDX " %d</b></td><td style='width:70px'><input id='r%d' name='r%d' placeholder='0' value='%d'></td></tr>"