Merge branch 'arendst/development' into development

This commit is contained in:
reloxx13 2018-08-28 21:45:19 +02:00
commit 0199f55452
19 changed files with 191 additions and 118 deletions

View File

@ -13,9 +13,13 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/tasmota)
### Development
[![Dev Version](https://img.shields.io/badge/development%20version-6.1.1.13-blue.svg)](https://github.com/arendst/Sonoff-Tasmota)
[![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/)
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
Current version is **6.1.1.x** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information.
See [RELEASENOTES.md](https://github.com/arendst/Sonoff-Tasmota/blob/development/RELEASENOTES.md) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information.
The compiled development versions from current codebase are built around 6AM GMT+2 everyday and posted at http://thehackbox.org/tasmota/ (this web address can be used for OTA too).
### Disclaimer
:warning: **DANGER OF ELECTROCUTION** :warning:
@ -90,17 +94,17 @@ The following devices are supported:
- [Luani HVIO board](https://luani.de/projekte/esp8266-hvio/)
- Wemos D1 mini, NodeMcu and Ledunia
### Firmware Release Information
Different firmware images are released based on Features and Sensors selection guided by code and memory usage.
- The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter.
- The Classic version allows single OTA uploads as did the previous Sonoff-Tasmota versions.
#### Available Features and Sensors
| Feature or Sensor | sonoff | classic | minimal | knx | allsensors |
|--------------------------------|--------|---------|---------|-----|------------|
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
|--------------------------------|--------|---------|---------|------|---------|
| ESP/Arduino lib v2.3.0 | 472k | 476k | 340k | 491k | 497k |
| ESP/Arduino lib v2.4.2 | 490k | 490k | 360k | 508k | 513k |
| | | | | | |
| MY_LANGUAGE en-GB | x | x | x | x | x |
| USE_WPS | - | x | - | - | - |
| USE_SMARTCONFIG | - | x | - | - | - |
| USE_ARDUINO_OTA | - | - | - | - | - |
| MQTT_LIBRARY_TYPE PUBSUBCLIENT | x | x | x | x | x |
| USE_DOMOTICZ | x | x | - | x | x |
| USE_HOME_ASSISTANT | x | x | - | x | x |
@ -116,28 +120,37 @@ Different firmware images are released based on Features and Sensors selection g
| USE_SUNRISE | x | - | - | x | x |
| USE_RULES | x | - | - | x | x |
| | | | | | |
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
| USE_ADC_VCC | x | x | x | x | x |
| USE_DS18B20 | x | x | - | x | - |
| USE_DS18x20 | - | - | - | - | x |
| USE_DS18x20_LEGACY | - | - | - | - | - |
| USE_I2C | x | x | - | x | x |
| USE_SHT | x | x | - | x | x |
| USE_SHT3X | x | x | - | x | x |
| USE_HTU | x | x | - | x | x |
| USE_LM75AD | x | - | - | x | x |
| USE_BMP | x | x | - | x | x |
| | | | | | |
| USE_I2C | x | - | - | x | x |
| USE_SHT | x | - | - | x | x |
| USE_HTU | x | - | - | x | x |
| USE_BMP | x | - | - | x | x |
| USE_BME680 | - | - | - | - | x |
| USE_SGP30 | x | - | - | x | x |
| USE_BH1750 | x | x | - | x | x |
| USE_BH1750 | x | - | - | x | x |
| USE_VEML6070 | - | - | - | - | x |
| USE_TSL2561 | - | - | - | - | x |
| USE_SI1145 | - | - | - | - | 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 | - | - | - | - | x |
| USE_LM75AD | x | - | - | x | x |
| USE_APDS9960 | - | - | - | - | - |
| USE_MCP230xx | - | - | - | - | - |
| USE_MPR121 | - | - | - | - | - |
| USE_CCS811 | - | - | - | - | - |
| USE_MPU6050 | - | - | - | - | - |
| | | | | | |
| Feature or Sensor | sonoff | classic | minimal | knx | sensors |
| USE_SPI | - | - | - | - | - |
| USE_MHZ19 | x | x | - | x | x |
| USE_MHZ19 | x | - | - | x | x |
| USE_SENSEAIR | x | - | - | x | x |
| USE_PMS5003 | x | - | - | x | x |
| USE_NOVA_SDS | x | - | - | x | x |
@ -145,23 +158,16 @@ Different firmware images are released based on Features and Sensors selection g
| USE_SERIAL_BRIDGE | x | - | - | x | x |
| USE_SDM120 | - | - | - | - | x |
| USE_SDM630 | - | - | - | - | x |
| USE_IR_REMOTE | x | x | - | x | 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 | - | - | - | - | - |
| USE_RF_FLASH | x | - | - | x | x |
#### Typical file size
| ESP/Arduino library version | sonoff | classic | minimal | knx | allsensors |
|-----------------------------|--------|---------|---------|------|------------|
| ESP/Arduino lib v2.3.0 | 538k | 490k | 407k | 548k | 562k |
| ESP/Arduino lib v2.4.0 | 543k | 498k | 414k | 553k | 565k |
| ESP/Arduino lib v2.4.1 | 544k | 500k | 416k | 555k | 567k |
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) for more information.
### Contribute
@ -177,6 +183,7 @@ You can contribute to Sonoff-Tasmota by
#### Libraries Used
Libraries used with Sonoff-Tasmota are:
- [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)
- [Adafruit CCS811](https://github.com/adafruit/Adafruit_CCS811)
- [Adafruit SGP30](https://github.com/adafruit/Adafruit_SGP30)
- [ArduinoJson](https://arduinojson.org/)
- [Bosch BME680](https://github.com/BoschSensortec/BME680_driver)

35
RELEASENOTES.md Normal file
View File

@ -0,0 +1,35 @@
## Migration Information
See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade#migration-path) for instructions how to migrate to a major version. Pay attention to the following version breaks due to dynamic settings updates:
1. Migrate to **Sonoff-Tasmota 3.9.x**
2. Migrate to **Sonoff-Tasmota 4.x**
3. Migrate to **Sonoff-Tasmota 5.14**
4. Migrate to **Sonoff-Tasmota 6.x**
## Release notes
### Change in default initial configuration tool
Firmware binary **sonoff-classic.bin** supports **WifiManager, Wps and SmartConfig** for initial configuration. The default tools is Wps.
To save memory space all other binaries support **WifiManager only**.
See _changelog.ino how to enable them again.
- 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.
- 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.
## Provided Binary Downloads
The following binary downloads have been compiled with ESP8266/Arduino library version **2.3.0**
- **sonoff-minimal.bin** = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter. This version **should NOT be used for initial installation**.
- **sonoff-classic.bin** = The Classic version allows **initial installation** using either WifiManager, Wps or SmartConfig.
- **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-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors.
- **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.
## Changelog
Version 6.2.0 20180901
tbd

View File

@ -15,7 +15,7 @@ env_default = sonoff
;env_default = sonoff-minimal
;env_default = sonoff-classic
;env_default = sonoff-knx
;env_default = sonoff-allsensors
;env_default = sonoff-sensors
;env_default = sonoff-BG
;env_default = sonoff-BR
;env_default = sonoff-CN
@ -63,11 +63,11 @@ build_flags =
-Wl,-Tesp8266.flash.1m0.ld
; -DUSE_CONFIG_OVERRIDE
; lwIP 1.4 (Default)
-DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
; lwIP 2 - Low Memory
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
; lwIP 2 - Higher Bandwitdh
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
; VTABLES in Flash (default)
-DVTABLES_IN_FLASH
; VTABLES in Heap
@ -152,7 +152,7 @@ upload_resetmethod = ${common.upload_resetmethod}
upload_speed = ${common.upload_speed}
extra_scripts = ${common.extra_scripts}
[env:sonoff-allsensors]
[env:sonoff-sensors]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board}

View File

@ -1,8 +1,16 @@
/* 6.1.1.12 20180827
/* 6.1.1.13 20180828
* Fix 6.1.1.12 regression of Mem and Var default handling (#3618)
* Optimizations
* Change define USE_ALL_SENSORS to USE_SENSORS as it doesn't contain all sensors due to duplicate I2C addresses
*
* 6.1.1.12 20180827
* Add commands ButtonDebounce 40..1000 and SwitchDebounce 40..1000 to have user control over debounce timing. Default is 50mS (#3594)
* Add rule variables %sunrise%, %sunset%, %uptime% and %time% (#3608)
* Fix handling use of default names when using names starting with shortcut character (#3392, #3600)
* Fix Sonoff Bridge data reception when using Portisch EFM8 firmware and in data buffer length (#3605)
* Add optional MQTT_TELE_RETAIN to Energy Margins message (#3612, 3614)
* Add Individual HSBColorX commands (#3430, #3615)
* Add RuleX debug options 8,9,10 (StopOnError) to control RuleX execution status after an exception restart (#3607)
*
* 6.1.1.11 20180826
* Change scheduler phase 1/3 - Fixed when sleep is enabled: Uptime, Delay, PulseTime and TelePeriod (#3581)

View File

@ -1,16 +0,0 @@
/*
6.1.1b 20180715
** Change default initial wifi config tool **
Default initial wifi config tool has changed from WPS to Wifi Manager (local Access Point).
Both WPS and Wifi Smartconfig are now optional and are disabled in user_config.h saving a massive 66k of code space.
See _changelog.ino how to enable them again.
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.
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.
** Introduction _changelog.ino **
Finally the changes can be found in a changelog where they belong. Release info will now be in _releasenotes.ino
*/

View File

@ -22,7 +22,7 @@
#define PARAM8_SIZE 18 // Number of param bytes (SetOption)
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint32_t data; // Allow bit manipulation using SetOption
struct { // SetOption0 .. SetOption31
uint32_t save_state : 1; // bit 0
@ -60,7 +60,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
};
} SysBitfield;
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint32_t data; // Allow bit manipulation using SetOption
struct { // SetOption50 .. SetOption81
uint32_t timers_enable : 1; // bit 0 (v6.1.1b)
@ -194,9 +194,7 @@ struct SYSCFG {
char sta_pwd[2][65]; // 0E3
char hostname[33]; // 165
char syslog_host[33]; // 186
byte free1A7[1]; // 1A7
uint8_t rule_stop; // 1A7
uint16_t syslog_port; // 1A8
byte syslog_level; // 1AA
uint8_t webserver; // 1AB
@ -373,7 +371,7 @@ struct XDRVMAILBOX {
} XdrvMailbox;
#define MAX_RULES_FLAG 7 // Number of bits used in RulesBitfield (tricky I know...)
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint16_t data; // Allow bit manipulation
struct {
uint16_t system_boot : 1;

View File

@ -135,7 +135,6 @@ int ota_result = 0; // OTA result
int restart_flag = 0; // Sonoff restart flag
int wifi_state_flag = WIFI_RESTART; // Wifi state flag
int tele_period = 0; // Tele period timer
int status_update_timer = 0; // Refresh initial status
int blinks = 201; // Number of LED blinks
uint32_t uptime = 0; // Counting every second until 4294967295 = 130 year
uint32_t global_update = 0; // Timestamp of last global temperature and humidity update
@ -1593,16 +1592,6 @@ void PerformEverySecond()
}
}
if (status_update_timer) {
status_update_timer--;
if (!status_update_timer) {
for (byte i = 1; i <= devices_present; i++) {
MqttPublishPowerState(i);
if (SONOFF_IFAN02 == Settings.module) { break; } // Only report status of light relay
}
}
}
ResetGlobalValues();
if (Settings.tele_period) {
@ -2528,6 +2517,12 @@ void setup()
save_data_counter = Settings.save_data;
sleep = Settings.sleep;
if ((resetInfo.reason == REASON_WDT_RST) || (resetInfo.reason == REASON_EXCEPTION_RST) || (resetInfo.reason == REASON_SOFT_WDT_RST) || OsWatchBlockedLoop()) {
for (byte i = 0; i < MAX_RULE_SETS; i++) {
if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); }
}
}
Settings.bootcount++;
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount);
AddLog(LOG_LEVEL_DEBUG);

View File

@ -54,11 +54,11 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#define USE_ENERGY_SENSOR // Use energy sensors
/*********************************************************************************************\
* [sonoff-allsensors.bin]
* Provide an image with all supported sensors enabled
* [sonoff-sensors.bin]
* Provide an image with useful supported sensors enabled
\*********************************************************************************************/
#ifdef USE_ALL_SENSORS
#ifdef USE_SENSORS
#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices
#define USE_DS18x20 // For more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)
@ -105,7 +105,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
// #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow
#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
#endif // USE_ALL_SENSORS
#endif // USE_SENSORS
/*********************************************************************************************\
* [sonoff-classic.bin]
@ -114,21 +114,32 @@ void KNX_CB_Action(message_t const &msg, void *arg);
#ifdef USE_CLASSIC
#ifndef USE_WPS
#define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+))
#endif
#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_KNX // Disable KNX IP Protocol Support
#undef USE_TIMERS // Disable support for up to 16 timers
#undef USE_TIMERS_WEB // Disable support for timer webpage
#undef USE_SUNRISE // Disable support for Sunrise and sunset tools
#undef USE_RULES // Disable support for rules
#undef USE_LM75AD // Disable sensor
#undef USE_BME680 // Disable sensor
#undef USE_SGP30 // Disable sensor
#undef USE_I2C // Disable all I2C sensors
#undef USE_SPI // Disable all SPI devices
#undef USE_MHZ19 // Disable support for MH-Z19 CO2 sensor
#undef USE_SENSEAIR // Disable support for SenseAir K30, K70 and S8 CO2 sensor
#undef USE_PMS5003 // Disable support for PMS5003 and PMS7003 particle concentration sensor
#undef USE_NOVA_SDS // Disable support for SDS011 and SDS021 particle concentration sensor
#undef USE_PZEM004T // Disable PZEM004T energy sensor
#undef USE_IR_RECEIVE // Disable support for IR receiver
#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge
#undef USE_SDM120 // Disable support for Eastron SDM120-Modbus energy meter
#undef USE_SDM630 // Disable support for Eastron SDM630-Modbus energy meter
#undef USE_IR_REMOTE // Disable IR remote commands using library IRremoteESP8266 and ArduinoJson
#undef USE_IR_RECEIVE // Disable support for IR receiver
#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller
#undef USE_SR04 // Disable support for for HC-SR04 ultrasonic devices
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8

View File

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

View File

@ -82,6 +82,10 @@ String GetResetReason()
}
}
boolean OsWatchBlockedLoop()
{
return oswatch_blocked_loop;
}
/*********************************************************************************************\
* Miscellaneous
\*********************************************************************************************/
@ -885,7 +889,7 @@ void GetFeatures()
#ifdef BE_MINIMAL
feature_drv2 |= 0x00000002; // user_config(_override).h
#endif
#ifdef USE_ALL_SENSORS
#ifdef USE_SENSORS
feature_drv2 |= 0x00000004; // user_config(_override).h
#endif
#ifdef USE_CLASSIC

View File

@ -373,10 +373,10 @@
//#define USE_CLASSIC // Create sonoff-classic (See sonoff_post.h for selected features)
/*********************************************************************************************\
* Select all sensors - overrides above undefines!!
* Select useful sensors - overrides above undefines!!
\*********************************************************************************************/
//#define USE_ALL_SENSORS // Create sonoff-allsensors with all sensors enabled (See sonoff_post.h for selected sensors)
//#define USE_SENSORS // Create sonoff-sensors with useful sensors enabled (See sonoff_post.h for selected sensors)
/*********************************************************************************************\
* Select KNX without Emulation to save space

View File

@ -376,10 +376,13 @@ void MqttConnected()
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"),
(GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str());
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3"));
for (byte i = 1; i <= devices_present; i++) {
MqttPublishPowerState(i);
if (SONOFF_IFAN02 == Settings.module) { break; } // Only report status of light relay
}
if (Settings.tele_period) {
tele_period = Settings.tele_period -9;
}
status_update_timer = 2;
rules_flag.system_boot = 1;
XdrvCall(FUNC_MQTT_INIT);
}

View File

@ -1702,7 +1702,6 @@ void HandleHttpCommand()
WebGetArg("cmnd", svalue, sizeof(svalue));
if (strlen(svalue)) {
ExecuteWebCommand(svalue, SRC_WEBCOMMAND);
}
if (web_log_index != curridx) {
byte counter = curridx;
@ -1728,6 +1727,9 @@ void HandleHttpCommand()
} else {
message += F(D_ENABLE_WEBLOG_FOR_RESPONSE "\"}");
}
} else {
message += F(D_ENTER_COMMAND " cmnd=\"}");
}
} else {
message += F(D_NEED_USER_AND_PASSWORD "\"}");
}

View File

@ -752,7 +752,7 @@ void EnergyMarginCheck()
}
if (jsonflg) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_MARGINS));
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN);
EnergyMqttShow();
}
}

View File

@ -1087,6 +1087,7 @@ boolean LightCommand()
uint16_t HSB[3];
bool validHSB = true;
if (strstr(XdrvMailbox.data, ",")) { // Command with 3 comma separated parameters (Hue, Saturation AND Brightness)
for (int i = 0; i < 3; i++) {
char *substr;
@ -1101,6 +1102,23 @@ boolean LightCommand()
validHSB = false;
}
}
} else { // Command with only 1 parameter (Hue, Saturation OR Brightness)
float hsb[3];
LightGetHsb(&hsb[0],&hsb[1],&hsb[2]);
HSB[0] = round(hsb[0] * 360);
HSB[1] = round(hsb[1] * 100);
HSB[2] = round(hsb[2] * 100);
if (XdrvMailbox.index = 1) { // Hue
HSB[0] = XdrvMailbox.payload;
} else if (XdrvMailbox.index = 2) { // Saturation
HSB[1] = XdrvMailbox.payload;
} else if (XdrvMailbox.index = 3) { // Brightness
HSB[2] = XdrvMailbox.payload;
} else {
validHSB = false;
}
}
if (validHSB) {
// Translate to fractional elements as required by LightHsbToRgb
// Keep the results <=1 in the event someone passes something

View File

@ -486,7 +486,7 @@ boolean RulesCommand()
}
else if ((CMND_RULE == command_code) && (index > 0) && (index <= MAX_RULE_SETS)) {
if ((XdrvMailbox.data_len > 0) && (XdrvMailbox.data_len < sizeof(Settings.rules[index -1]))) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 6)) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 10)) {
switch (XdrvMailbox.payload) {
case 0: // Off
case 1: // On
@ -502,6 +502,13 @@ boolean RulesCommand()
case 6: // Toggle
bitWrite(Settings.rule_once, index -1, bitRead(Settings.rule_once, index -1) ^1);
break;
case 8: // Off
case 9: // On
bitWrite(Settings.rule_stop, index -1, XdrvMailbox.payload &1);
break;
case 10: // Toggle
bitWrite(Settings.rule_stop, index -1, bitRead(Settings.rule_stop, index -1) ^1);
break;
}
} else {
int offset = 0;
@ -519,8 +526,9 @@ boolean RulesCommand()
}
rules_triggers[index -1] = 0; // Reset once flag
}
snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%s\",\"Once\":\"%s\",\"Free\":%d,\"Rules\":\"%s\"}"),
command, index, GetStateText(bitRead(Settings.rule_enabled, index -1)), GetStateText(bitRead(Settings.rule_once, index -1)), sizeof(Settings.rules[index -1]) - strlen(Settings.rules[index -1]) -1, Settings.rules[index -1]);
snprintf_P (mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":\"%s\",\"Once\":\"%s\",\"StopOnError\":\"%s\",\"Free\":%d,\"Rules\":\"%s\"}"),
command, index, GetStateText(bitRead(Settings.rule_enabled, index -1)), GetStateText(bitRead(Settings.rule_once, index -1)),
GetStateText(bitRead(Settings.rule_stop, index -1)), sizeof(Settings.rules[index -1]) - strlen(Settings.rules[index -1]) -1, Settings.rules[index -1]);
}
else if ((CMND_RULETIMER == command_code) && (index > 0) && (index <= MAX_RULE_TIMERS)) {
if (XdrvMailbox.data_len > 0) {
@ -540,13 +548,13 @@ boolean RulesCommand()
}
else if ((CMND_VAR == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) {
if (XdrvMailbox.data_len > 0) {
strlcpy(vars[index -1], (SC_CLEAR == Shortcut(XdrvMailbox.data)) ? "" : XdrvMailbox.data, sizeof(vars[index -1]));
strlcpy(vars[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(vars[index -1]));
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]);
}
else if ((CMND_MEM == command_code) && (index > 0) && (index <= MAX_RULE_MEMS)) {
if (XdrvMailbox.data_len > 0) {
strlcpy(Settings.mems[index -1], (SC_CLEAR == Shortcut(XdrvMailbox.data)) ? "" : XdrvMailbox.data, sizeof(Settings.mems[index -1]));
strlcpy(Settings.mems[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(Settings.mems[index -1]));
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mems[index -1]);
}

View File

@ -103,7 +103,7 @@ a_features = [[
"USE_TIMERS","USE_SUNRISE","USE_TIMERS_WEB","USE_RULES",
"USE_KNX","USE_WPS","USE_SMARTCONFIG",""
],[
"USE_CONFIG_OVERRIDE","BE_MINIMAL","USE_ALL_SENSORS","USE_CLASSIC",
"USE_CONFIG_OVERRIDE","BE_MINIMAL","USE_SENSORS","USE_CLASSIC",
"USE_KNX_NO_EMULATION","USE_DISPLAY_MODES1TO5","USE_DISPLAY_GRAPH","USE_DISPLAY_LCD",
"USE_DISPLAY_SSD1306","USE_DISPLAY_MATRIX","USE_DISPLAY_ILI9341","USE_DISPLAY_EPAPER",
"USE_DISPLAY_SH1106","","","",