Skip to content

Commit

Permalink
Merge pull request #119 from hristo-atanasov/ignore-off-temp
Browse files Browse the repository at this point in the history
Fix for #117 Ignore off temp
  • Loading branch information
hristo-atanasov authored Jun 22, 2023
2 parents 02f53aa + 94f3155 commit 23265d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
CONF_SWINGV,
CONF_SWINGH,
CONF_TOGGLE_LIST,
CONF_IGNORE_OFF_TEMP,
DATA_KEY,
DOMAIN,
DEFAULT_NAME,
Expand All @@ -164,6 +165,7 @@
DEFAULT_CONF_SLEEP,
DEFAULT_CONF_KEEP_MODE,
DEFAULT_STATE_MODE,
DEFAULT_IGNORE_OFF_TEMP,
ON_OFF_LIST,
STATE_MODE_LIST,
SERVICE_ECONO_MODE,
Expand Down Expand Up @@ -277,6 +279,7 @@
cv.ensure_list,
[vol.In(TOGGLE_ALL_LIST)],
),
vol.Optional(CONF_IGNORE_OFF_TEMP, default=DEFAULT_IGNORE_OFF_TEMP): cv.boolean,
}
)

Expand Down Expand Up @@ -521,6 +524,7 @@ def __init__(
self._fix_swingh = None
self._toggle_list = config[CONF_TOGGLE_LIST]
self._state_mode = DEFAULT_STATE_MODE
self._ignore_off_temp = config[CONF_IGNORE_OFF_TEMP]

availability_topic = config.get(CONF_AVAILABILITY_TOPIC)
if (availability_topic) is None:
Expand Down Expand Up @@ -626,7 +630,7 @@ async def state_message_received(msg):
return

payload = json_payload["IRHVAC"]

if payload["Vendor"] == self._vendor:
# All values in the payload are Optional
prev_power = self.power_mode
Expand All @@ -639,7 +643,10 @@ async def state_message_received(msg):
self._hvac_mode = HVAC_MODE_FAN_ONLY
if "Temp" in payload:
if payload["Temp"] > 0:
self._target_temp = payload["Temp"]
if self.power_mode == STATE_OFF and self._ignore_off_temp:
self._target_temp = self._target_temp
else:
self._target_temp = payload["Temp"]
if "Celsius" in payload:
self._celsius = payload["Celsius"].lower()
if "Quiet" in payload:
Expand Down
2 changes: 2 additions & 0 deletions custom_components/tasmota_irhvac/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
CONF_SWINGV = "default_swingv"
CONF_SWINGH = "default_swingh"
CONF_TOGGLE_LIST = "toggle_list"
CONF_IGNORE_OFF_TEMP = "ignore_off_temp"

# Platform specific default values
DEFAULT_NAME = "IR AirConditioner"
Expand All @@ -116,6 +117,7 @@
DEFAULT_CONF_SLEEP = "-1"
DEFAULT_CONF_KEEP_MODE = False
DEFAULT_STATE_MODE = "SendStore"
DEFAULT_IGNORE_OFF_TEMP = False

ATTR_NAME = "name"
ATTR_VALUE = "value"
Expand Down
3 changes: 3 additions & 0 deletions examples/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ climate:
#- SwingH
#- SwingV
#- Turbo
# When turning off some devices with their remote control they are set to the lowest temperature
# and this is shown on the thermostat card. Setting `ignore_off_temp` value to True will keep the last target temperature displayed on the card.
ignore_off_temp: False #optional - default False boolean value

0 comments on commit 23265d3

Please # to comment.