Add Command ``SetOption2 1``

Add Command ``SetOption2 1`` to enable display of global temperature/humidity/pressure info to JSON sensor message
This commit is contained in:
Theo Arends 2021-09-01 09:42:10 +02:00
parent 6e3c239e25
commit 6ddb14bc6a
5 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- Support for Hydreon RG-15 Solid State Rain sensor (#12974) - Support for Hydreon RG-15 Solid State Rain sensor (#12974)
- Support for IKEA VINDRIKTNING particle concentration sensor (#12976) - Support for IKEA VINDRIKTNING particle concentration sensor (#12976)
- Berry support for Curve 25519 EC crypto - Berry support for Curve 25519 EC crypto
- Command ``SetOption2 1`` to enable display of global temperature/humidity/pressure info to JSON sensor message
### Changed ### Changed
- Shelly EM template needs to use GPIO ADE7953_IRQ_2 - Shelly EM template needs to use GPIO ADE7953_IRQ_2

View File

@ -101,6 +101,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
## Changelog v9.5.0.7 ## Changelog v9.5.0.7
### Added ### Added
- Release of [Tasmota WebInstaller](https://arendst.github.io/Tasmota-firmware/) - Release of [Tasmota WebInstaller](https://arendst.github.io/Tasmota-firmware/)
- Command ``SetOption2 1`` to enable display of global temperature/humidity/pressure info to JSON sensor message
- Command ``SetOption127 1`` to force Wi-Fi in no-sleep mode even if ``Sleep 0`` is not enabled - Command ``SetOption127 1`` to force Wi-Fi in no-sleep mode even if ``Sleep 0`` is not enabled
- Command ``SetOption128 0|1`` web referer check disabling HTTP API commands if set to 0. Default set to 1 for backward compatibility [#12828](https://github.com/arendst/Tasmota/issues/12828) - Command ``SetOption128 0|1`` web referer check disabling HTTP API commands if set to 0. Default set to 1 for backward compatibility [#12828](https://github.com/arendst/Tasmota/issues/12828)
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver - Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver

View File

@ -28,7 +28,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
struct { // SetOption0 .. SetOption31 struct { // SetOption0 .. SetOption31
uint32_t save_state : 1; // bit 0 - SetOption0 - (Settings) Save power state (1) and use after restart uint32_t save_state : 1; // bit 0 - SetOption0 - (Settings) Save power state (1) and use after restart
uint32_t button_restrict : 1; // bit 1 - SetOption1 - (Button) Control button single press (1) or multipress (0) uint32_t button_restrict : 1; // bit 1 - SetOption1 - (Button) Control button single press (1) or multipress (0)
uint32_t ex_value_units : 1; // bit 2 - SetOption2 - (not used) Add units to JSON status messages - removed 6.6.0.21 uint32_t mqtt_add_global_info : 1; // bit 2 - SetOption2 - (MQTT) Add global temperature/humidity/pressure info to JSON sensor message
uint32_t mqtt_enabled : 1; // bit 3 - SetOption3 - (MQTT) Enable (1) uint32_t mqtt_enabled : 1; // bit 3 - SetOption3 - (MQTT) Enable (1)
uint32_t mqtt_response : 1; // bit 4 - SetOption4 - (MQTT) Switch between RESULT (0) or COMMAND (1) uint32_t mqtt_response : 1; // bit 4 - SetOption4 - (MQTT) Switch between RESULT (0) or COMMAND (1)
uint32_t mqtt_power_retain : 1; // bit 5 - CMND_POWERRETAIN uint32_t mqtt_power_retain : 1; // bit 5 - CMND_POWERRETAIN

View File

@ -844,7 +844,7 @@ bool MqttShowSensor(void)
XsnsCall(FUNC_JSON_APPEND); XsnsCall(FUNC_JSON_APPEND);
XdrvCall(FUNC_JSON_APPEND); XdrvCall(FUNC_JSON_APPEND);
if (TasmotaGlobal.global_update) { if (TasmotaGlobal.global_update && Settings->flag.mqtt_add_global_info) {
if ((TasmotaGlobal.humidity > 0) || !isnan(TasmotaGlobal.temperature_celsius) || (TasmotaGlobal.pressure_hpa != 0)) { if ((TasmotaGlobal.humidity > 0) || !isnan(TasmotaGlobal.temperature_celsius) || (TasmotaGlobal.pressure_hpa != 0)) {
uint32_t add_comma = 0; uint32_t add_comma = 0;
ResponseAppend_P(PSTR(",\"Global\":{")); ResponseAppend_P(PSTR(",\"Global\":{"));

View File

@ -52,7 +52,7 @@ a_on_off = ["OFF","ON "]
a_setoption = [[ a_setoption = [[
"(Settings) Save power state (1) and use after restart", "(Settings) Save power state (1) and use after restart",
"(Button) Control button single press (1) or multipress (0)", "(Button) Control button single press (1) or multipress (0)",
"(Not used) Add units to JSON status messages", "(MQTT) Add global temperature/humidity/pressure info to JSON sensor message",
"(MQTT) Enable (1)", "(MQTT) Enable (1)",
"(MQTT) Switch between RESULT (0) or COMMAND (1)", "(MQTT) Switch between RESULT (0) or COMMAND (1)",
"(MQTT) Retain on Power", "(MQTT) Retain on Power",
@ -288,7 +288,7 @@ else:
obj = json.load(fp) obj = json.load(fp)
def StartDecode(): def StartDecode():
print ("\n*** decode-status.py v20210826 by Theo Arends and Jacek Ziolkowski ***") print ("\n*** decode-status.py v20210901 by Theo Arends and Jacek Ziolkowski ***")
# print("Decoding\n{}".format(obj)) # print("Decoding\n{}".format(obj))