Skip to content

Commit

Permalink
Address none being appended to humidifer entity id
Browse files Browse the repository at this point in the history
  • Loading branch information
iprak committed Jan 5, 2025
1 parent 3e68403 commit db8cfe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions homeassistant/components/vesync/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def _get_vs_mode(ha_mode: str) -> str | None:
class VeSyncHumidifierHA(VeSyncDevice, HumidifierEntity):
"""Representation of a VeSync humidifier."""

# The base VeSyncBaseEntity has _attr_has_entity_name and this is to prevent
# none being appended to entity id.
_attr_name = ""

_attr_max_humidity = MAX_HUMIDITY
_attr_min_humidity = MIN_HUMIDITY
_attr_supported_features: HumidifierEntityFeature = HumidifierEntityFeature(
Expand Down
12 changes: 6 additions & 6 deletions tests/components/vesync/test_humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def test_humidifier_state(
) -> None:
"""Test the resulting setup state is as expected for the platform."""

humidifier_id = "humidifier.humidifier_200s_none"
humidifier_id = "humidifier.humidifier_200s"
expected_entities = [
humidifier_id,
"switch.humidifier_200s_auto_mode",
Expand Down Expand Up @@ -64,7 +64,7 @@ async def test_set_target_humidity_invalid(
) -> None:
"""Test handling of invalid value in set_humidify method."""

humidifier_entity_id = "humidifier.humidifier_200s_none"
humidifier_entity_id = "humidifier.humidifier_200s"

# Setting value out of range results in ServiceValidationError and
# VeSyncHumid200300S.set_humidity does not get called.
Expand Down Expand Up @@ -98,7 +98,7 @@ async def test_set_target_humidity_VeSync(
) -> None:
"""Test handling of return value from VeSyncHumid200300S.set_humidity."""

humidifier_entity_id = "humidifier.humidifier_200s_none"
humidifier_entity_id = "humidifier.humidifier_200s"

# If VeSyncHumid200300S.set_humidity fails (returns False), then ValueError is raised
# and schedule_update_ha_state is not called.
Expand Down Expand Up @@ -136,7 +136,7 @@ async def test_turn_on_off(
) -> None:
"""Test turn_on/off methods."""

humidifier_entity_id = "humidifier.humidifier_200s_none"
humidifier_entity_id = "humidifier.humidifier_200s"

# turn_on/turn_off returns False indicating failure in which case humidifier.turn_on/turn_off
# raises ValueError. HA state update is scheduled for success.
Expand Down Expand Up @@ -169,7 +169,7 @@ async def test_set_mode_invalid(
) -> None:
"""Test handling of invalid value in set_mode method."""

humidifier_entity_id = "humidifier.humidifier_200s_none"
humidifier_entity_id = "humidifier.humidifier_200s"

# Setting invalid value results in ServiceValidationError and
# VeSyncHumid200300S.set_humidity_mode does not get called.
Expand Down Expand Up @@ -203,7 +203,7 @@ async def test_set_mode_VeSync(
) -> None:
"""Test handling of value in set_mode method."""

humidifier_entity_id = "humidifier.humidifier_200s_none"
humidifier_entity_id = "humidifier.humidifier_200s"

# If VeSyncHumid200300S.set_humidity_mode itself fails, then we should get ValueError
expectation = nullcontext() if success else pytest.raises(ValueError)
Expand Down

0 comments on commit db8cfe0

Please sign in to comment.