mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Handle all three operating modes in Advantage Air climate (#91107)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
5e2b0b23c9
commit
667a00e7f9
@ -5,6 +5,8 @@ import logging
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
|
ATTR_TARGET_TEMP_LOW,
|
||||||
FAN_AUTO,
|
FAN_AUTO,
|
||||||
FAN_HIGH,
|
FAN_HIGH,
|
||||||
FAN_LOW,
|
FAN_LOW,
|
||||||
@ -32,18 +34,10 @@ ADVANTAGE_AIR_HVAC_MODES = {
|
|||||||
"cool": HVACMode.COOL,
|
"cool": HVACMode.COOL,
|
||||||
"vent": HVACMode.FAN_ONLY,
|
"vent": HVACMode.FAN_ONLY,
|
||||||
"dry": HVACMode.DRY,
|
"dry": HVACMode.DRY,
|
||||||
"myauto": HVACMode.AUTO,
|
"myauto": HVACMode.HEAT_COOL,
|
||||||
}
|
}
|
||||||
HASS_HVAC_MODES = {v: k for k, v in ADVANTAGE_AIR_HVAC_MODES.items()}
|
HASS_HVAC_MODES = {v: k for k, v in ADVANTAGE_AIR_HVAC_MODES.items()}
|
||||||
|
|
||||||
AC_HVAC_MODES = [
|
|
||||||
HVACMode.OFF,
|
|
||||||
HVACMode.COOL,
|
|
||||||
HVACMode.HEAT,
|
|
||||||
HVACMode.FAN_ONLY,
|
|
||||||
HVACMode.DRY,
|
|
||||||
]
|
|
||||||
|
|
||||||
ADVANTAGE_AIR_FAN_MODES = {
|
ADVANTAGE_AIR_FAN_MODES = {
|
||||||
"autoAA": FAN_AUTO,
|
"autoAA": FAN_AUTO,
|
||||||
"low": FAN_LOW,
|
"low": FAN_LOW,
|
||||||
@ -53,7 +47,14 @@ ADVANTAGE_AIR_FAN_MODES = {
|
|||||||
HASS_FAN_MODES = {v: k for k, v in ADVANTAGE_AIR_FAN_MODES.items()}
|
HASS_FAN_MODES = {v: k for k, v in ADVANTAGE_AIR_FAN_MODES.items()}
|
||||||
FAN_SPEEDS = {FAN_LOW: 30, FAN_MEDIUM: 60, FAN_HIGH: 100}
|
FAN_SPEEDS = {FAN_LOW: 30, FAN_MEDIUM: 60, FAN_HIGH: 100}
|
||||||
|
|
||||||
ZONE_HVAC_MODES = [HVACMode.OFF, HVACMode.HEAT_COOL]
|
ADVANTAGE_AIR_AUTOFAN = "aaAutoFanModeEnabled"
|
||||||
|
ADVANTAGE_AIR_MYZONE = "MyZone"
|
||||||
|
ADVANTAGE_AIR_MYAUTO = "MyAuto"
|
||||||
|
ADVANTAGE_AIR_MYAUTO_ENABLED = "myAutoModeEnabled"
|
||||||
|
ADVANTAGE_AIR_MYTEMP = "MyTemp"
|
||||||
|
ADVANTAGE_AIR_MYTEMP_ENABLED = "climateControlModeEnabled"
|
||||||
|
ADVANTAGE_AIR_HEAT_TARGET = "myAutoHeatTargetTemp"
|
||||||
|
ADVANTAGE_AIR_COOL_TARGET = "myAutoCoolTargetTemp"
|
||||||
|
|
||||||
PARALLEL_UPDATES = 0
|
PARALLEL_UPDATES = 0
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ async def async_setup_entry(
|
|||||||
entities.append(AdvantageAirAC(instance, ac_key))
|
entities.append(AdvantageAirAC(instance, ac_key))
|
||||||
for zone_key, zone in ac_device["zones"].items():
|
for zone_key, zone in ac_device["zones"].items():
|
||||||
# Only add zone climate control when zone is in temperature control
|
# Only add zone climate control when zone is in temperature control
|
||||||
if zone["type"] != 0:
|
if zone["type"] > 0:
|
||||||
entities.append(AdvantageAirZone(instance, ac_key, zone_key))
|
entities.append(AdvantageAirZone(instance, ac_key, zone_key))
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
@ -83,24 +84,56 @@ async def async_setup_entry(
|
|||||||
class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
|
class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
|
||||||
"""AdvantageAir AC unit."""
|
"""AdvantageAir AC unit."""
|
||||||
|
|
||||||
|
_attr_fan_modes = [FAN_LOW, FAN_MEDIUM, FAN_HIGH]
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
_attr_target_temperature_step = PRECISION_WHOLE
|
_attr_target_temperature_step = PRECISION_WHOLE
|
||||||
_attr_max_temp = 32
|
_attr_max_temp = 32
|
||||||
_attr_min_temp = 16
|
_attr_min_temp = 16
|
||||||
_attr_fan_modes = [FAN_AUTO, FAN_LOW, FAN_MEDIUM, FAN_HIGH]
|
|
||||||
_attr_hvac_modes = AC_HVAC_MODES
|
|
||||||
_attr_supported_features = (
|
|
||||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, instance: dict[str, Any], ac_key: str) -> None:
|
def __init__(self, instance: dict[str, Any], ac_key: str) -> None:
|
||||||
"""Initialize an AdvantageAir AC unit."""
|
"""Initialize an AdvantageAir AC unit."""
|
||||||
super().__init__(instance, ac_key)
|
super().__init__(instance, ac_key)
|
||||||
if self._ac.get("myAutoModeEnabled"):
|
|
||||||
self._attr_hvac_modes = AC_HVAC_MODES + [HVACMode.AUTO]
|
# Set supported features and HVAC modes based on current operating mode
|
||||||
|
if self._ac.get(ADVANTAGE_AIR_MYAUTO_ENABLED):
|
||||||
|
# MyAuto
|
||||||
|
self._attr_supported_features = (
|
||||||
|
ClimateEntityFeature.FAN_MODE
|
||||||
|
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||||
|
)
|
||||||
|
self._attr_hvac_modes = [
|
||||||
|
HVACMode.OFF,
|
||||||
|
HVACMode.COOL,
|
||||||
|
HVACMode.HEAT,
|
||||||
|
HVACMode.FAN_ONLY,
|
||||||
|
HVACMode.DRY,
|
||||||
|
HVACMode.HEAT_COOL,
|
||||||
|
]
|
||||||
|
elif self._ac.get(ADVANTAGE_AIR_MYTEMP_ENABLED):
|
||||||
|
# MyTemp
|
||||||
|
self._attr_supported_features = ClimateEntityFeature.FAN_MODE
|
||||||
|
self._attr_hvac_modes = [HVACMode.OFF, HVACMode.COOL, HVACMode.HEAT]
|
||||||
|
|
||||||
|
else:
|
||||||
|
# MyZone
|
||||||
|
self._attr_supported_features = (
|
||||||
|
ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
)
|
||||||
|
self._attr_hvac_modes = [
|
||||||
|
HVACMode.OFF,
|
||||||
|
HVACMode.COOL,
|
||||||
|
HVACMode.HEAT,
|
||||||
|
HVACMode.FAN_ONLY,
|
||||||
|
HVACMode.DRY,
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add "ezfan" mode if supported
|
||||||
|
if self._ac.get(ADVANTAGE_AIR_AUTOFAN):
|
||||||
|
self._attr_fan_modes += [FAN_AUTO]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self) -> float:
|
def target_temperature(self) -> float | None:
|
||||||
"""Return the current target temperature."""
|
"""Return the current target temperature."""
|
||||||
return self._ac["setTemp"]
|
return self._ac["setTemp"]
|
||||||
|
|
||||||
@ -116,6 +149,16 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
|
|||||||
"""Return the current fan modes."""
|
"""Return the current fan modes."""
|
||||||
return ADVANTAGE_AIR_FAN_MODES.get(self._ac["fan"])
|
return ADVANTAGE_AIR_FAN_MODES.get(self._ac["fan"])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_temperature_high(self) -> float | None:
|
||||||
|
"""Return the temperature cool mode is enabled."""
|
||||||
|
return self._ac.get(ADVANTAGE_AIR_COOL_TARGET)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def target_temperature_low(self) -> float | None:
|
||||||
|
"""Return the temperature heat mode is enabled."""
|
||||||
|
return self._ac.get(ADVANTAGE_AIR_HEAT_TARGET)
|
||||||
|
|
||||||
async def async_turn_on(self) -> None:
|
async def async_turn_on(self) -> None:
|
||||||
"""Set the HVAC State to on."""
|
"""Set the HVAC State to on."""
|
||||||
await self.aircon(
|
await self.aircon(
|
||||||
@ -166,27 +209,37 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
|
|||||||
|
|
||||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set the Temperature."""
|
"""Set the Temperature."""
|
||||||
temp = kwargs.get(ATTR_TEMPERATURE)
|
if ATTR_TEMPERATURE in kwargs:
|
||||||
await self.aircon({self.ac_key: {"info": {"setTemp": temp}}})
|
await self.aircon(
|
||||||
|
{self.ac_key: {"info": {"setTemp": kwargs[ATTR_TEMPERATURE]}}}
|
||||||
|
)
|
||||||
|
if ATTR_TARGET_TEMP_LOW in kwargs and ATTR_TARGET_TEMP_HIGH in kwargs:
|
||||||
|
await self.aircon(
|
||||||
|
{
|
||||||
|
self.ac_key: {
|
||||||
|
"info": {
|
||||||
|
ADVANTAGE_AIR_COOL_TARGET: kwargs[ATTR_TARGET_TEMP_HIGH],
|
||||||
|
ADVANTAGE_AIR_HEAT_TARGET: kwargs[ATTR_TARGET_TEMP_LOW],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity):
|
class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity):
|
||||||
"""AdvantageAir Zone control."""
|
"""AdvantageAir MyTemp Zone control."""
|
||||||
|
|
||||||
|
_attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT_COOL]
|
||||||
|
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
_attr_target_temperature_step = PRECISION_WHOLE
|
_attr_target_temperature_step = PRECISION_WHOLE
|
||||||
_attr_max_temp = 32
|
_attr_max_temp = 32
|
||||||
_attr_min_temp = 16
|
_attr_min_temp = 16
|
||||||
_attr_hvac_modes = ZONE_HVAC_MODES
|
|
||||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
|
||||||
|
|
||||||
def __init__(self, instance: dict[str, Any], ac_key: str, zone_key: str) -> None:
|
def __init__(self, instance: dict[str, Any], ac_key: str, zone_key: str) -> None:
|
||||||
"""Initialize an AdvantageAir Zone control."""
|
"""Initialize an AdvantageAir Zone control."""
|
||||||
super().__init__(instance, ac_key, zone_key)
|
super().__init__(instance, ac_key, zone_key)
|
||||||
self._attr_name = self._zone["name"]
|
self._attr_name = self._zone["name"]
|
||||||
self._attr_unique_id = (
|
|
||||||
f'{self.coordinator.data["system"]["rid"]}-{ac_key}-{zone_key}'
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> HVACMode:
|
def hvac_mode(self) -> HVACMode:
|
||||||
@ -196,7 +249,7 @@ class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity):
|
|||||||
return HVACMode.OFF
|
return HVACMode.OFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> float:
|
def current_temperature(self) -> float | None:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
return self._zone["measuredTemp"]
|
return self._zone["measuredTemp"]
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
"aircons": {
|
"aircons": {
|
||||||
"ac1": {
|
"ac1": {
|
||||||
"info": {
|
"info": {
|
||||||
|
"aaAutoFanModeEnabled": false,
|
||||||
|
"climateControlModeEnabled": false,
|
||||||
"climateControlModeIsRunning": false,
|
"climateControlModeIsRunning": false,
|
||||||
"countDownToOff": 10,
|
"countDownToOff": 10,
|
||||||
"countDownToOn": 0,
|
"countDownToOn": 0,
|
||||||
@ -9,8 +11,10 @@
|
|||||||
"filterCleanStatus": 0,
|
"filterCleanStatus": 0,
|
||||||
"freshAirStatus": "off",
|
"freshAirStatus": "off",
|
||||||
"mode": "vent",
|
"mode": "vent",
|
||||||
|
"myAutoModeEnabled": false,
|
||||||
|
"myAutoModeIsRunning": false,
|
||||||
"myZone": 1,
|
"myZone": 1,
|
||||||
"name": "AC One",
|
"name": "myzone",
|
||||||
"setTemp": 24,
|
"setTemp": 24,
|
||||||
"state": "on"
|
"state": "on"
|
||||||
},
|
},
|
||||||
@ -94,20 +98,76 @@
|
|||||||
},
|
},
|
||||||
"ac2": {
|
"ac2": {
|
||||||
"info": {
|
"info": {
|
||||||
|
"aaAutoFanModeEnabled": true,
|
||||||
|
"climateControlModeEnabled": true,
|
||||||
"climateControlModeIsRunning": false,
|
"climateControlModeIsRunning": false,
|
||||||
"countDownToOff": 0,
|
"countDownToOff": 0,
|
||||||
"countDownToOn": 20,
|
"countDownToOn": 20,
|
||||||
"fan": "low",
|
"fan": "autoAA",
|
||||||
|
"filterCleanStatus": 1,
|
||||||
|
"freshAirStatus": "none",
|
||||||
|
"mode": "cool",
|
||||||
|
"myAutoModeCurrentSetMode": "cool",
|
||||||
|
"myAutoModeEnabled": false,
|
||||||
|
"myAutoModeIsRunning": false,
|
||||||
|
"myZone": 1,
|
||||||
|
"name": "mytemp",
|
||||||
|
"setTemp": 24,
|
||||||
|
"state": "off"
|
||||||
|
},
|
||||||
|
"zones": {
|
||||||
|
"z01": {
|
||||||
|
"error": 0,
|
||||||
|
"maxDamper": 100,
|
||||||
|
"measuredTemp": 25,
|
||||||
|
"minDamper": 0,
|
||||||
|
"motion": 20,
|
||||||
|
"motionConfig": 2,
|
||||||
|
"name": "Zone A",
|
||||||
|
"number": 1,
|
||||||
|
"rssi": 40,
|
||||||
|
"setTemp": 24,
|
||||||
|
"state": "open",
|
||||||
|
"type": 1,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"z02": {
|
||||||
|
"error": 0,
|
||||||
|
"maxDamper": 100,
|
||||||
|
"measuredTemp": 26,
|
||||||
|
"minDamper": 0,
|
||||||
|
"motion": 21,
|
||||||
|
"motionConfig": 2,
|
||||||
|
"name": "Zone B",
|
||||||
|
"number": 2,
|
||||||
|
"rssi": 10,
|
||||||
|
"setTemp": 23,
|
||||||
|
"state": "open",
|
||||||
|
"type": 1,
|
||||||
|
"value": 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ac3": {
|
||||||
|
"info": {
|
||||||
|
"aaAutoFanModeEnabled": true,
|
||||||
|
"climateControlModeEnabled": false,
|
||||||
|
"climateControlModeIsRunning": false,
|
||||||
|
"countDownToOff": 0,
|
||||||
|
"countDownToOn": 0,
|
||||||
|
"fan": "autoAA",
|
||||||
"filterCleanStatus": 1,
|
"filterCleanStatus": 1,
|
||||||
"freshAirStatus": "none",
|
"freshAirStatus": "none",
|
||||||
"mode": "myauto",
|
"mode": "myauto",
|
||||||
"myAutoModeCurrentSetMode": "cool",
|
"myAutoModeCurrentSetMode": "cool",
|
||||||
"myAutoModeEnabled": true,
|
"myAutoModeEnabled": true,
|
||||||
"myAutoModeIsRunning": true,
|
"myAutoModeIsRunning": true,
|
||||||
|
"myAutoCoolTargetTemp": 24,
|
||||||
|
"myAutoHeatTargetTemp": 20,
|
||||||
"myZone": 0,
|
"myZone": 0,
|
||||||
"name": "AC Two",
|
"name": "myauto",
|
||||||
"setTemp": 24,
|
"setTemp": 24,
|
||||||
"state": "off"
|
"state": "on"
|
||||||
},
|
},
|
||||||
"zones": {
|
"zones": {
|
||||||
"z01": {
|
"z01": {
|
||||||
@ -117,7 +177,7 @@
|
|||||||
"minDamper": 0,
|
"minDamper": 0,
|
||||||
"motion": 0,
|
"motion": 0,
|
||||||
"motionConfig": 0,
|
"motionConfig": 0,
|
||||||
"name": "Zone open without sensor",
|
"name": "Zone Y",
|
||||||
"number": 1,
|
"number": 1,
|
||||||
"rssi": 0,
|
"rssi": 0,
|
||||||
"setTemp": 24,
|
"setTemp": 24,
|
||||||
@ -132,7 +192,7 @@
|
|||||||
"minDamper": 0,
|
"minDamper": 0,
|
||||||
"motion": 0,
|
"motion": 0,
|
||||||
"motionConfig": 0,
|
"motionConfig": 0,
|
||||||
"name": "Zone closed without sensor",
|
"name": "Zone Z",
|
||||||
"number": 2,
|
"number": 2,
|
||||||
"rssi": 0,
|
"rssi": 0,
|
||||||
"setTemp": 24,
|
"setTemp": 24,
|
||||||
|
@ -39,7 +39,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
|
|
||||||
# Test First Air Filter
|
# Test First Air Filter
|
||||||
entity_id = "binary_sensor.ac_one_filter"
|
entity_id = "binary_sensor.myzone_filter"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
@ -49,7 +49,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-filter"
|
assert entry.unique_id == "uniqueid-ac1-filter"
|
||||||
|
|
||||||
# Test Second Air Filter
|
# Test Second Air Filter
|
||||||
entity_id = "binary_sensor.ac_two_filter"
|
entity_id = "binary_sensor.mytemp_filter"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
@ -59,7 +59,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert entry.unique_id == "uniqueid-ac2-filter"
|
assert entry.unique_id == "uniqueid-ac2-filter"
|
||||||
|
|
||||||
# Test First Motion Sensor
|
# Test First Motion Sensor
|
||||||
entity_id = "binary_sensor.ac_one_zone_open_with_sensor_motion"
|
entity_id = "binary_sensor.myzone_zone_open_with_sensor_motion"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
@ -69,7 +69,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z01-motion"
|
assert entry.unique_id == "uniqueid-ac1-z01-motion"
|
||||||
|
|
||||||
# Test Second Motion Sensor
|
# Test Second Motion Sensor
|
||||||
entity_id = "binary_sensor.ac_one_zone_closed_with_sensor_motion"
|
entity_id = "binary_sensor.myzone_zone_closed_with_sensor_motion"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
@ -79,7 +79,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z02-motion"
|
assert entry.unique_id == "uniqueid-ac1-z02-motion"
|
||||||
|
|
||||||
# Test First MyZone Sensor (disabled by default)
|
# Test First MyZone Sensor (disabled by default)
|
||||||
entity_id = "binary_sensor.ac_one_zone_open_with_sensor_myzone"
|
entity_id = "binary_sensor.myzone_zone_open_with_sensor_myzone"
|
||||||
|
|
||||||
assert not hass.states.get(entity_id)
|
assert not hass.states.get(entity_id)
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ async def test_binary_sensor_async_setup_entry(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z01-myzone"
|
assert entry.unique_id == "uniqueid-ac1-z01-myzone"
|
||||||
|
|
||||||
# Test Second Motion Sensor (disabled by default)
|
# Test Second Motion Sensor (disabled by default)
|
||||||
entity_id = "binary_sensor.ac_one_zone_closed_with_sensor_myzone"
|
entity_id = "binary_sensor.myzone_zone_closed_with_sensor_myzone"
|
||||||
|
|
||||||
assert not hass.states.get(entity_id)
|
assert not hass.states.get(entity_id)
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ from json import loads
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.advantage_air.climate import (
|
from homeassistant.components.advantage_air.climate import (
|
||||||
|
ADVANTAGE_AIR_COOL_TARGET,
|
||||||
|
ADVANTAGE_AIR_HEAT_TARGET,
|
||||||
HASS_FAN_MODES,
|
HASS_FAN_MODES,
|
||||||
HASS_HVAC_MODES,
|
HASS_HVAC_MODES,
|
||||||
)
|
)
|
||||||
@ -14,8 +16,13 @@ from homeassistant.components.advantage_air.const import (
|
|||||||
ADVANTAGE_AIR_STATE_OPEN,
|
ADVANTAGE_AIR_STATE_OPEN,
|
||||||
)
|
)
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
|
ATTR_CURRENT_TEMPERATURE,
|
||||||
ATTR_FAN_MODE,
|
ATTR_FAN_MODE,
|
||||||
ATTR_HVAC_MODE,
|
ATTR_HVAC_MODE,
|
||||||
|
ATTR_MAX_TEMP,
|
||||||
|
ATTR_MIN_TEMP,
|
||||||
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
|
ATTR_TARGET_TEMP_LOW,
|
||||||
DOMAIN as CLIMATE_DOMAIN,
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
FAN_LOW,
|
FAN_LOW,
|
||||||
SERVICE_SET_FAN_MODE,
|
SERVICE_SET_FAN_MODE,
|
||||||
@ -58,20 +65,21 @@ async def test_climate_async_setup_entry(
|
|||||||
|
|
||||||
registry = er.async_get(hass)
|
registry = er.async_get(hass)
|
||||||
|
|
||||||
# Test Main Climate Entity
|
# Test MyZone Climate Entity
|
||||||
entity_id = "climate.ac_one"
|
entity_id = "climate.myzone"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == HVACMode.FAN_ONLY
|
assert state.state == HVACMode.FAN_ONLY
|
||||||
assert state.attributes.get("min_temp") == 16
|
assert state.attributes.get(ATTR_MIN_TEMP) == 16
|
||||||
assert state.attributes.get("max_temp") == 32
|
assert state.attributes.get(ATTR_MAX_TEMP) == 32
|
||||||
assert state.attributes.get("temperature") == 24
|
assert state.attributes.get(ATTR_TEMPERATURE) == 24
|
||||||
assert state.attributes.get("current_temperature") is None
|
assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) is None
|
||||||
|
|
||||||
entry = registry.async_get(entity_id)
|
entry = registry.async_get(entity_id)
|
||||||
assert entry
|
assert entry
|
||||||
assert entry.unique_id == "uniqueid-ac1"
|
assert entry.unique_id == "uniqueid-ac1"
|
||||||
|
|
||||||
|
# Test setting HVAC Mode
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_HVAC_MODE,
|
SERVICE_SET_HVAC_MODE,
|
||||||
@ -86,6 +94,7 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test Turning Off with HVAC Mode
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_HVAC_MODE,
|
SERVICE_SET_HVAC_MODE,
|
||||||
@ -99,6 +108,7 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test changing Fan Mode
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_FAN_MODE,
|
SERVICE_SET_FAN_MODE,
|
||||||
@ -112,6 +122,7 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test changing Temperature
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
@ -125,6 +136,7 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test Turning On
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
@ -138,6 +150,7 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test Turning Off
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
@ -152,24 +165,26 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
# Test Climate Zone Entity
|
# Test Climate Zone Entity
|
||||||
entity_id = "climate.ac_one_zone_open_with_sensor"
|
entity_id = "climate.myzone_zone_open_with_sensor"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes.get("min_temp") == 16
|
assert state.attributes.get(ATTR_MIN_TEMP) == 16
|
||||||
assert state.attributes.get("max_temp") == 32
|
assert state.attributes.get(ATTR_MAX_TEMP) == 32
|
||||||
assert state.attributes.get("temperature") == 24
|
assert state.attributes.get(ATTR_TEMPERATURE) == 24
|
||||||
assert state.attributes.get("current_temperature") == 25
|
assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 25
|
||||||
|
|
||||||
entry = registry.async_get(entity_id)
|
entry = registry.async_get(entity_id)
|
||||||
assert entry
|
assert entry
|
||||||
assert entry.unique_id == "uniqueid-ac1-z01"
|
assert entry.unique_id == "uniqueid-ac1-z01"
|
||||||
|
|
||||||
|
# Test Climate Zone On
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_HVAC_MODE,
|
SERVICE_SET_HVAC_MODE,
|
||||||
{ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.FAN_ONLY},
|
{ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.FAN_ONLY},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
@ -178,12 +193,14 @@ async def test_climate_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
|
# Test Climate Zone Off
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_HVAC_MODE,
|
SERVICE_SET_HVAC_MODE,
|
||||||
{ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.OFF},
|
{ATTR_ENTITY_ID: [entity_id], ATTR_HVAC_MODE: HVACMode.OFF},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
@ -197,36 +214,38 @@ async def test_climate_async_setup_entry(
|
|||||||
{ATTR_ENTITY_ID: [entity_id], ATTR_TEMPERATURE: 25},
|
{ATTR_ENTITY_ID: [entity_id], ATTR_TEMPERATURE: 25},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
await hass.services.async_call(
|
# Test MyAuto Climate Entity
|
||||||
CLIMATE_DOMAIN,
|
entity_id = "climate.myauto"
|
||||||
SERVICE_TURN_OFF,
|
state = hass.states.get(entity_id)
|
||||||
{ATTR_ENTITY_ID: [entity_id]},
|
assert state
|
||||||
blocking=True,
|
assert state.attributes.get(ATTR_TARGET_TEMP_LOW) == 20
|
||||||
)
|
assert state.attributes.get(ATTR_TARGET_TEMP_HIGH) == 24
|
||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
entry = registry.async_get(entity_id)
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
assert entry
|
||||||
assert data["ac1"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
assert entry.unique_id == "uniqueid-ac3"
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{ATTR_ENTITY_ID: [entity_id]},
|
{
|
||||||
|
ATTR_ENTITY_ID: [entity_id],
|
||||||
|
ATTR_TARGET_TEMP_LOW: 21,
|
||||||
|
ATTR_TARGET_TEMP_HIGH: 23,
|
||||||
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac1"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
assert data["ac3"]["info"][ADVANTAGE_AIR_HEAT_TARGET] == 21
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert data["ac3"]["info"][ADVANTAGE_AIR_COOL_TARGET] == 23
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
|
||||||
|
|
||||||
|
|
||||||
async def test_climate_async_failed_update(
|
async def test_climate_async_failed_update(
|
||||||
@ -248,7 +267,7 @@ async def test_climate_async_failed_update(
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{ATTR_ENTITY_ID: ["climate.ac_one"], ATTR_TEMPERATURE: 25},
|
{ATTR_ENTITY_ID: ["climate.myzone"], ATTR_TEMPERATURE: 25},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
|
@ -49,7 +49,7 @@ async def test_cover_async_setup_entry(
|
|||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
|
|
||||||
# Test Cover Zone Entity
|
# Test Cover Zone Entity
|
||||||
entity_id = "cover.ac_two_zone_open_without_sensor"
|
entity_id = "cover.myauto_zone_y"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OPEN
|
assert state.state == STATE_OPEN
|
||||||
@ -58,7 +58,7 @@ async def test_cover_async_setup_entry(
|
|||||||
|
|
||||||
entry = registry.async_get(entity_id)
|
entry = registry.async_get(entity_id)
|
||||||
assert entry
|
assert entry
|
||||||
assert entry.unique_id == "uniqueid-ac2-z01"
|
assert entry.unique_id == "uniqueid-ac3-z01"
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
@ -70,7 +70,7 @@ async def test_cover_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
@ -84,8 +84,8 @@ async def test_cover_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
||||||
assert data["ac2"]["zones"]["z01"]["value"] == 100
|
assert data["ac3"]["zones"]["z01"]["value"] == 100
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ async def test_cover_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["value"] == 50
|
assert data["ac3"]["zones"]["z01"]["value"] == 50
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ async def test_cover_async_setup_entry(
|
|||||||
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
assert aioclient_mock.mock_calls[-2][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
assert aioclient_mock.mock_calls[-2][1].path == "/setAircon"
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
||||||
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
assert aioclient_mock.mock_calls[-1][0] == "GET"
|
||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
@ -123,28 +123,28 @@ async def test_cover_async_setup_entry(
|
|||||||
SERVICE_CLOSE_COVER,
|
SERVICE_CLOSE_COVER,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: [
|
ATTR_ENTITY_ID: [
|
||||||
"cover.ac_two_zone_open_without_sensor",
|
"cover.myauto_zone_y",
|
||||||
"cover.ac_two_zone_closed_without_sensor",
|
"cover.myauto_zone_z",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert len(aioclient_mock.mock_calls) == 11
|
assert len(aioclient_mock.mock_calls) == 11
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
||||||
assert data["ac2"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
assert data["ac3"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_CLOSE
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
SERVICE_OPEN_COVER,
|
SERVICE_OPEN_COVER,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: [
|
ATTR_ENTITY_ID: [
|
||||||
"cover.ac_two_zone_open_without_sensor",
|
"cover.myauto_zone_y",
|
||||||
"cover.ac_two_zone_closed_without_sensor",
|
"cover.myauto_zone_z",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert len(aioclient_mock.mock_calls) == 13
|
assert len(aioclient_mock.mock_calls) == 13
|
||||||
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
data = loads(aioclient_mock.mock_calls[-2][1].query["json"])
|
||||||
assert data["ac2"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
assert data["ac3"]["zones"]["z01"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
||||||
assert data["ac2"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
assert data["ac3"]["zones"]["z02"]["state"] == ADVANTAGE_AIR_STATE_OPEN
|
||||||
|
@ -42,7 +42,7 @@ async def test_select_async_setup_entry(
|
|||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
|
|
||||||
# Test MyZone Select Entity
|
# Test MyZone Select Entity
|
||||||
entity_id = "select.ac_one_myzone"
|
entity_id = "select.myzone_myzone"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == "Zone open with Sensor"
|
assert state.state == "Zone open with Sensor"
|
||||||
|
@ -45,7 +45,7 @@ async def test_sensor_platform(
|
|||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
|
|
||||||
# Test First TimeToOn Sensor
|
# Test First TimeToOn Sensor
|
||||||
entity_id = "sensor.ac_one_time_to_on"
|
entity_id = "sensor.myzone_time_to_on"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 0
|
assert int(state.state) == 0
|
||||||
@ -70,7 +70,7 @@ async def test_sensor_platform(
|
|||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
# Test First TimeToOff Sensor
|
# Test First TimeToOff Sensor
|
||||||
entity_id = "sensor.ac_one_time_to_off"
|
entity_id = "sensor.myzone_time_to_off"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 10
|
assert int(state.state) == 10
|
||||||
@ -95,7 +95,7 @@ async def test_sensor_platform(
|
|||||||
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
assert aioclient_mock.mock_calls[-1][1].path == "/getSystemData"
|
||||||
|
|
||||||
# Test First Zone Vent Sensor
|
# Test First Zone Vent Sensor
|
||||||
entity_id = "sensor.ac_one_zone_open_with_sensor_vent"
|
entity_id = "sensor.myzone_zone_open_with_sensor_vent"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 100
|
assert int(state.state) == 100
|
||||||
@ -105,7 +105,7 @@ async def test_sensor_platform(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z01-vent"
|
assert entry.unique_id == "uniqueid-ac1-z01-vent"
|
||||||
|
|
||||||
# Test Second Zone Vent Sensor
|
# Test Second Zone Vent Sensor
|
||||||
entity_id = "sensor.ac_one_zone_closed_with_sensor_vent"
|
entity_id = "sensor.myzone_zone_closed_with_sensor_vent"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 0
|
assert int(state.state) == 0
|
||||||
@ -115,7 +115,7 @@ async def test_sensor_platform(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z02-vent"
|
assert entry.unique_id == "uniqueid-ac1-z02-vent"
|
||||||
|
|
||||||
# Test First Zone Signal Sensor
|
# Test First Zone Signal Sensor
|
||||||
entity_id = "sensor.ac_one_zone_open_with_sensor_signal"
|
entity_id = "sensor.myzone_zone_open_with_sensor_signal"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 40
|
assert int(state.state) == 40
|
||||||
@ -125,7 +125,7 @@ async def test_sensor_platform(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z01-signal"
|
assert entry.unique_id == "uniqueid-ac1-z01-signal"
|
||||||
|
|
||||||
# Test Second Zone Signal Sensor
|
# Test Second Zone Signal Sensor
|
||||||
entity_id = "sensor.ac_one_zone_closed_with_sensor_signal"
|
entity_id = "sensor.myzone_zone_closed_with_sensor_signal"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert int(state.state) == 10
|
assert int(state.state) == 10
|
||||||
@ -135,7 +135,7 @@ async def test_sensor_platform(
|
|||||||
assert entry.unique_id == "uniqueid-ac1-z02-signal"
|
assert entry.unique_id == "uniqueid-ac1-z02-signal"
|
||||||
|
|
||||||
# Test First Zone Temp Sensor (disabled by default)
|
# Test First Zone Temp Sensor (disabled by default)
|
||||||
entity_id = "sensor.ac_one_zone_open_with_sensor_temperature"
|
entity_id = "sensor.myzone_zone_open_with_sensor_temperature"
|
||||||
|
|
||||||
assert not hass.states.get(entity_id)
|
assert not hass.states.get(entity_id)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ async def test_cover_async_setup_entry(
|
|||||||
assert len(aioclient_mock.mock_calls) == 1
|
assert len(aioclient_mock.mock_calls) == 1
|
||||||
|
|
||||||
# Test Switch Entity
|
# Test Switch Entity
|
||||||
entity_id = "switch.ac_one_fresh_air"
|
entity_id = "switch.myzone_fresh_air"
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user