FIX #341 - when window state change, open_valve_percent should be resend

This commit is contained in:
Jean-Marc Collin
2024-01-14 23:02:23 +00:00
parent 513e65f79c
commit 67844d4ae8
3 changed files with 11 additions and 9 deletions

View File

@@ -168,6 +168,7 @@ climate:
target_sensor: input_number.fake_temperature_sensor1
recorder:
commit_interval: 1
include:
domains:
- input_boolean

View File

@@ -758,21 +758,25 @@ class UnderlyingValve(UnderlyingEntity):
async def turn_off(self):
"""Turn heater toggleable device off."""
_LOGGER.debug("%s - Stopping underlying valve entity %s", self, self._entity_id)
self._percent_open = 0
if self.is_device_active:
# Issue 341
is_active = self.is_device_active
self._percent_open = self.cap_sent_value(0)
if is_active:
await self.send_percent_open()
async def turn_on(self):
"""Nothing to do for Valve because it cannot be turned off"""
self.set_valve_open_percent()
async def set_hvac_mode(self, hvac_mode: HVACMode) -> bool:
"""Set the HVACmode. Returns true if something have change"""
if hvac_mode == HVACMode.OFF:
await self.turn_off()
if self._hvac_mode != hvac_mode:
self._hvac_mode = hvac_mode
if hvac_mode == HVACMode.OFF:
await self.turn_off()
else:
await self.turn_on()
return True
else:
return False

View File

@@ -321,9 +321,6 @@ async def test_over_valve_full_start(
await try_condition(None)
assert entity.hvac_mode is HVACMode.HEAT
assert (
entity.hvac_action is HVACAction.OFF
or entity.hvac_action is HVACAction.IDLE
)
assert entity.hvac_action is HVACAction.HEATING
assert entity.target_temperature == 17.1 # eco
assert entity.valve_open_percent == 10