From 4add346272e6af00083c27a0de6cd1c7604f2044 Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sun, 29 Jun 2025 20:00:16 +0200 Subject: [PATCH] Deduplicate strings and fix sentence-casing in `proximity` (#147777) * Deduplicate strings and fix sentence-casing in `proximity` * Update test_init.py --- .../components/proximity/strings.json | 24 +++++++++---------- tests/components/proximity/test_init.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/proximity/strings.json b/homeassistant/components/proximity/strings.json index 5f713174f50..fa3be70f247 100644 --- a/homeassistant/components/proximity/strings.json +++ b/homeassistant/components/proximity/strings.json @@ -1,13 +1,13 @@ { "title": "Proximity", "config": { - "flow_title": "Proximity", + "flow_title": "[%key:component::proximity::title%]", "step": { "user": { "data": { "zone": "Zone to track distance to", "ignored_zones": "Zones to ignore", - "tracked_entities": "Devices or Persons to track", + "tracked_entities": "Devices or persons to track", "tolerance": "Tolerance distance" } } @@ -21,10 +21,10 @@ "step": { "init": { "data": { - "zone": "Zone to track distance to", - "ignored_zones": "Zones to ignore", - "tracked_entities": "Devices or Persons to track", - "tolerance": "Tolerance distance" + "zone": "[%key:component::proximity::config::step::user::data::zone%]", + "ignored_zones": "[%key:component::proximity::config::step::user::data::ignored_zones%]", + "tracked_entities": "[%key:component::proximity::config::step::user::data::tracked_entities%]", + "tolerance": "[%key:component::proximity::config::step::user::data::tolerance%]" } } } @@ -32,7 +32,7 @@ "entity": { "sensor": { "dir_of_travel": { - "name": "{tracked_entity} Direction of travel", + "name": "{tracked_entity} direction of travel", "state": { "arrived": "Arrived", "away_from": "Away from", @@ -40,15 +40,15 @@ "towards": "Towards" } }, - "dist_to_zone": { "name": "{tracked_entity} Distance" }, + "dist_to_zone": { "name": "{tracked_entity} distance" }, "nearest": { "name": "Nearest device" }, "nearest_dir_of_travel": { "name": "Nearest direction of travel", "state": { - "arrived": "Arrived", - "away_from": "Away from", - "stationary": "Stationary", - "towards": "Towards" + "arrived": "[%key:component::proximity::entity::sensor::dir_of_travel::state::arrived%]", + "away_from": "[%key:component::proximity::entity::sensor::dir_of_travel::state::away_from%]", + "stationary": "[%key:component::proximity::entity::sensor::dir_of_travel::state::stationary%]", + "towards": "[%key:component::proximity::entity::sensor::dir_of_travel::state::towards%]" } }, "nearest_dist_to_zone": { "name": "Nearest distance" } diff --git a/tests/components/proximity/test_init.py b/tests/components/proximity/test_init.py index e9340014207..22783c0598a 100644 --- a/tests/components/proximity/test_init.py +++ b/tests/components/proximity/test_init.py @@ -871,7 +871,7 @@ async def test_sensor_unique_ids( assert entity assert entity.unique_id == f"{mock_config.entry_id}_{t1.id}_dist_to_zone" state = hass.states.get(sensor_t1) - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Home Test tracker 1 Distance" + assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Home Test tracker 1 distance" entity = entity_registry.async_get("sensor.home_test2_distance") assert entity