Merge pull request 'Fix SensorDeviceClass.PERCENTAGE removed in HA 2025+' (#137) from fix/sensor-device-class-percentage into main
Reviewed-on: #137
This commit was merged in pull request #137.
This commit is contained in:
@@ -25,7 +25,6 @@ from collections.abc import Callable, Iterable
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
SensorDeviceClass,
|
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
@@ -280,7 +279,6 @@ class NestQuestCompletionPctTodaySensor(_NestQuestChildDaySensor):
|
|||||||
"""The child's completion percentage for today (100 on a zero-quest day)."""
|
"""The child's completion percentage for today (100 on a zero-quest day)."""
|
||||||
|
|
||||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
_attr_device_class = SensorDeviceClass.PERCENTAGE
|
|
||||||
_attr_native_unit_of_measurement = "%"
|
_attr_native_unit_of_measurement = "%"
|
||||||
_name_suffix = "completion pct today"
|
_name_suffix = "completion pct today"
|
||||||
|
|
||||||
|
|||||||
@@ -58,19 +58,19 @@ def test_manifest_requirements(manifest: dict) -> None:
|
|||||||
|
|
||||||
def test_manifest_documentation_url_is_public_github_mirror(manifest: dict) -> None:
|
def test_manifest_documentation_url_is_public_github_mirror(manifest: dict) -> None:
|
||||||
"""Verify documentation URL points at the public GitHub mirror."""
|
"""Verify documentation URL points at the public GitHub mirror."""
|
||||||
assert manifest.get("documentation") == "https://github.com/talon2king/NestQuest"
|
assert manifest.get("documentation") == "https://github.com/Maniacs-Mansion/NestQuest"
|
||||||
|
|
||||||
|
|
||||||
def test_manifest_issue_tracker_url_is_public_github_mirror(manifest: dict) -> None:
|
def test_manifest_issue_tracker_url_is_public_github_mirror(manifest: dict) -> None:
|
||||||
"""Verify issue_tracker URL points at the public GitHub mirror."""
|
"""Verify issue_tracker URL points at the public GitHub mirror."""
|
||||||
assert manifest.get("issue_tracker") == "https://github.com/talon2king/NestQuest/issues"
|
assert manifest.get("issue_tracker") == "https://github.com/Maniacs-Mansion/NestQuest/issues"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("key", ["documentation", "issue_tracker"])
|
@pytest.mark.parametrize("key", ["documentation", "issue_tracker"])
|
||||||
def test_manifest_urls_use_github_com(manifest: dict, key: str) -> None:
|
def test_manifest_urls_use_github_com(manifest: dict, key: str) -> None:
|
||||||
"""Verify manifest URLs use github.com rather than the private Gitea host."""
|
"""Verify manifest URLs use github.com rather than the private Gitea host."""
|
||||||
url = manifest.get(key, "")
|
url = manifest.get(key, "")
|
||||||
assert url.startswith("https://github.com/talon2king/NestQuest")
|
assert url.startswith("https://github.com/Maniacs-Mansion/NestQuest")
|
||||||
assert "cubecraftlabs" not in url
|
assert "cubecraftlabs" not in url
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ async def test_every_active_child_gets_five_sensors_with_documented_identity(
|
|||||||
assert entity.native_unit_of_measurement is None
|
assert entity.native_unit_of_measurement is None
|
||||||
assert pct_entity.state_class == "measurement"
|
assert pct_entity.state_class == "measurement"
|
||||||
assert pct_entity.native_unit_of_measurement == "%"
|
assert pct_entity.native_unit_of_measurement == "%"
|
||||||
assert pct_entity.device_class == "percentage"
|
assert pct_entity.device_class is None
|
||||||
device_info = due_entity.device_info
|
device_info = due_entity.device_info
|
||||||
assert device_info.name == f"NestQuest {name}"
|
assert device_info.name == f"NestQuest {name}"
|
||||||
assert device_info.manufacturer == "NestQuest"
|
assert device_info.manufacturer == "NestQuest"
|
||||||
|
|||||||
Reference in New Issue
Block a user