Change OTA Url

* Change default OTA Url to http://thehackbox.org/tasmota/release/sonoff.bin (#4170)
 * Add Tuya Software Serial to support additional Tuya configurations (#4178)
This commit is contained in:
Theo Arends 2018-10-27 11:37:42 +02:00
parent 468e194a82
commit 53e1420961
5 changed files with 152 additions and 127 deletions

View File

@ -12,6 +12,10 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
[![GitHub forks](https://img.shields.io/github/forks/arendst/Sonoff-Tasmota.svg?style=social&label=Fork)](https://github.com/arendst/Sonoff-Tasmota/network) [![GitHub forks](https://img.shields.io/github/forks/arendst/Sonoff-Tasmota.svg?style=social&label=Fork)](https://github.com/arendst/Sonoff-Tasmota/network)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/tasmota) [![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/tasmota)
See [RELEASENOTES.md](https://github.com/arendst/Sonoff-Tasmota/blob/development/RELEASENOTES.md) for release information.
In addition to the [release webpage](https://github.com/arendst/Sonoff-Tasmota/releases/latest) the binaries can also be OTA downloaded from http://thehackbox.org/tasmota/release/
### Development ### Development
[![Dev Version](https://img.shields.io/badge/development%20version-6.2.1.x-blue.svg)](https://github.com/arendst/Sonoff-Tasmota) [![Dev Version](https://img.shields.io/badge/development%20version-6.2.1.x-blue.svg)](https://github.com/arendst/Sonoff-Tasmota)
[![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/) [![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/)
@ -114,21 +118,25 @@ You can contribute to Sonoff-Tasmota by
Libraries used with Sonoff-Tasmota are: Libraries used with Sonoff-Tasmota are:
- [ESP8266 core for Arduino](https://github.com/esp8266/Arduino) - [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)
- [Adafruit CCS811](https://github.com/adafruit/Adafruit_CCS811) - [Adafruit CCS811](https://github.com/adafruit/Adafruit_CCS811)
- [Adafruit ILI9341](https://github.com/adafruit/Adafruit_ILI9341)
- [Adafruit LED Backpack](https://github.com/adafruit/Adafruit-LED-Backpack-Library)
- [Adafruit SGP30](https://github.com/adafruit/Adafruit_SGP30) - [Adafruit SGP30](https://github.com/adafruit/Adafruit_SGP30)
- [Adafruit SSD1306](https://github.com/adafruit/Adafruit_SSD1306)
- [Adafruit GFX](https://github.com/adafruit/Adafruit-GFX-Library)
- [ArduinoJson](https://arduinojson.org/) - [ArduinoJson](https://arduinojson.org/)
- [arduino mqtt](https://github.com/256dpi/arduino-mqtt)
- [Bosch BME680](https://github.com/BoschSensortec/BME680_driver) - [Bosch BME680](https://github.com/BoschSensortec/BME680_driver)
- [C2 Programmer](http://app.cear.ufpb.br/~lucas.hartmann/tag/efm8bb1/) - [C2 Programmer](http://app.cear.ufpb.br/~lucas.hartmann/tag/efm8bb1/)
- [Esp8266MqttClient](https://github.com/tuanpmt/ESP8266MQTTClient)
- [esp-knx-ip](https://github.com/envy/esp-knx-ip) - [esp-knx-ip](https://github.com/envy/esp-knx-ip)
- [esp-mqtt-arduino](https://github.com/i-n-g-o/esp-mqtt-arduino)
- [ESPAsyncUDP](https://github.com/me-no-dev/ESPAsyncUDP)
- [I2Cdevlib](https://github.com/jrowberg/i2cdevlib) - [I2Cdevlib](https://github.com/jrowberg/i2cdevlib)
- [IRremoteEsp8266](https://github.com/markszabo/IRremoteESP8266) - [IRremoteEsp8266](https://github.com/markszabo/IRremoteESP8266)
- [JobaTsl2561](https://github.com/joba-1/Joba_Tsl2561) - [JobaTsl2561](https://github.com/joba-1/Joba_Tsl2561)
- [Liquid Cristal](https://github.com/marcoschwartz/LiquidCrystal_I2C)
- [MultiChannelGasSensor](http://wiki.seeedstudio.com/Grove-Multichannel_Gas_Sensor/) - [MultiChannelGasSensor](http://wiki.seeedstudio.com/Grove-Multichannel_Gas_Sensor/)
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - [NeoPixelBus](https://github.com/Makuna/NeoPixelBus)
- [OneWire](https://github.com/PaulStoffregen/OneWire) - [OneWire](https://github.com/PaulStoffregen/OneWire)
- [PubSubClient](https://github.com/knolleary/pubsubclient) - [PubSubClient](https://github.com/knolleary/pubsubclient)
- [rc-switch](https://github.com/sui77/rc-switch)
#### People inspiring me #### People inspiring me
People helping to keep the show on the road: People helping to keep the show on the road:
@ -142,16 +150,19 @@ People helping to keep the show on the road:
- Flexiti for his initial timer implementation - Flexiti for his initial timer implementation
- reloxx13 for his [TasmoAdmin](https://github.com/reloxx13/TasmoAdmin) management tool - reloxx13 for his [TasmoAdmin](https://github.com/reloxx13/TasmoAdmin) management tool
- Joachim Banzhaf for his TSL2561 library and driver - Joachim Banzhaf for his TSL2561 library and driver
- Gijs Noorlander for his MHZ19 and SenseAir drivers - Gijs Noorlander for his MHZ19, SenseAir and updated PubSubClient drivers
- Emontnemery for his HomeAssistant Discovery concept and many code tuning tips - Emontnemery for his HomeAssistant Discovery concept and many code tuning tips
- Aidan Mountford for his HSB support - Aidan Mountford for his HSB support
- Daniel Ztolnai for his Serial Bridge implementation - Daniel Ztolnai for his Serial Bridge implementation
- Gerhard Mutz for his SGP30 and Sunrise/Sunset driver - Gerhard Mutz for his SGP30, Sunrise/Sunset and display support drivers
- Nuno Ferreira for his HC-SR04 driver - Nuno Ferreira for his HC-SR04 driver
- Adrian Scillato for his (security)fixes and implementing and maintaining KNX - Adrian Scillato for his (security)fixes and implementing and maintaining KNX
- Gennaro Tortone for implementing and maintaining Eastron drivers - Gennaro Tortone for implementing and maintaining Eastron drivers
- Raymond Mouthaan for managing Wemos Wiki information - Raymond Mouthaan for managing Wemos Wiki information
- Norbert Richter, Frogmore42 and Jason2866 for providing many issue answers - Norbert Richter for his decode-config.py tool
- Andre Thomas for providing [thehackbox](http://thehackbox.org/tasmota/) OTA support and daily development builds
- Joel Stein and digiblur for their Tuya research and driver
- Frogmore42 and Jason2866 for providing many issue answers
- Many more providing Tips, Pocs or PRs - Many more providing Tips, Pocs or PRs
### License ### License

View File

@ -15,7 +15,7 @@ To save memory space all other binaries support **WifiManager only**.
See _changelog.ino how to enable them again. See _changelog.ino how to enable them again.
- Define WIFI_CONFIG_TOOL now contains the default behaviour once a SSID has been configured. - Define WIFI_CONFIG_TOOL now contains the default behaviour once a SSID has been configured.
- If no SSID is configured making a wifi connection impossible the new define WIFI_CONFIG_NO_SSID will be used. - If no SSID is configured making a wifi connection impossible the new define WIFI_CONFIG_NO_SSID will be used.
- While define WIFI_CONFIG_NO_SSID is set to WIFI_WPSCONFIG in user_config.h the compiler will check for define USE_WPS and if not enabled WIFI_CONFIG_NO_SSID will default to WIFI_MANAGER using the webserver. If define USE_WEBSERVER is also not enabled WIFI_CONFIG_NO_SSID will default to WIFI_SMARTCONFIG. If define USE_SMARTCONFIG is also not enabled WIFI_CONFIG_NO_SSID will default to a new option WIFI_SERIAL allowing to enter wifi parameters to serial which is always possible. - While define WIFI_CONFIG_NO_SSID is set to WIFI_WPSCONFIG in my_user_config.h the compiler will check for define USE_WPS and if not enabled WIFI_CONFIG_NO_SSID will default to WIFI_MANAGER using the webserver. If define USE_WEBSERVER is also not enabled WIFI_CONFIG_NO_SSID will default to WIFI_SMARTCONFIG. If define USE_SMARTCONFIG is also not enabled WIFI_CONFIG_NO_SSID will default to a new option WIFI_SERIAL allowing to enter wifi parameters to serial which is always possible.
## Provided Binary Downloads ## Provided Binary Downloads
The following binary downloads have been compiled with ESP8266/Arduino library version **2.3.0** The following binary downloads have been compiled with ESP8266/Arduino library version **2.3.0**
@ -25,6 +25,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library v
- **sonoff.bin** = The Sonoff version without Wps and SmartConfig configuration but adds more sensors. - **sonoff.bin** = The Sonoff version without Wps and SmartConfig configuration but adds more sensors.
- **sonoff-BG.bin** to **sonoff-TW.bin** = The Sonoff version without Wps and SmartConfig configuration in different languages. - **sonoff-BG.bin** to **sonoff-TW.bin** = The Sonoff version without Wps and SmartConfig configuration in different languages.
- **sonoff-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors. - **sonoff-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors.
- **sonoff-display.bin** = The Display version without Wps and SmartConfig configuration but adds display support.
- **sonoff-knx.bin** = The Knx version without Wps and SmartConfig configuration and some other features but adds KNX support. - **sonoff-knx.bin** = The Knx version without Wps and SmartConfig configuration and some other features but adds KNX support.
See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) why these files are still released using ESP/Arduino library version v2.3.0. See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) why these files are still released using ESP/Arduino library version v2.3.0.
@ -33,8 +34,8 @@ See [Tasmota ESP/Arduino library version related issues](https://github.com/aren
| Feature or Sensor | minimal | classic | sonoff | knx | sensors | Remarks | Feature or Sensor | minimal | classic | sonoff | knx | sensors | Remarks
|--------------------------------|---------|---------|--------|------|---------|-------- |--------------------------------|---------|---------|--------|------|---------|--------
| ESP/Arduino lib v2.3.0 | 340k | 477k | 473k | 492k | 497k | | ESP/Arduino lib v2.3.0 | 344k | 485k | 491k | 510k | 516k |
| ESP/Arduino lib v2.4.2 | 360k | 491k | 491k | 509k | 513k | No sleep | ESP/Arduino lib v2.4.2 | 363k | 499k | 509k | 526k | 532k | No sleep
| | | | | | | | | | | | | |
| MY_LANGUAGE en-GB | x | x | x | x | x | | MY_LANGUAGE en-GB | x | x | x | x | x |
| USE_WPS | - | x | - | - | - | WPS | USE_WPS | - | x | - | - | - | WPS
@ -55,7 +56,7 @@ See [Tasmota ESP/Arduino library version related issues](https://github.com/aren
| USE_SUNRISE | - | - | x | x | x | | USE_SUNRISE | - | - | x | x | x |
| USE_RULES | - | - | x | x | x | | USE_RULES | - | - | x | x | x |
| | | | | | | | | | | | | |
| USE_ADC_VCC | x | x | x | x | | | USE_ADC_VCC | x | x | x | x | - |
| USE_DS18B20 | - | - | - | - | - | Single sensor | USE_DS18B20 | - | - | - | - | - | Single sensor
| USE_DS18x20 | - | x | x | x | x | Multiple sensors | USE_DS18x20 | - | x | x | x | x | Multiple sensors
| USE_DS18x20_LEGACY | - | - | - | - | - | Multiple sensors | USE_DS18x20_LEGACY | - | - | - | - | - | Multiple sensors
@ -111,76 +112,89 @@ See [Tasmota ESP/Arduino library version related issues](https://github.com/aren
| USE_RF_FLASH | - | - | x | x | x | | USE_RF_FLASH | - | - | x | x | x |
| USE_TUYA_DIMMER | - | - | x | x | x | | USE_TUYA_DIMMER | - | - | x | x | x |
| USE_TX20_WIND_SENSOR | - | - | x | x | x | | USE_TX20_WIND_SENSOR | - | - | x | x | x |
| USE_RC_SWITCH | - | - | x | x | x |
| USE_DISPLAY | - | - | - | - | - | | USE_DISPLAY | - | - | - | - | - |
## Changelog ## Changelog
Version 6.2.1 20180905 Version 6.3.0 soon
* Fix possible ambiguity on command parameters if StateText contains numbers only (#3656) * Change web Configure Module GPIO drop down list order for better readability
* Fix Wemo emulation to select the first relay when more than one relay is present (#3657) * Change status JSON message providing more switch and retain information
* Fix possible exception due to buffer overflow (#3659) * Change xsns_17_senseair.ino to use TasmotaModbus library
* Fix lost energy today and total energy value after power cycle (#3689) * Change MCP230xx driver
* Change PubSubClient Mqtt library to non-blocking EspEasy version
Version 6.2.0 20180901 * Change energy monitoring using energy sensor driver modules
* Allow user override of define MAX_RULE_VARS and MAX_RULE_TIMERS (#3561) * Change Webserver page handler for easier extension (thx to Adrian Scillato)
* Disable wifi sleep for both Esp8266/Arduino core 2.4.1 and 2.4.2 to solve device freeze caused by Espressif SDK bug (#3554) * Change pinmode for no-pullup defined switches to pullup when configured as switchmode PUSHBUTTON (=3 and up) (#3896)
* Change DS18B20 driver to provide better instant results * Change default OTA Url to http://thehackbox.org/tasmota/release/sonoff.bin (#4170)
* Change some sensor drivers to provide instant results * Remove support for MQTT Client esp-mqtt-arduino by #define MQTT_LIBRARY_TYPE MQTT_ESPMQTTARDUINO
* Change define USE_ALL_SENSORS to USE_SENSORS as it doesn't contain all sensors due to duplicate I2C addresses * Remove commands PowerCal, VoltageCal and CurrentCal as more functionality is provided by commands PowerSet, VoltageSet and CurrentSet
* Change some sensor update timings: AdcEvery 200 -> 250, Senseair 300 -> 250, SDM120 300 -> 250, SDM630 300 -> 250 * Remove restart after ntpserver change and force NTP re-sync (#3890)
* Change default Wifi config option from WPS to Wifi Manager if WPS is disabled or Wifi Smartconfig if webserver is disabled or Wifi Serial input if Smartconfig is disabled * Fix showing Period Power in energy threshold messages
* Change SHT1x driver to provide better instant results and fix I2C interference * Fix header file execution order by renaming user_config.h to my_user_config.h
* Change DHT driver to provide better instant results and add decimals to DHT11 (#3164) * Fix some TSL2561 driver issues (#3681)
* Change DS18x20 driver to provide better instant results (#3169) * Fix KNX PA exception. Regression from 6.2.1 buffer overflow caused by subStr() (#3700, #3710)
* Change CounterType 1 from milliseconds to microseconds (#3437) * Fix setting and getting color temperature for Philips Hue emulation (#3733)
* Change scheduler for better sleep support using Uptime, Delay, PulseTime and TelePeriod, Blinktime (#3581) * Fix ButtonRetain to not use default topic for clearing retain messages (#3737)
* Remove unused functionality from Sonoff-minimal to save space * Fix syslog when emulation is selected (#2109, #3784)
* Remove WPS and SmartConfig from sonoff-minimal saving 56k code space * Fix rule trigger POWER1#STATE execution after restart and SetOption0 is 0 (#3856)
* Remove TSL2561 debug message and update library (#2415) * Fix Home Assistant forced light discovery (#3908)
* Remove forced restart when sleep command is executed (#3554) * Fix invalid configuration restores and decode_config.py crc error when savedata = 0 (#3918)
* Fix invalid response using more than 4 switches and domoticz * Fix timer offset -00:00 causing 12:00 hour offset (#3923)
* Fix sonoff-minimal not using default settings * Fix I2CScan invalid JSON error message (#3925)
* Fix unsecure main webpage update * Fix exception when wrong Domoticz JSON message is received (#3963)
* Fix DHT driver mixing values for different sensors (#1797) * Fix Sonoff Bridge RfRaw receive (#4080, #4085)
* Fix EnergyReset3 regression not clearing total energy (#2723) * Fix possible wifi connection error (#4044, #4083)
* Fix rules once regression from v6.1.0 (#3198, #3226) * Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147)
* Fix command Scale buffer overflow (#3236) * Fix rule mqtt#connected trigger when mqtt is disabled (#4149)
* Fix possible WDT due to long MQTT publish handling (#3313) * Add support for LCD, Matrix, TFT and Oled displays
* Fix command TimeDst/TimeStd invalid JSON (#3322) * Add support for Neo Coolcam Wifi Smart Power Plug
* Fix handling of default names when using names starting with shortcut character ",0,1 or 2 (#3392, #3600, #3618) * Add support for Michael Haustein ESP Switch
* Fix LM75AD I2C sensor detection (#3408) * Add support for MQTT Client based on lwmqtt to be selected by #define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT
* Fix iFan02 power on state (#3412, #3530) * Add support for Neo Coolcam Wifi Smart Power Plug
* Fix some Pow R2 and S31 checksum errors using optimized re-sync (#3425) * Add support for Michael Haustein ESP Switch
* Fix SDM120 reporting wrong negative values to Domoticz (#3521) * Add support for MQTT Client based on lwmqtt to be selected by #define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT
* Fix MQTT reconnection detection when using TasmotaMqtt library (#3558) * Add support for DS3231 Real Time Clock
* Fix OtaMagic when file path contains a dash (-) (#3563) * Add support for HX711 Load Cell with optional web GUI scale interface to demonstrate easy GUI plug-in
* Fix Sonoff Bridge data reception when using Portisch EFM8 firmware using in data buffer length (#3605) * Add support for serial 8N2 communication to TasmotaModbus and TasmotaSerial libraries
* Add read sensor retry to DS18B20, DS18x20, DHT, SHT1X and HTU21 * Add support for RF transceiving using library RcSwitch (#2702)
* Add user selection of Wifi Smartconfig as define USE_SMARTCONFIG in user_config.h * Add support for Shelly 1 and Shelly 2 (#2789)
* Add boot loop detection and perform some solutions * Add support for La Crosse TX20 Anemometer (#2654, #3146)
* Add wifi and mqtt status led blinkyblinky to be disabled by SetOption31 1. Does not work when LedPower is On (deliberate) (#871, #2230, #3114, #3155) * Add support for MP3 player using DFRobot RB-DFR-562 (#3723)
* Add support for TM1638 switch (#2226) * Add Support for Xiaomi-Philips Bulbs (#3787)
* Add GPIO options ButtonXn, SwitchXn and CounterXn to select INPUT mode instead of INPUT_PULLUP (#2525) * Add support for PCA9685 12bit 16pin hardware PWM driver (#3866)
* Add support for APDS9960 proximity sensor (#3051) * Add support for EXS Relay V5.0 (#3810)
* Add support for MPR121 controller in input mode for touch buttons (#3142) * Add support for OBI Power Socket (#1988, #3944)
* Add support for MCP230xx for general purpose input expansion and command Sensor29 (#3188) * Add support for Teckin Power Socket with Energy Monitoring (#3950)
* Add default Wifi Configuration tool as define WIFI_CONFIG_NO_SSID in user_config.h if no SSID is configured (#3224) * Add support for Pzem-003/017 DC Energy monitoring module (#3694)
* Add command Timers 0/1 to globally disable or enable armed timers (#3270) * Add support for Pzem-014/016 AC Energy monitoring module (#3694)
* Add support for CCS811 sensor (#3309) * Add support for CSL Aplic WDP 303075 Power Socket with Energy Monitoring (#3991, #3996)
* Add Turkish language file (#3332) * Add support for Tuya Dimmer (#469, #4075)
* Add command SerialSend4 to send binary serial data (#3345) * Add command Display to show all settings at once
* Add initial support for sensor MPU6050 (#3352) * Add command SerialSend5 to send raw serial data like "A5074100545293"
* Add rule triggers Wifi#Connected and Wifi#Disconnected (#3359) * Add command WebRefresh 1000..10000 to control web page refresh in milliseconds. Default is 2345
* Add option + to command Rule to concatenate new rule with existing rules (#3365) * Add command WeightRes 0..3 to control display of decimals for kilogram
* Add message when JavaScript is not enabled in webbrowser (#3388) * Add command SetOption52 to control display of optional time offset from UTC in JSON messages (#3629, #3711)
* Add build time setting of ButtonTopic and SwitchTopic (#3414) * Add command RGBWWTable to support color calibration (#3933)
* Add iFan02 Fanspeed + and Fanspeed - command options (#3415) * Add command Reset 4 (reset to defaults but keep wifi params) and Reset 5 (as reset 4 and also erase flash) (#4061)
* Add Individual HSBColorX commands (#3430, #3615) * Add authentication to HTTP web pages
* Add output support on MCP23008/MCP23017 (#3436) * Add decimals as input to commands PowerSet, VoltageSet and CurrentSet
* Add modulo option to rules like rule1 on Time#Minute|5 do backlog power on;delay 200;power off endon (#3466) * Add tools/decode-config.py by Norbert Richter to decode configuration data. See file for information
* Add RGB support for Domoticz (#3547) * Add define USE_DISPLAYS for selecting image sonoff-display
* Add all ruletimer values to command RuleTimer result message (#3571) * Add auto reload of main web page to some web restarts
* Add command Publish2 for publishing retained MQTT messages (#3593) * Add TasmotaModbus library as very basic modbus wrapper for TasmotaSerial
* Add commands ButtonDebounce 40..1000 and SwitchDebounce 40..1000 to have user control over debounce timing. Default is 50mS (#3594) * Add more API callbacks and document API.md
* Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607) * Add Wifi channel number to state message (#3664)
* Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608) * Add user configurable GPIO02 and GPIO03 on H801 devices (#3692)
* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614) * Add network information to display start screen (#3704)
* Add toggle function RGBW lights (#3695, #3697)
* Add sleep to Nova Fitness SDS01X sensor (#2841, #3724, #3749)
* Add Analog input AD0 enabled to sonoff-sensors.bin (#3756, #3757)
* Add userid/password option to decode-status.py (#3796)
* Add power value below 5W to Sonoff Pow R2 and S31 (#3745)
* Add force_update to Home Assistant discovery (#3873)
* Add delay after restart before processing rule sensor data (#3811)
* Add rule triggers SWITCH1#BOOT and POWER1#BOOT (#3904, #3910)
* Add Apparent Power and Reactive Power to Energy Monitoring devices (#251)
* Add RF Receiver control to module MagicHome to be used on Arilux LC10 (#3792)
* Add Hebrew language file (#3960)
* Add whitespace removal from RfRaw and SerialSend5 (#4020)

View File

@ -3,6 +3,8 @@
* Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147) * Fix invalid JSON floating point result from nan (Not a Number) and inf (Infinity) into null (#4147)
* Fix rule mqtt#connected trigger when mqtt is disabled (#4149) * Fix rule mqtt#connected trigger when mqtt is disabled (#4149)
* Initial release of RF transceiving using library RcSwitch (#2702) * Initial release of RF transceiving using library RcSwitch (#2702)
* Change default OTA Url to http://thehackbox.org/tasmota/release/sonoff.bin (#4170)
* Add Tuya Software Serial to support additional Tuya configurations (#4178)
* *
* 6.2.1.18 20181019 * 6.2.1.18 20181019
* Add more API callbacks and document API.md * Add more API callbacks and document API.md

View File

@ -79,7 +79,7 @@
#define WEB_LOG_LEVEL LOG_LEVEL_INFO // [WebLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE) #define WEB_LOG_LEVEL LOG_LEVEL_INFO // [WebLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
// -- Ota ----------------------------------------- // -- Ota -----------------------------------------
#define OTA_URL "http://sonoff.maddox.co.uk/tasmota/sonoff.bin" // [OtaUrl] #define OTA_URL "http://thehackbox.org/tasmota/release/sonoff.bin" // [OtaUrl]
// -- MQTT ---------------------------------------- // -- MQTT ----------------------------------------
#define MQTT_USE 1 // [SetOption3] Select default MQTT use (0 = Off, 1 = On) #define MQTT_USE 1 // [SetOption3] Select default MQTT use (0 = Off, 1 = On)
@ -384,7 +384,7 @@
#define USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k code) #define USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k code)
#define USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code) #define USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code, 460 iram)
/*********************************************************************************************\ /*********************************************************************************************\
* Debug features are only supported in development branch * Debug features are only supported in development branch

View File

@ -20,8 +20,9 @@
#ifdef USE_TUYA_DIMMER #ifdef USE_TUYA_DIMMER
#ifndef TUYA_DIMMER_ID #ifndef TUYA_DIMMER_ID
#define TUYA_DIMMER_ID 3 #define TUYA_DIMMER_ID 3
#endif #endif
#define TUYA_BUFFER_SIZE 256
#include <TasmotaSerial.h> #include <TasmotaSerial.h>
@ -33,6 +34,9 @@ uint8_t tuya_cmd_status = 0; // Current status of serial-read
uint8_t tuya_cmd_checksum = 0; // Checksum of tuya command uint8_t tuya_cmd_checksum = 0; // Checksum of tuya command
uint8_t tuya_data_len = 0; // Data lenght of command uint8_t tuya_data_len = 0; // Data lenght of command
char tuya_buffer[TUYA_BUFFER_SIZE]; // Serial receive buffer
int tuya_byte_counter = 0; // Index in serial receive buffer
boolean TuyaSetPower() boolean TuyaSetPower()
{ {
boolean status = false; boolean status = false;
@ -103,27 +107,27 @@ void TuyaPacketProcess()
{ {
char scmnd[20]; char scmnd[20];
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Packet Size=%d"), serial_in_byte_counter); snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Packet Size=%d"), tuya_byte_counter);
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
if (serial_in_byte_counter == 7 && serial_in_buffer[3] == 14 ) { // heartbeat packet if (tuya_byte_counter == 7 && tuya_buffer[3] == 14 ) { // heartbeat packet
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Heartbeat")); AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Heartbeat"));
} }
else if (serial_in_byte_counter == 12 && serial_in_buffer[3] == 7 && serial_in_buffer[5] == 5) { // on/off packet else if (tuya_byte_counter == 12 && tuya_buffer[3] == 7 && tuya_buffer[5] == 5) { // on/off packet
snprintf_P(log_data, sizeof(log_data),PSTR("TYA: Rcvd - %s State"),serial_in_buffer[10]?"On":"Off"); snprintf_P(log_data, sizeof(log_data),PSTR("TYA: Rcvd - %s State"),tuya_buffer[10]?"On":"Off");
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
if((power || Settings.light_dimmer > 0) && (power != serial_in_buffer[10])) { if((power || Settings.light_dimmer > 0) && (power != tuya_buffer[10])) {
ExecuteCommandPower(1, serial_in_buffer[10], SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction ExecuteCommandPower(1, tuya_buffer[10], SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction
} }
} }
else if (serial_in_byte_counter == 15 && serial_in_buffer[3] == 7 && serial_in_buffer[5] == 8) { // dim packet else if (tuya_byte_counter == 15 && tuya_buffer[3] == 7 && tuya_buffer[5] == 8) { // dim packet
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Rcvd Dim State=%d"), serial_in_buffer[13]); snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Rcvd Dim State=%d"), tuya_buffer[13]);
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
tuya_new_dim = round(serial_in_buffer[13] * (100. / 255.)); tuya_new_dim = round(tuya_buffer[13] * (100. / 255.));
if((power) && (tuya_new_dim > 0) && (abs(tuya_new_dim - Settings.light_dimmer) > 2)) { if((power) && (tuya_new_dim > 0) && (abs(tuya_new_dim - Settings.light_dimmer) > 2)) {
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Send CMND_DIMMER=%d"), tuya_new_dim ); snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Send CMND_DIMMER=%d"), tuya_new_dim );
@ -138,7 +142,7 @@ void TuyaPacketProcess()
ExecuteCommand(scmnd, SRC_SWITCH); ExecuteCommand(scmnd, SRC_SWITCH);
} }
} }
else if (serial_in_byte_counter == 8 && serial_in_buffer[3] == 5 && serial_in_buffer[5] == 1 && serial_in_buffer[7] == 5 ) { // reset WiFi settings packet - to do: reset red MCU LED after WiFi is up else if (tuya_byte_counter == 8 && tuya_buffer[3] == 5 && tuya_buffer[5] == 1 && tuya_buffer[7] == 5 ) { // reset WiFi settings packet - to do: reset red MCU LED after WiFi is up
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: WiFi Reset Rcvd")); AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: WiFi Reset Rcvd"));
@ -149,16 +153,16 @@ void TuyaPacketProcess()
void TuyaSerialInput() void TuyaSerialInput()
{ {
while (TuyaSerial && TuyaSerial->available()) { while (TuyaSerial->available()) {
yield(); yield();
serial_in_byte = TuyaSerial->read(); byte serial_in_byte = TuyaSerial->read();
//snprintf_P(log_data, sizeof(log_data), PSTR("TYA: serial_in_byte %d, tuya_cmd_status %d, tuya_cmd_checksum %d, tuya_data_len %d, serial_in_byte_counter %d"), serial_in_byte, tuya_cmd_status, tuya_cmd_checksum, tuya_data_len, serial_in_byte_counter); //snprintf_P(log_data, sizeof(log_data), PSTR("TYA: serial_in_byte %d, tuya_cmd_status %d, tuya_cmd_checksum %d, tuya_data_len %d, tuya_byte_counter %d"), serial_in_byte, tuya_cmd_status, tuya_cmd_checksum, tuya_data_len, tuya_byte_counter);
//AddLog(LOG_LEVEL_DEBUG); //AddLog(LOG_LEVEL_DEBUG);
if (serial_in_byte == 0x55) { // Start TUYA Packet if (serial_in_byte == 0x55) { // Start TUYA Packet
tuya_cmd_status = 1; tuya_cmd_status = 1;
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte; tuya_buffer[tuya_byte_counter++] = serial_in_byte;
tuya_cmd_checksum += serial_in_byte; tuya_cmd_checksum += serial_in_byte;
} }
else if (tuya_cmd_status == 1 && serial_in_byte == 0xAA){ // Only packtes with header 0x55AA are valid else if (tuya_cmd_status == 1 && serial_in_byte == 0xAA){ // Only packtes with header 0x55AA are valid
@ -166,40 +170,40 @@ void TuyaSerialInput()
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: 0x55AA Packet Start")); AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: 0x55AA Packet Start"));
serial_in_byte_counter = 0; tuya_byte_counter = 0;
serial_in_buffer[serial_in_byte_counter++] = 0x55; tuya_buffer[tuya_byte_counter++] = 0x55;
serial_in_buffer[serial_in_byte_counter++] = 0xAA; tuya_buffer[tuya_byte_counter++] = 0xAA;
tuya_cmd_checksum = 0xFF; tuya_cmd_checksum = 0xFF;
} }
else if (tuya_cmd_status == 2){ else if (tuya_cmd_status == 2){
if(serial_in_byte_counter == 5){ // Get length of data if(tuya_byte_counter == 5){ // Get length of data
tuya_cmd_status = 3; tuya_cmd_status = 3;
tuya_data_len = serial_in_byte; tuya_data_len = serial_in_byte;
} }
tuya_cmd_checksum += serial_in_byte; tuya_cmd_checksum += serial_in_byte;
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte; tuya_buffer[tuya_byte_counter++] = serial_in_byte;
} }
else if ((tuya_cmd_status == 3) && (serial_in_byte_counter == (6 + tuya_data_len)) && (tuya_cmd_checksum == serial_in_byte)){ // Compare checksum and process packet else if ((tuya_cmd_status == 3) && (tuya_byte_counter == (6 + tuya_data_len)) && (tuya_cmd_checksum == serial_in_byte)){ // Compare checksum and process packet
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte; tuya_buffer[tuya_byte_counter++] = serial_in_byte;
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: 0x55 Packet End: \"")); snprintf_P(log_data, sizeof(log_data), PSTR("TYA: 0x55 Packet End: \""));
for (int i = 0; i < serial_in_byte_counter; i++) { for (int i = 0; i < tuya_byte_counter; i++) {
snprintf_P(log_data, sizeof(log_data), PSTR("%s%02x"), log_data, serial_in_buffer[i]); snprintf_P(log_data, sizeof(log_data), PSTR("%s%02x"), log_data, tuya_buffer[i]);
} }
snprintf_P(log_data, sizeof(log_data), PSTR("%s\""), log_data); snprintf_P(log_data, sizeof(log_data), PSTR("%s\""), log_data);
AddLog(LOG_LEVEL_DEBUG); AddLog(LOG_LEVEL_DEBUG);
TuyaPacketProcess(); TuyaPacketProcess();
serial_in_byte_counter = 0; tuya_byte_counter = 0;
tuya_cmd_status = 0; tuya_cmd_status = 0;
tuya_cmd_checksum = 0; tuya_cmd_checksum = 0;
tuya_data_len = 0; tuya_data_len = 0;
} // read additional packets from TUYA } // read additional packets from TUYA
else if(serial_in_byte_counter < INPUT_BUFFER_SIZE -1) { // add char to string if it still fits else if(tuya_byte_counter < TUYA_BUFFER_SIZE -1) { // add char to string if it still fits
serial_in_buffer[serial_in_byte_counter++] = serial_in_byte; tuya_buffer[tuya_byte_counter++] = serial_in_byte;
tuya_cmd_checksum += serial_in_byte; tuya_cmd_checksum += serial_in_byte;
} else { } else {
serial_in_byte_counter = 0; tuya_byte_counter = 0;
tuya_cmd_status = 0; tuya_cmd_status = 0;
tuya_cmd_checksum = 0; tuya_cmd_checksum = 0;
tuya_data_len = 0; tuya_data_len = 0;
@ -209,7 +213,10 @@ void TuyaSerialInput()
boolean TuyaModuleSelected() boolean TuyaModuleSelected()
{ {
baudrate = 9600; if (!(pin[GPIO_TUYA_RX] < 99) || !(pin[GPIO_TUYA_TX] < 99)) { // fallback to hardware-serial if not explicitly selected
pin[GPIO_TUYA_RX] = 1;
pin[GPIO_TUYA_TX] = 3;
}
light_type = LT_SERIAL; light_type = LT_SERIAL;
return true; return true;
} }
@ -219,23 +226,14 @@ void TuyaInit()
if (!Settings.param[P_TUYA_DIMMER_ID]) { if (!Settings.param[P_TUYA_DIMMER_ID]) {
Settings.param[P_TUYA_DIMMER_ID] = TUYA_DIMMER_ID; Settings.param[P_TUYA_DIMMER_ID] = TUYA_DIMMER_ID;
} }
if (!(pin[GPIO_TUYA_RX] < 99) || !(pin[GPIO_TUYA_TX] < 99)) { // fallback to hardware-serial if not explicitly selected
pin[GPIO_TUYA_RX] = 1;
pin[GPIO_TUYA_TX] = 3;
}
TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 1); TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 1);
if (TuyaSerial->begin(baudrate)) { if (TuyaSerial->begin(9600)) {
if (TuyaSerial->hardwareSerial()) { if (TuyaSerial->hardwareSerial()) { ClaimSerial(); }
ClaimSerial();
//Serial.setDebugOutput(false); // Get current status of MCU
} snprintf_P(log_data, sizeof(log_data), "TYA: Request MCU state");
} AddLog(LOG_LEVEL_DEBUG);
// Get current status of MCU
snprintf_P(log_data, sizeof(log_data), "TYA: Request MCU state");
AddLog(LOG_LEVEL_DEBUG);
if(TuyaSerial){
TuyaSerial->write((uint8_t)0x55); // header 55AA TuyaSerial->write((uint8_t)0x55); // header 55AA
TuyaSerial->write((uint8_t)0xAA); TuyaSerial->write((uint8_t)0xAA);
TuyaSerial->write((uint8_t)0x00); // version 00 TuyaSerial->write((uint8_t)0x00); // version 00
@ -282,7 +280,7 @@ boolean Xdrv16(byte function)
TuyaInit(); TuyaInit();
break; break;
case FUNC_LOOP: case FUNC_LOOP:
TuyaSerialInput(); if (TuyaSerial) { TuyaSerialInput(); }
break; break;
case FUNC_SET_DEVICE_POWER: case FUNC_SET_DEVICE_POWER:
result = TuyaSetPower(); result = TuyaSetPower();