Add command `SetOption114 1`

Add command ``SetOption114 1`` to detach Swiches from Relays and enable MQTT action state for all the SwitchModes
This commit is contained in:
Theo Arends 2020-11-03 14:34:02 +01:00
parent dfd6080d96
commit 54f9532919
7 changed files with 21 additions and 15 deletions

View File

@ -142,6 +142,7 @@
| USE_EZOORP | - | - | - | - | - | - | - |
| USE_EZOPH | - | - | - | - | - | - | - |
| USE_EZOPRS | - | - | - | - | - | - | - |
| USE_EZORGB | - | - | - | - | - | - | - |
| USE_EZORTD | - | - | - | - | - | - | - |
| | | | | | | | |
| Feature or Sensor | minimal | lite | tasmota | knx | sensors | ir | display | Remarks

View File

@ -10,11 +10,13 @@ All notable changes to this project will be documented in this file.
- Support for EZO PRS sensors by Christopher Tremblay (#9659)
- Support for EZO FLO sensors by Christopher Tremblay (#9697)
- Support for EZO DO sensors by Christopher Tremblay (#9707)
- Support for EZO RGB sensors by Christopher Tremblay (#9723)
- Zigbee reduce battery drain (#9642)
- Zigbee command ``ZbMap`` to describe Zigbee topology (#9651)
- Zigbee command ``ZbOccupancy`` to configure the time-out for PIR
- Command ``Gpios 255`` to show all possible GPIO configurations
- Command ``SwitchText`` to change JSON switch names by barbudor (#9691)
- Command ``SetOption114 1`` to detach Swiches from Relays and enable MQTT action state for all the SwitchModes
- HM10 Beacon support and refactoring by Christian Baars (#9702)
### Changed

View File

@ -61,9 +61,10 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
### Added
- Command ``Gpios 255`` to show all possible GPIO configurations
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
- Command ``ShutterChange`` to increment change position (#9594)
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593)
- Command ``SetOption113 1`` to set dimmer low on rotary dial after power off
- Command ``SetOption114 1`` to detach Swiches from Relays and enable MQTT action state for all the SwitchModes
- Command ``SwitchText`` to change JSON switch names by barbudor (#9691)
- Zigbee command ``ZbData`` for better support of device specific data
- Zigbee command ``ZbOccupancy`` to configure the time-out for PIR

View File

@ -44,7 +44,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t ws_clock_reverse : 1; // bit 16 (v5.8.1) - SetOption16 - Switch between clockwise or counter-clockwise
uint32_t decimal_text : 1; // bit 17 (v5.8.1) - SetOption17 - Switch between decimal or hexadecimal output (0 = hexadecimal, 1 = decimal)
uint32_t light_signal : 1; // bit 18 (v5.10.0c) - SetOption18 - Pair light signal with CO2 sensor
uint32_t hass_discovery : 1; // bit 19 (v5.11.1a) - SetOption19 - Control Home Assistantautomatic discovery (See SetOption59)
uint32_t hass_discovery : 1; // bit 19 (v5.11.1a) - SetOption19 - Control Home Assistant automatic discovery (See SetOption59)
uint32_t not_power_linked : 1; // bit 20 (v5.11.1f) - SetOption20 - Control power in relation to Dimmer/Color/Ct changes
uint32_t no_power_on_check : 1; // bit 21 (v5.11.1i) - SetOption21 - Show voltage even if powered off
uint32_t mqtt_serial : 1; // bit 22 (v5.12.0f) - CMND_SERIALSEND and CMND_SERIALLOG

View File

@ -652,7 +652,9 @@ void ResponseAppendFeatures(void)
#if defined(USE_I2C) && defined(USE_EZODO)
feature7 |= 0x00000100;
#endif
// feature7 |= 0x00000200;
#if defined(USE_I2C) && defined(USE_EZORGB)
feature7 |= 0x00000200;
#endif
// feature7 |= 0x00000400;
// feature7 |= 0x00000800;

View File

@ -238,13 +238,13 @@ void SwitchHandler(uint8_t mode)
{
if (TasmotaGlobal.uptime < 4) { return; } // Block GPIO for 4 seconds after poweron to workaround Wemos D1 / Obi RTS circuit
uint16_t loops_per_second = 1000 / Settings.switch_debounce;
uint32_t loops_per_second = 1000 / Settings.switch_debounce;
for (uint32_t i = 0; i < MAX_SWITCHES; i++) {
if (PinUsed(GPIO_SWT1, i) || (mode)) {
uint8_t button = Switch.virtual_state[i];
uint8_t switchflag = POWER_TOGGLE +1;
uint8_t MqttAction = POWER_NONE;
uint32_t button = Switch.virtual_state[i];
uint32_t switchflag = POWER_TOGGLE +1;
uint32_t MqttAction = POWER_NONE;
if (Switch.hold_timer[i] & (((Settings.switchmode[i] == PUSHHOLDMULTI) | (Settings.switchmode[i] == PUSHHOLDMULTI_INV)) ? SM_TIMER_MASK: SM_NO_TIMER_MASK)) {
Switch.hold_timer[i]--;
@ -418,14 +418,14 @@ void SwitchHandler(uint8_t mode)
Switch.last_state[i] = button;
}
if (switchflag <= POWER_TOGGLE) {
if (!Settings.flag5.mqtt_switches) { // SetOption114 (0) - Detach Swiches from relays and enable MQTT action state for all the SwitchModes
if (!Settings.flag5.mqtt_switches) { // SetOption114 (0) - Detach Swiches from relays and enable MQTT action state for all the SwitchModes
if (!SendKey(KEY_SWITCH, i +1, switchflag)) { // Execute command via MQTT
ExecuteCommandPower(i +1, switchflag, SRC_SWITCH); // Execute command internally (if i < TasmotaGlobal.devices_present)
}
} else { MqttAction = switchflag; }
}
if (MqttAction != POWER_NONE && Settings.flag5.mqtt_switches) {
MqttSwitchTopic(i +1, MqttAction); // SetOption114 (0) - Detach Swiches from relays and enable MQTT action state for all the SwitchModes
if ((MqttAction != POWER_NONE) && Settings.flag5.mqtt_switches) {
MqttSwitchTopic(i +1, MqttAction); // SetOption114 (0) - Detach Swiches from relays and enable MQTT action state for all the SwitchModes
MqttAction = POWER_NONE;
}
}
@ -433,7 +433,7 @@ void SwitchHandler(uint8_t mode)
}
void MqttSwitchTopic(uint32_t switch_id, uint32_t MqttAction) {
if (!Settings.flag.hass_discovery) { // SetOption19 - Control Home Assistantautomatic discovery (See SetOption59)
if (!Settings.flag.hass_discovery) { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59)
char mqttstate_str[16];
char *mqttstate = mqttstate_str;
if (MqttAction <= 3) {
@ -447,8 +447,7 @@ void MqttSwitchTopic(uint32_t switch_id, uint32_t MqttAction) {
}
}
void SwitchLoop(void)
{
void SwitchLoop(void) {
if (Switch.present) {
if (TimeReached(Switch.debounce)) {
SetNextTimeInterval(Switch.debounce, Settings.switch_debounce);

View File

@ -168,7 +168,8 @@ a_setoption = [[
"Use friendly name in zigbee topic (use with SetOption89)",
"Set dimmer low on rotary dial after power off"
],[
"","","","",
"Detach Swiches from Relays and enable MQTT action state for all the SwitchModes",
"","","",
"","","","",
"","","","",
"","","","",
@ -235,7 +236,7 @@ a_features = [[
],[
"USE_EZOORP","USE_EZORTD","USE_EZOHUM","USE_EZOEC",
"USE_EZOCO2","USE_EZOO2","USE_EZOPRS","USE_EZOFLO",
"USE_EZODO","","","",
"USE_EZODO","USE_EZORGB","","",
"","","","",
"","","","",
"","","","",