From e88d1682e9854a78d7bf3f90e3b333a6b0431462 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:10:29 +0100 Subject: [PATCH] Add command ``SwitchMode 16`` Add command ``SwitchMode 16`` sending only MQTT message on inverted switch change (#17028) --- CHANGELOG.md | 3 ++- RELEASENOTES.md | 3 +++ tasmota/include/tasmota.h | 13 +++++++++++-- tasmota/tasmota_support/support_switch.ino | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e152076a..7440cc613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index fdc8a7b16..8bc75e96b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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 diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index cc53ee79f..bde60e52f 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -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}; diff --git a/tasmota/tasmota_support/support_switch.ino b/tasmota/tasmota_support/support_switch.ino index 7a3f01dae..6bf59bbcb 100644 --- a/tasmota/tasmota_support/support_switch.ino +++ b/tasmota/tasmota_support/support_switch.ino @@ -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; }