WIP: Don't set initial values for MQTT HVAC in non-optimistic mode (#17268)

* Don't set initial temperature in non-optimistic mode

* Fix tests

* Don't set initial values in non-optimistic mode

For fan mode, current operation and swing mode

* Fix tests again
This commit is contained in:
definitio authored and Paulus Schoutsen committed 2018-10-10 14:06:53 +02:00
1 parent 83dd961fde
commit 7f896bfb40
2 files changed
+25 -18

No files matched your search

+11 -4
View File
@@ -240,15 +240,22 @@ class MqttClimate(MqttAvailability, MqttDiscoveryUpdate, ClimateDevice):
self._value_templates = value_templates
self._qos = qos
self._retain = retain
self._target_temperature = target_temperature
# set to None in non-optimistic mode
self._target_temperature = self._current_fan_mode = \
self._current_operation = self._current_swing_mode = None
if self._topic[CONF_TEMPERATURE_STATE_TOPIC] is None:
self._target_temperature = target_temperature
self._unit_of_measurement = hass.config.units.temperature_unit
self._away = away
self._hold = hold
self._current_temperature = None
self._current_fan_mode = current_fan_mode
self._current_operation = current_operation
if self._topic[CONF_FAN_MODE_STATE_TOPIC] is None:
self._current_fan_mode = current_fan_mode
if self._topic[CONF_MODE_STATE_TOPIC] is None:
self._current_operation = current_operation
self._aux = aux
self._current_swing_mode = current_swing_mode
if self._topic[CONF_SWING_MODE_STATE_TOPIC] is None:
self._current_swing_mode = current_swing_mode
self._fan_list = fan_mode_list
self._operation_list = mode_list
self._swing_list = swing_mode_list