From 07cc5536698a78acb73283160ce6dcde60ceb01c Mon Sep 17 00:00:00 2001 From: Naoki Sawada Date: Thu, 4 Feb 2021 20:56:06 +0900 Subject: [PATCH] Allows individual control of power and mode Power and mode must be individually controllable. Some devices may not function properly if the mode is also turned off when the power is turned off. see. https://github.com/crankyoldgit/IRremoteESP8266/issues/1402 --- tasmota/xdrv_05_irremote_full.ino | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_05_irremote_full.ino b/tasmota/xdrv_05_irremote_full.ino index 0b7f18b5a..66d0e17d4 100644 --- a/tasmota/xdrv_05_irremote_full.ino +++ b/tasmota/xdrv_05_irremote_full.ino @@ -203,12 +203,11 @@ String sendACJsonState(const stdAc::state_t &state) { json.add(PSTR(D_JSON_IRHVAC_VENDOR), typeToString(state.protocol)); json.add(PSTR(D_JSON_IRHVAC_MODEL), state.model); - // Home Assistant wants mode to be off if power is also off & vice-versa. - if (state.mode == stdAc::opmode_t::kOff || !state.power) { - json.add(PSTR(D_JSON_IRHVAC_MODE), IRac::opmodeToString(stdAc::opmode_t::kOff)); + json.add(PSTR(D_JSON_IRHVAC_MODE), IRac::opmodeToString(state.mode)); + // Home Assistant wants power to be off if mode is also off. + if (state.mode == stdAc::opmode_t::kOff) { json.add(PSTR(D_JSON_IRHVAC_POWER), IRac::boolToString(false)); } else { - json.add(PSTR(D_JSON_IRHVAC_MODE), IRac::opmodeToString(state.mode)); json.add(PSTR(D_JSON_IRHVAC_POWER), IRac::boolToString(state.power)); } json.add(PSTR(D_JSON_IRHVAC_CELSIUS), IRac::boolToString(state.celsius));