Feature 131 control trv valve (#139)

* Add configFlow and translations
* Refacto VersatileThermostat with BaseThermostat. Tests ok
* Add ThermostatValve. All tests ok

---------

Co-authored-by: Jean-Marc Collin <jean-marc.collin-extern@renault.com>
This commit is contained in:
Jean-Marc Collin
2023-10-28 11:30:14 +02:00
committed by GitHub
parent bf4eee85d8
commit 1c5790d096
35 changed files with 4082 additions and 3007 deletions

View File

@@ -11,7 +11,8 @@ from homeassistant.components.climate import ClimateEntity, DOMAIN as CLIMATE_DO
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.versatile_thermostat.climate import VersatileThermostat
from custom_components.versatile_thermostat.base_thermostat import BaseThermostat
from custom_components.versatile_thermostat.thermostat_switch import ThermostatOverSwitch
from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import
@@ -31,7 +32,7 @@ async def test_over_switch_ac_full_start(hass: HomeAssistant, skip_hass_states_i
now: datetime = datetime.now(tz=tz)
with patch(
"custom_components.versatile_thermostat.climate.VersatileThermostat.send_event"
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
) as mock_send_event:
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
@@ -45,12 +46,13 @@ async def test_over_switch_ac_full_start(hass: HomeAssistant, skip_hass_states_i
return entity
# The name is in the CONF and not the title of the entry
entity: VersatileThermostat = find_my_entity("climate.theoverswitchmockname")
entity: BaseThermostat = find_my_entity("climate.theoverswitchmockname")
assert entity
assert isinstance(entity, ThermostatOverSwitch)
assert entity.name == "TheOverSwitchMockName"
assert entity._is_over_climate is False # pylint: disable=protected-access
assert entity.is_over_climate is False # pylint: disable=protected-access
assert entity.ac_mode is True
assert entity.hvac_action is HVACAction.OFF
assert entity.hvac_mode is HVACMode.OFF
@@ -136,5 +138,3 @@ async def test_over_switch_ac_full_start(hass: HomeAssistant, skip_hass_states_i
assert entity.hvac_mode is HVACMode.COOL
assert (entity.hvac_action is HVACAction.OFF or entity.hvac_action is HVACAction.IDLE)
assert entity.target_temperature == 27 # eco_ac_away