Fix switches

This commit is contained in:
Theo Arends 2020-11-04 16:31:53 +01:00
parent 7915e82cb0
commit 8376dd8982
5 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ All notable changes to this project will be documented in this file.
- Zigbee command ``ZbOccupancy`` to configure the time-out for PIR - Zigbee command ``ZbOccupancy`` to configure the time-out for PIR
- Command ``Gpios 255`` to show all possible GPIO configurations - Command ``Gpios 255`` to show all possible GPIO configurations
- Command ``SwitchText`` to change JSON switch names by barbudor (#9691) - 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 returning `{"Switch1":{"Action":"ON"}}` - Command ``SetOption114 1`` to detach Switches from Relays and enable MQTT action state for all the SwitchModes returning `{"Switch1":{"Action":"ON"}}`
- HM10 Beacon support and refactoring by Christian Baars (#9702) - HM10 Beacon support and refactoring by Christian Baars (#9702)
- Support for Hass discovery of TuyaMcu and Sonoff Ifan by Federico Leoni (#9727) - Support for Hass discovery of TuyaMcu and Sonoff Ifan by Federico Leoni (#9727)
- Initial support for iBeacons (Sensor52) on ESP32 using internal BLE by rvbglas (#9732) - Initial support for iBeacons (Sensor52) on ESP32 using internal BLE by rvbglas (#9732)

View File

@ -64,7 +64,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Command ``ShutterChange`` to increment change position (#9594) - Command ``ShutterChange`` to increment change position (#9594)
- Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593) - 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 ``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 ``SetOption114 1`` to detach Switches from Relays and enable MQTT action state for all the SwitchModes
- Command ``SwitchText`` to change JSON switch names by barbudor (#9691) - Command ``SwitchText`` to change JSON switch names by barbudor (#9691)
- Zigbee command ``ZbData`` for better support of device specific data - Zigbee command ``ZbData`` for better support of device specific data
- Zigbee command ``ZbOccupancy`` to configure the time-out for PIR - Zigbee command ``ZbOccupancy`` to configure the time-out for PIR

View File

@ -139,7 +139,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... typedef union { // Restricted by MISRA-C Rule 18.4 but so useful...
uint32_t data; // Allow bit manipulation using SetOption uint32_t data; // Allow bit manipulation using SetOption
struct { // SetOption114 .. SetOption145 struct { // SetOption114 .. SetOption145
uint32_t mqtt_switches : 1; // bit 0 (V9.0.0.3) - SetOption114 - Detach Swiches from relays and enable MQTT action state for all the SwitchModes uint32_t mqtt_switches : 1; // bit 0 (V9.0.0.3) - SetOption114 - Detach Switches from relays and enable MQTT action state for all the SwitchModes
//uint32_t spare00 : 1; // bit 0 //uint32_t spare00 : 1; // bit 0
uint32_t spare01 : 1; // bit 1 uint32_t spare01 : 1; // bit 1
uint32_t spare02 : 1; // bit 2 uint32_t spare02 : 1; // bit 2

View File

@ -410,13 +410,13 @@ void SwitchHandler(uint32_t mode) {
Switch.last_state[i] = button; Switch.last_state[i] = button;
} }
if (switchflag <= POWER_TOGGLE) { 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 Switches from relays and enable MQTT action state for all the SwitchModes
if (!SendKey(KEY_SWITCH, i +1, switchflag)) { // Execute command via MQTT 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) ExecuteCommandPower(i +1, switchflag, SRC_SWITCH); // Execute command internally (if i < TasmotaGlobal.devices_present)
} }
} else { mqtt_action = switchflag; } } else { mqtt_action = switchflag; }
} }
if ((mqtt_action != POWER_NONE) && Settings.flag5.mqtt_switches) { // SetOption114 (0) - Detach Swiches from relays and enable MQTT action state for all the SwitchModes if ((mqtt_action != POWER_NONE) && Settings.flag5.mqtt_switches) { // SetOption114 (0) - Detach Switches from relays and enable MQTT action state for all the SwitchModes
if (!Settings.flag.hass_discovery) { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59) if (!Settings.flag.hass_discovery) { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59)
char mqtt_state_str[16]; char mqtt_state_str[16];
char *mqtt_state = mqtt_state_str; char *mqtt_state = mqtt_state_str;

View File

@ -168,7 +168,7 @@ a_setoption = [[
"Use friendly name in zigbee topic (use with SetOption89)", "Use friendly name in zigbee topic (use with SetOption89)",
"Set dimmer low on rotary dial after power off" "Set dimmer low on rotary dial after power off"
],[ ],[
"Detach Swiches from Relays and enable MQTT action state for all the SwitchModes", "Detach Switches from Relays and enable MQTT action state for all the SwitchModes",
"","","", "","","",
"","","","", "","","","",
"","","","", "","","","",