Fix incorrect current temperature for homekit water heaters (#46076)
parent
dc26fd5149
commit
6467eff09c
|
@ -595,10 +595,15 @@ class WaterHeater(HomeAccessory):
|
||||||
def async_update_state(self, new_state):
|
def async_update_state(self, new_state):
|
||||||
"""Update water_heater state after state change."""
|
"""Update water_heater state after state change."""
|
||||||
# Update current and target temperature
|
# Update current and target temperature
|
||||||
temperature = _get_target_temperature(new_state, self._unit)
|
target_temperature = _get_target_temperature(new_state, self._unit)
|
||||||
if temperature is not None:
|
if target_temperature is not None:
|
||||||
if temperature != self.char_current_temp.value:
|
if target_temperature != self.char_target_temp.value:
|
||||||
self.char_target_temp.set_value(temperature)
|
self.char_target_temp.set_value(target_temperature)
|
||||||
|
|
||||||
|
current_temperature = _get_current_temperature(new_state, self._unit)
|
||||||
|
if current_temperature is not None:
|
||||||
|
if current_temperature != self.char_current_temp.value:
|
||||||
|
self.char_current_temp.set_value(current_temperature)
|
||||||
|
|
||||||
# Update display units
|
# Update display units
|
||||||
if self._unit and self._unit in UNIT_HASS_TO_HOMEKIT:
|
if self._unit and self._unit in UNIT_HASS_TO_HOMEKIT:
|
||||||
|
|
|
@ -1599,11 +1599,15 @@ async def test_water_heater(hass, hk_driver, events):
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id,
|
entity_id,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
{ATTR_HVAC_MODE: HVAC_MODE_HEAT, ATTR_TEMPERATURE: 56.0},
|
{
|
||||||
|
ATTR_HVAC_MODE: HVAC_MODE_HEAT,
|
||||||
|
ATTR_TEMPERATURE: 56.0,
|
||||||
|
ATTR_CURRENT_TEMPERATURE: 35.0,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert acc.char_target_temp.value == 56.0
|
assert acc.char_target_temp.value == 56.0
|
||||||
assert acc.char_current_temp.value == 50.0
|
assert acc.char_current_temp.value == 35.0
|
||||||
assert acc.char_target_heat_cool.value == 1
|
assert acc.char_target_heat_cool.value == 1
|
||||||
assert acc.char_current_heat_cool.value == 1
|
assert acc.char_current_heat_cool.value == 1
|
||||||
assert acc.char_display_units.value == 0
|
assert acc.char_display_units.value == 0
|
||||||
|
|
Loading…
Reference in New Issue