def test_properties(mqtt_client: MockedMQTT): """Test properties of Pure Hot+Cool Link.""" device = DysonPureHotCoolLink(SERIAL, CREDENTIAL, DEVICE_TYPE) device.connect(HOST) # Status assert device.focus_mode is True new_status = {"product-state": {"ffoc": ["ON", "OFF"]}} mqtt_client.state_change(new_status) assert device.focus_mode is False
async def test_state(hass: HomeAssistant, device: DysonPureHotCoolLink): attributes = hass.states.get(ENTITY_ID).attributes assert attributes[ATTR_FAN_MODE] == FAN_DIFFUSE assert attributes[ATTR_FAN_MODES] == FAN_MODES assert attributes[ATTR_SUPPORTED_FEATURES] == SUPPORT_FLAGS_LINK device.focus_mode = True await update_device(hass, device, MessageType.STATE) attributes = hass.states.get(ENTITY_ID).attributes assert attributes[ATTR_FAN_MODE] == FAN_FOCUS
def test_set_heat_target_invalid_value(mqtt_client: MockedMQTT, heat_target: float): """Test set heat target with invalid value.""" device = DysonPureHotCoolLink(SERIAL, CREDENTIAL, DEVICE_TYPE) device.connect(HOST) with pytest.raises(ValueError): device.set_heat_target(heat_target) assert len(mqtt_client.commands) == 0
def test_command( mqtt_client: MockedMQTT, command: str, command_args: list, msg_data: dict, ): """Test commands of Pure Hot+Cool Link.""" assert_command( DysonPureHotCoolLink(SERIAL, CREDENTIAL, DEVICE_TYPE), mqtt_client, command, command_args, msg_data, )
def test_properties(mqtt_client: MockedMQTT): """Test properties of heating device.""" device = DysonPureHotCoolLink(SERIAL, CREDENTIAL, DEVICE_TYPE) device.connect(HOST) # Status assert device.tilt is False assert device.heat_target == 280.5 assert device.heat_mode_is_on is True assert device.heat_status_is_on is True new_status = { "product-state": { "tilt": ["OK", "TILT"], "hmax": ["2805", "2755"], "hmod": ["HEAT", "OFF"], "hsta": ["HEAT", "OFF"], } } mqtt_client.state_change(new_status) assert device.tilt is True assert device.heat_target == 275.5 assert device.heat_mode_is_on is False assert device.heat_status_is_on is False