Add command `SwitchMode 16`

Add command ``SwitchMode 16`` sending only MQTT message on inverted switch change (#17028)
This commit is contained in:
Theo Arends 2022-11-15 10:10:29 +01:00
parent 5bbc734edc
commit e88d1682e9
4 changed files with 19 additions and 3 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- Support for Dingtian x595/x165 shift register based relay boards by Barbudor (#17032)
- New ``FUNC_NETWORK_UP`` and ``FUNC_NETWORK_DOWN`` events
- WS2812 and Light Art-Net DMX control over UDP port 6454 (#17059)
- Command ``SwitchMode 16`` sending only MQTT message on inverted switch change (#17028)
### Breaking Changed
@ -17,7 +18,7 @@ All notable changes to this project will be documented in this file.
- ESP32 Framework (Core) from v2.0.5.2 to v2.0.5.3 (#17034)
- TuyaMcu rewrite by btsimonh (#17051)
- WS2812 sends signal to only ``Pixels`` leds instead of sending to 512 leds (#17055)
- Zigbee improved Aqara plug support and completed cluster 0x0702
- Zigbee improved Aqara plug support and completed cluster 0x0702 (#17073)
- ESP32 LVGL library from v8.3.2 to v8.3.3 (no functional change)
### Fixed

View File

@ -110,6 +110,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
## Changelog v12.2.0.4
### Added
- Command ``SetOption47 1..255`` to delay power on relay state in seconds reducing power surge. ``SO47 1`` delays until network connected. ``SO47 2`` delays until mqtt connected
- Command ``SwitchMode 16`` sending only MQTT message on inverted switch change [#17028](https://github.com/arendst/Tasmota/issues/17028)
- Command NeoPool ``NPFiltration 2`` toggle [#16859](https://github.com/arendst/Tasmota/issues/16859)
- Support for two phase power calibration using commands ``PowerSet2``, ``VoltageSet2`` and ``CurrentSet2``
- Support for Shelly Pro 1/1PM and 2/2PM [#16773](https://github.com/arendst/Tasmota/issues/16773)
@ -130,12 +131,14 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
### Changed
- ESP32 Framework (Core) from v2.0.5 to v2.0.5.3
- ESP32 LVGL library from v8.3.2 to v8.3.3 (no functional change)
- ESP32 NimBLE library from v1.4.0 to v1.4.1 [#16775](https://github.com/arendst/Tasmota/issues/16775)
- DS18x20 ``DS18Alias`` to ``DS18Sens`` [#16833](https://github.com/arendst/Tasmota/issues/16833)
- Compiling with reduced boards manifests in favour of Autoconfig [#16848](https://github.com/arendst/Tasmota/issues/16848)
- ADE7953 monitoring from instant power to accumulated energy [#16941](https://github.com/arendst/Tasmota/issues/16941)
- TuyaMcu rewrite by btsimonh [#17051](https://github.com/arendst/Tasmota/issues/17051)
- WS2812 sends signal to only ``Pixels`` leds instead of sending to 512 leds [#17055](https://github.com/arendst/Tasmota/issues/17055)
- Zigbee improved Aqara plug support and completed cluster 0x0702 [#17073](https://github.com/arendst/Tasmota/issues/17073)
### Fixed
- Serial bridge default serial configuration from 5N1 to 8N1 regression from v10.1.0.3

View File

@ -322,8 +322,17 @@ enum WifiConfigOptions {WIFI_RESTART, EX_WIFI_SMARTCONFIG, WIFI_MANAGER, EX_WIFI
enum WifiTestOptions {WIFI_NOT_TESTING, WIFI_TESTING, WIFI_TEST_FINISHED, WIFI_TEST_FINISHED_BAD};
enum SwitchModeOptions {TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, PUSHBUTTON_TOGGLE, TOGGLEMULTI,
FOLLOWMULTI, FOLLOWMULTI_INV, PUSHHOLDMULTI, PUSHHOLDMULTI_INV, PUSHON, PUSHON_INV, PUSH_IGNORE, MAX_SWITCH_OPTION};
enum SwitchModeOptions {TOGGLE,
FOLLOW, FOLLOW_INV,
PUSHBUTTON, PUSHBUTTON_INV,
PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV,
PUSHBUTTON_TOGGLE,
TOGGLEMULTI,
FOLLOWMULTI, FOLLOWMULTI_INV,
PUSHHOLDMULTI, PUSHHOLDMULTI_INV,
PUSHON, PUSHON_INV,
PUSH_IGNORE, PUSH_IGNORE_INV, // 15, 16
MAX_SWITCH_OPTION};
enum LedStateOptions {LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQTTPUB, LED_POWER_MQTTPUB, LED_MQTT, LED_POWER_MQTT, MAX_LED_OPTION};

View File

@ -409,6 +409,9 @@ void SwitchHandler(uint32_t mode) {
Switch.last_state[i] = button; // Update switch state before publishing
MqttPublishSensor();
break;
case PUSH_IGNORE_INV:
MqttPublishSensor(); // Publishing before update
break;
}
Switch.last_state[i] = button;
}