From c204a7c78704d7da723261463f3edc23c516b75d Mon Sep 17 00:00:00 2001
From: Nigel Rook <nigel@electricimp.com>
Date: Sat, 3 Feb 2018 01:28:54 +0000
Subject: [PATCH] Tado fixes (#11294)

* Fix tado overlay end state

Previously, when tado ended an overlay state itself, say because a timer
expired or a scheduled temperature change ocurred, the tado climate
component would not return to Smart Schedule mode. This change fixes
that issue

* Correct tado state after multiple rapid updates

Previosuly, making two changes to tado climate within 10 seconds, for
example setting operation mode to Tado mode, then changing the
temperature, would leave the entity showing the incorrect state for up
to a minute.

This change forces an unthrottled update after setting the climate
state, which fixes the issue

* Fix comment formatting
---
 homeassistant/components/climate/tado.py | 2 +-
 homeassistant/components/tado.py         | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/homeassistant/components/climate/tado.py b/homeassistant/components/climate/tado.py
index 5b20462c245..868511c0ac4 100644
--- a/homeassistant/components/climate/tado.py
+++ b/homeassistant/components/climate/tado.py
@@ -294,7 +294,7 @@ class TadoClimate(ClimateDevice):
 
         overlay = False
         overlay_data = None
-        termination = self._current_operation
+        termination = CONST_MODE_SMART_SCHEDULE
         cooling = False
         fan_speed = CONST_MODE_OFF
 
diff --git a/homeassistant/components/tado.py b/homeassistant/components/tado.py
index 1f5125d724e..cfba0a5c0c4 100644
--- a/homeassistant/components/tado.py
+++ b/homeassistant/components/tado.py
@@ -119,8 +119,10 @@ class TadoDataStore:
 
     def reset_zone_overlay(self, zone_id):
         """Wrap for resetZoneOverlay(..)."""
-        return self.tado.resetZoneOverlay(zone_id)
+        self.tado.resetZoneOverlay(zone_id)
+        self.update(no_throttle=True)  # pylint: disable=unexpected-keyword-arg
 
     def set_zone_overlay(self, zone_id, mode, temperature=None, duration=None):
         """Wrap for setZoneOverlay(..)."""
-        return self.tado.setZoneOverlay(zone_id, mode, temperature, duration)
+        self.tado.setZoneOverlay(zone_id, mode, temperature, duration)
+        self.update(no_throttle=True)  # pylint: disable=unexpected-keyword-arg
-- 
GitLab