diff --git a/homeassistant/components/alarm_control_panel/strings.json b/homeassistant/components/alarm_control_panel/strings.json index 5126f49d92b..1d8a29f7dd8 100644 --- a/homeassistant/components/alarm_control_panel/strings.json +++ b/homeassistant/components/alarm_control_panel/strings.json @@ -26,19 +26,21 @@ "armed_vacation": "{entity_name} armed vacation" } }, - "state": { + "entity_component": { "_": { - "armed": "Armed", - "disarmed": "Disarmed", - "armed_home": "Armed home", - "armed_away": "Armed away", - "armed_night": "Armed night", - "armed_vacation": "Armed vacation", - "armed_custom_bypass": "Armed custom bypass", - "pending": "Pending", - "arming": "Arming", - "disarming": "Disarming", - "triggered": "Triggered" + "state": { + "armed": "Armed", + "disarmed": "Disarmed", + "armed_home": "Armed home", + "armed_away": "Armed away", + "armed_night": "Armed night", + "armed_vacation": "Armed vacation", + "armed_custom_bypass": "Armed custom bypass", + "pending": "Pending", + "arming": "Arming", + "disarming": "Disarming", + "triggered": "Triggered" + } } } } diff --git a/homeassistant/components/alert/strings.json b/homeassistant/components/alert/strings.json index fb31ecd0577..9975e6ee0df 100644 --- a/homeassistant/components/alert/strings.json +++ b/homeassistant/components/alert/strings.json @@ -1,10 +1,12 @@ { "title": "Alert", - "state": { + "entity_component": { "_": { - "idle": "[%key:common::state::idle%]", - "off": "Acknowledged", - "on": "[%key:common::state::active%]" + "state": { + "idle": "[%key:common::state::idle%]", + "off": "Acknowledged", + "on": "[%key:common::state::active%]" + } } } } diff --git a/homeassistant/components/automation/strings.json b/homeassistant/components/automation/strings.json index ea03868e639..ffadc47a48c 100644 --- a/homeassistant/components/automation/strings.json +++ b/homeassistant/components/automation/strings.json @@ -1,9 +1,11 @@ { "title": "Automation", - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } }, "issues": { diff --git a/homeassistant/components/binary_sensor/strings.json b/homeassistant/components/binary_sensor/strings.json index 5d17fb92cb1..8d787204dba 100644 --- a/homeassistant/components/binary_sensor/strings.json +++ b/homeassistant/components/binary_sensor/strings.json @@ -106,114 +106,168 @@ "turned_off": "{entity_name} turned off" } }, - "state": { + "entity_component": { + "_": { + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } + }, "battery": { - "off": "Normal", - "on": "Low" + "state": { + "off": "Normal", + "on": "Low" + } }, "battery_charging": { - "off": "Not charging", - "on": "Charging" + "state": { + "off": "Not charging", + "on": "Charging" + } }, "carbon_monoxide": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[%key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "cold": { - "off": "[%key:component::binary_sensor::state::battery::off%]", - "on": "Cold" + "state": { + "off": "[%key:component::binary_sensor::entity_component::battery::state::off%]", + "on": "Cold" + } }, "connectivity": { - "off": "[%key:common::state::disconnected%]", - "on": "[%key:common::state::connected%]" + "state": { + "off": "[%key:common::state::disconnected%]", + "on": "[%key:common::state::connected%]" + } }, "door": { - "off": "[%key:common::state::closed%]", - "on": "[%key:common::state::open%]" + "state": { + "off": "[%key:common::state::closed%]", + "on": "[%key:common::state::open%]" + } }, "garage_door": { - "off": "[%key:common::state::closed%]", - "on": "[%key:common::state::open%]" + "state": { + "off": "[%key:common::state::closed%]", + "on": "[%key:common::state::open%]" + } }, "gas": { - "off": "Clear", - "on": "Detected" + "state": { + "off": "Clear", + "on": "Detected" + } }, "heat": { - "off": "[%key:component::binary_sensor::state::battery::off%]", - "on": "Hot" + "state": { + "off": "[%key:component::binary_sensor::entity_component::battery::state::off%]", + "on": "Hot" + } }, "light": { - "off": "No light", - "on": "Light detected" + "state": { + "off": "No light", + "on": "Light detected" + } }, "lock": { - "off": "[%key:common::state::locked%]", - "on": "[%key:common::state::unlocked%]" + "state": { + "off": "[%key:common::state::locked%]", + "on": "[%key:common::state::unlocked%]" + } }, "moisture": { - "off": "Dry", - "on": "Wet" + "state": { + "off": "Dry", + "on": "Wet" + } }, "motion": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "moving": { - "off": "Not moving", - "on": "Moving" + "state": { + "off": "Not moving", + "on": "Moving" + } }, "occupancy": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "opening": { - "off": "[%key:common::state::closed%]", - "on": "[%key:common::state::open%]" + "state": { + "off": "[%key:common::state::closed%]", + "on": "[%key:common::state::open%]" + } }, "plug": { - "off": "Unplugged", - "on": "Plugged in" + "state": { + "off": "Unplugged", + "on": "Plugged in" + } }, "presence": { - "off": "[%key:component::device_tracker::state::_::not_home%]", - "on": "[%key:component::device_tracker::state::_::home%]" + "state": { + "off": "[%key:component::device_tracker::entity_component::_::state::not_home%]", + "on": "[%key:component::device_tracker::entity_component::_::state::home%]" + } }, "problem": { - "off": "OK", - "on": "Problem" + "state": { + "off": "OK", + "on": "Problem" + } }, "running": { - "off": "Not running", - "on": "Running" + "state": { + "off": "Not running", + "on": "Running" + } }, "safety": { - "off": "Safe", - "on": "Unsafe" + "state": { + "off": "Safe", + "on": "Unsafe" + } }, "smoke": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "sound": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "update": { - "off": "Up-to-date", - "on": "Update available" + "state": { + "off": "Up-to-date", + "on": "Update available" + } }, "vibration": { - "off": "[%key:component::binary_sensor::state::gas::off%]", - "on": "[%key:component::binary_sensor::state::gas::on%]" + "state": { + "off": "[key:component::binary_sensor::entity_component::gas::state::off%]", + "on": "[key:component::binary_sensor::entity_component::gas::state::on%]" + } }, "window": { - "off": "[%key:common::state::closed%]", - "on": "[%key:common::state::open%]" - }, - "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::closed%]", + "on": "[%key:common::state::open%]" + } } }, "device_class": { diff --git a/homeassistant/components/calendar/strings.json b/homeassistant/components/calendar/strings.json index 3af9a78e607..bcc07bb7fcc 100644 --- a/homeassistant/components/calendar/strings.json +++ b/homeassistant/components/calendar/strings.json @@ -1,9 +1,11 @@ { "title": "Calendar", - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/camera/strings.json b/homeassistant/components/camera/strings.json index 3b8767ec8cd..5bde2ed2517 100644 --- a/homeassistant/components/camera/strings.json +++ b/homeassistant/components/camera/strings.json @@ -1,10 +1,12 @@ { "title": "Camera", - "state": { + "entity_component": { "_": { - "recording": "Recording", - "streaming": "Streaming", - "idle": "[%key:common::state::idle%]" + "state": { + "recording": "Recording", + "streaming": "Streaming", + "idle": "[%key:common::state::idle%]" + } } } } diff --git a/homeassistant/components/climate/strings.json b/homeassistant/components/climate/strings.json index 8c6c8f2d97a..16cf9a130bb 100644 --- a/homeassistant/components/climate/strings.json +++ b/homeassistant/components/climate/strings.json @@ -15,92 +15,92 @@ "set_preset_mode": "Change preset on {entity_name}" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "heat": "Heat", - "cool": "Cool", - "heat_cool": "Heat/Cool", - "auto": "Auto", - "dry": "Dry", - "fan_only": "Fan only" - } - }, - "state_attributes": { - "_": { - "aux_heat": { "name": "Aux heat" }, - "current_humidity": { "name": "Current humidity" }, - "current_temperature": { "name": "Current temperature" }, - "fan_mode": { - "name": "Fan mode", - "state": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]", - "auto": "Auto", - "low": "Low", - "medium": "Medium", - "high": "High", - "top": "Top", - "middle": "Middle", - "focus": "Focus", - "diffuse": "Diffuse" - } + "state": { + "off": "[%key:common::state::off%]", + "heat": "Heat", + "cool": "Cool", + "heat_cool": "Heat/Cool", + "auto": "Auto", + "dry": "Dry", + "fan_only": "Fan only" }, - "fan_modes": { - "name": "Fan modes" - }, - "humidity": { "name": "Target humidity" }, - "hvac_action": { - "name": "Current action", - "state": { - "off": "Off", - "heating": "Heating", - "cooling": "Cooling", - "drying": "Drying", - "idle": "Idle", - "fan": "Fan" - } - }, - "hvac_modes": { - "name": "HVAC modes" - }, - "max_humidity": { "name": "Max target humidity" }, - "max_temp": { "name": "Max target temperature" }, - "min_humidity": { "name": "Min target humidity" }, - "min_temp": { "name": "Min target temperature" }, - "preset_mode": { - "name": "Preset", - "state": { - "none": "None", - "eco": "Eco", - "away": "Away", - "boost": "Boost", - "comfort": "Comfort", - "home": "Home", - "sleep": "Sleep", - "activity": "Activity" - } - }, - "preset_modes": { - "name": "Presets" - }, - "swing_mode": { - "name": "Swing mode", - "state": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]", - "both": "Both", - "vertical": "Vertical", - "horizontal": "Horizontal" - } - }, - "swing_modes": { - "name": "Swing modes" - }, - "target_temp_high": { "name": "Upper target temperature" }, - "target_temp_low": { "name": "Lower target temperature" }, - "target_temp_step": { "name": "Target temperature step" }, - "temperature": { "name": "Target temperature" } + "state_attributes": { + "aux_heat": { "name": "Aux heat" }, + "current_humidity": { "name": "Current humidity" }, + "current_temperature": { "name": "Current temperature" }, + "fan_mode": { + "name": "Fan mode", + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]", + "auto": "Auto", + "low": "Low", + "medium": "Medium", + "high": "High", + "top": "Top", + "middle": "Middle", + "focus": "Focus", + "diffuse": "Diffuse" + } + }, + "fan_modes": { + "name": "Fan modes" + }, + "humidity": { "name": "Target humidity" }, + "hvac_action": { + "name": "Current action", + "state": { + "off": "Off", + "heating": "Heating", + "cooling": "Cooling", + "drying": "Drying", + "idle": "Idle", + "fan": "Fan" + } + }, + "hvac_modes": { + "name": "HVAC modes" + }, + "max_humidity": { "name": "Max target humidity" }, + "max_temp": { "name": "Max target temperature" }, + "min_humidity": { "name": "Min target humidity" }, + "min_temp": { "name": "Min target temperature" }, + "preset_mode": { + "name": "Preset", + "state": { + "none": "None", + "eco": "Eco", + "away": "Away", + "boost": "Boost", + "comfort": "Comfort", + "home": "Home", + "sleep": "Sleep", + "activity": "Activity" + } + }, + "preset_modes": { + "name": "Presets" + }, + "swing_mode": { + "name": "Swing mode", + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]", + "both": "Both", + "vertical": "Vertical", + "horizontal": "Horizontal" + } + }, + "swing_modes": { + "name": "Swing modes" + }, + "target_temp_high": { "name": "Upper target temperature" }, + "target_temp_low": { "name": "Lower target temperature" }, + "target_temp_step": { "name": "Target temperature step" }, + "temperature": { "name": "Target temperature" } + } } } } diff --git a/homeassistant/components/configurator/strings.json b/homeassistant/components/configurator/strings.json index 570c18d3cde..c48f1d83858 100644 --- a/homeassistant/components/configurator/strings.json +++ b/homeassistant/components/configurator/strings.json @@ -1,9 +1,11 @@ { "title": "Configurator", - "state": { + "entity_component": { "_": { - "configure": "Configure", - "configured": "Configured" + "state": { + "configure": "Configure", + "configured": "Configured" + } } } } diff --git a/homeassistant/components/cover/strings.json b/homeassistant/components/cover/strings.json index cb98c542d43..d17508b71db 100644 --- a/homeassistant/components/cover/strings.json +++ b/homeassistant/components/cover/strings.json @@ -27,13 +27,15 @@ "tilt_position": "{entity_name} tilt position changes" } }, - "state": { + "entity_component": { "_": { - "open": "[%key:common::state::open%]", - "opening": "Opening", - "closed": "[%key:common::state::closed%]", - "closing": "Closing", - "stopped": "Stopped" + "state": { + "open": "[%key:common::state::open%]", + "opening": "Opening", + "closed": "[%key:common::state::closed%]", + "closing": "Closing", + "stopped": "Stopped" + } } } } diff --git a/homeassistant/components/device_tracker/strings.json b/homeassistant/components/device_tracker/strings.json index 48cb667e730..a1c50c88f86 100644 --- a/homeassistant/components/device_tracker/strings.json +++ b/homeassistant/components/device_tracker/strings.json @@ -10,10 +10,12 @@ "leaves": "{entity_name} leaves a zone" } }, - "state": { + "entity_component": { "_": { - "home": "[%key:common::state::home%]", - "not_home": "[%key:common::state::not_home%]" + "state": { + "home": "[%key:common::state::home%]", + "not_home": "[%key:common::state::not_home%]" + } } } } diff --git a/homeassistant/components/fan/strings.json b/homeassistant/components/fan/strings.json index fdd95a822de..670d11b76ba 100644 --- a/homeassistant/components/fan/strings.json +++ b/homeassistant/components/fan/strings.json @@ -16,10 +16,12 @@ "turn_off": "Turn off {entity_name}" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/group/strings.json b/homeassistant/components/group/strings.json index 75a2423d932..17f63167dbe 100644 --- a/homeassistant/components/group/strings.json +++ b/homeassistant/components/group/strings.json @@ -155,18 +155,20 @@ } } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]", - "home": "[%key:component::device_tracker::state::_::home%]", - "not_home": "[%key:component::device_tracker::state::_::not_home%]", - "open": "[%key:common::state::open%]", - "closed": "[%key:common::state::closed%]", - "locked": "[%key:common::state::locked%]", - "unlocked": "[%key:common::state::unlocked%]", - "ok": "[%key:component::binary_sensor::state::problem::off%]", - "problem": "[%key:component::binary_sensor::state::problem::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]", + "home": "[%key:component::device_tracker::entity_component::_::state::home%]", + "not_home": "[%key:component::device_tracker::entity_component::_::state::not_home%]", + "open": "[%key:common::state::open%]", + "closed": "[%key:common::state::closed%]", + "locked": "[%key:common::state::locked%]", + "unlocked": "[%key:common::state::unlocked%]", + "ok": "[%key:component::binary_sensor::entity_component::problem::state::off%]", + "problem": "[%key:component::binary_sensor::entity_component::problem::state::on%]" + } } } } diff --git a/homeassistant/components/humidifier/strings.json b/homeassistant/components/humidifier/strings.json index 46e2fc16055..e536def1677 100644 --- a/homeassistant/components/humidifier/strings.json +++ b/homeassistant/components/humidifier/strings.json @@ -20,10 +20,12 @@ "turn_off": "Turn off {entity_name}" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/input_boolean/strings.json b/homeassistant/components/input_boolean/strings.json index a32958592f2..509799b5ed3 100644 --- a/homeassistant/components/input_boolean/strings.json +++ b/homeassistant/components/input_boolean/strings.json @@ -1,9 +1,11 @@ { "title": "Input boolean", - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/light/strings.json b/homeassistant/components/light/strings.json index ee1f8e13b61..38f843ab1dc 100644 --- a/homeassistant/components/light/strings.json +++ b/homeassistant/components/light/strings.json @@ -19,10 +19,12 @@ "turned_off": "{entity_name} turned off" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/lock/strings.json b/homeassistant/components/lock/strings.json index 9e4c4ea726a..ab7a1632ea7 100644 --- a/homeassistant/components/lock/strings.json +++ b/homeassistant/components/lock/strings.json @@ -15,10 +15,12 @@ "unlocked": "{entity_name} unlocked" } }, - "state": { + "entity_component": { "_": { - "locked": "[%key:common::state::locked%]", - "unlocked": "[%key:common::state::unlocked%]" + "state": { + "locked": "[%key:common::state::locked%]", + "unlocked": "[%key:common::state::unlocked%]" + } } } } diff --git a/homeassistant/components/media_player/strings.json b/homeassistant/components/media_player/strings.json index bb6c7d16f5a..2c8f3d3d2bd 100644 --- a/homeassistant/components/media_player/strings.json +++ b/homeassistant/components/media_player/strings.json @@ -19,15 +19,17 @@ "changed_states": "{entity_name} changed states" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]", - "playing": "Playing", - "paused": "[%key:common::state::paused%]", - "idle": "[%key:common::state::idle%]", - "standby": "[%key:common::state::standby%]", - "buffering": "Buffering" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]", + "playing": "Playing", + "paused": "[%key:common::state::paused%]", + "idle": "[%key:common::state::idle%]", + "standby": "[%key:common::state::standby%]", + "buffering": "Buffering" + } } } } diff --git a/homeassistant/components/person/strings.json b/homeassistant/components/person/strings.json index c94499d92f5..7bba0198a14 100644 --- a/homeassistant/components/person/strings.json +++ b/homeassistant/components/person/strings.json @@ -1,9 +1,11 @@ { "title": "Person", - "state": { + "entity_component": { "_": { - "home": "[%key:common::state::home%]", - "not_home": "[%key:common::state::not_home%]" + "state": { + "home": "[%key:common::state::home%]", + "not_home": "[%key:common::state::not_home%]" + } } } } diff --git a/homeassistant/components/plant/strings.json b/homeassistant/components/plant/strings.json index 2478564ca88..5ece766c71a 100644 --- a/homeassistant/components/plant/strings.json +++ b/homeassistant/components/plant/strings.json @@ -1,9 +1,11 @@ { "title": "Plant Monitor", - "state": { + "entity_component": { "_": { - "ok": "[%key:component::binary_sensor::state::problem::off%]", - "problem": "[%key:component::binary_sensor::state::problem::on%]" + "state": { + "ok": "[%key:component::binary_sensor::entity_component::problem::state::off%]", + "problem": "[%key:component::binary_sensor::entity_component::problem::state::on%]" + } } } } diff --git a/homeassistant/components/remote/strings.json b/homeassistant/components/remote/strings.json index 4a2b20c65de..a558cc76fe0 100644 --- a/homeassistant/components/remote/strings.json +++ b/homeassistant/components/remote/strings.json @@ -16,10 +16,12 @@ "turned_off": "{entity_name} turned off" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/schedule/strings.json b/homeassistant/components/schedule/strings.json index fdcb8c4ffdc..ecc673805c2 100644 --- a/homeassistant/components/schedule/strings.json +++ b/homeassistant/components/schedule/strings.json @@ -1,9 +1,11 @@ { "title": "Schedule", - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/script/strings.json b/homeassistant/components/script/strings.json index 2d39b6ac633..a4ea0860067 100644 --- a/homeassistant/components/script/strings.json +++ b/homeassistant/components/script/strings.json @@ -1,9 +1,11 @@ { "title": "Script", - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/sensor/strings.json b/homeassistant/components/sensor/strings.json index 2396bbf295b..4b764c609c0 100644 --- a/homeassistant/components/sensor/strings.json +++ b/homeassistant/components/sensor/strings.json @@ -94,10 +94,12 @@ "wind_speed": "{entity_name} wind speed changes" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/sun/strings.json b/homeassistant/components/sun/strings.json index cdcaa416eda..d8a75224f62 100644 --- a/homeassistant/components/sun/strings.json +++ b/homeassistant/components/sun/strings.json @@ -10,10 +10,12 @@ "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" } }, - "state": { + "entity_component": { "_": { - "above_horizon": "Above horizon", - "below_horizon": "Below horizon" + "state": { + "above_horizon": "Above horizon", + "below_horizon": "Below horizon" + } } } } diff --git a/homeassistant/components/switch/strings.json b/homeassistant/components/switch/strings.json index 7ea84e649ef..ba7c5c6848f 100644 --- a/homeassistant/components/switch/strings.json +++ b/homeassistant/components/switch/strings.json @@ -16,10 +16,12 @@ "turned_off": "{entity_name} turned off" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]" + "state": { + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]" + } } } } diff --git a/homeassistant/components/timer/strings.json b/homeassistant/components/timer/strings.json index 985cea0aa6e..914ee738354 100644 --- a/homeassistant/components/timer/strings.json +++ b/homeassistant/components/timer/strings.json @@ -1,9 +1,11 @@ { - "state": { + "entity_component": { "_": { - "active": "[%key:common::state::active%]", - "idle": "[%key:common::state::idle%]", - "paused": "[%key:common::state::paused%]" + "state": { + "active": "[%key:common::state::active%]", + "idle": "[%key:common::state::idle%]", + "paused": "[%key:common::state::paused%]" + } } } } diff --git a/homeassistant/components/vacuum/strings.json b/homeassistant/components/vacuum/strings.json index 033946735f7..eb84b910b45 100644 --- a/homeassistant/components/vacuum/strings.json +++ b/homeassistant/components/vacuum/strings.json @@ -14,16 +14,18 @@ "dock": "Let {entity_name} return to the dock" } }, - "state": { + "entity_component": { "_": { - "cleaning": "Cleaning", - "docked": "Docked", - "error": "Error", - "idle": "[%key:common::state::idle%]", - "off": "[%key:common::state::off%]", - "on": "[%key:common::state::on%]", - "paused": "[%key:common::state::paused%]", - "returning": "Returning to dock" + "state": { + "cleaning": "Cleaning", + "docked": "Docked", + "error": "Error", + "idle": "[%key:common::state::idle%]", + "off": "[%key:common::state::off%]", + "on": "[%key:common::state::on%]", + "paused": "[%key:common::state::paused%]", + "returning": "Returning to dock" + } } } } diff --git a/homeassistant/components/water_heater/strings.json b/homeassistant/components/water_heater/strings.json index 3d9ab67eab4..9e3eec86041 100644 --- a/homeassistant/components/water_heater/strings.json +++ b/homeassistant/components/water_heater/strings.json @@ -5,15 +5,17 @@ "turn_off": "Turn off {entity_name}" } }, - "state": { + "entity_component": { "_": { - "off": "[%key:common::state::off%]", - "eco": "Eco", - "electric": "Electric", - "gas": "Gas", - "high_demand": "High Demand", - "heat_pump": "Heat Pump", - "performance": "Performance" + "state": { + "off": "[%key:common::state::off%]", + "eco": "Eco", + "electric": "Electric", + "gas": "Gas", + "high_demand": "High Demand", + "heat_pump": "Heat Pump", + "performance": "Performance" + } } } } diff --git a/homeassistant/components/weather/strings.json b/homeassistant/components/weather/strings.json index c4764beb5b6..b3af53a91c4 100644 --- a/homeassistant/components/weather/strings.json +++ b/homeassistant/components/weather/strings.json @@ -1,21 +1,23 @@ { - "state": { + "entity_component": { "_": { - "clear-night": "Clear, night", - "cloudy": "Cloudy", - "exceptional": "Exceptional", - "fog": "Fog", - "hail": "Hail", - "lightning": "Lightning", - "lightning-rainy": "Lightning, rainy", - "partlycloudy": "Partly cloudy", - "pouring": "Pouring", - "rainy": "Rainy", - "snowy": "Snowy", - "snowy-rainy": "Snowy, rainy", - "sunny": "Sunny", - "windy": "Windy", - "windy-variant": "Windy" + "state": { + "clear-night": "Clear, night", + "cloudy": "Cloudy", + "exceptional": "Exceptional", + "fog": "Fog", + "hail": "Hail", + "lightning": "Lightning", + "lightning-rainy": "Lightning, rainy", + "partlycloudy": "Partly cloudy", + "pouring": "Pouring", + "rainy": "Rainy", + "snowy": "Snowy", + "snowy-rainy": "Snowy, rainy", + "sunny": "Sunny", + "windy": "Windy", + "windy-variant": "Windy" + } } } } diff --git a/homeassistant/helpers/translation.py b/homeassistant/helpers/translation.py index 7ccbea3653d..96ce9b618c2 100644 --- a/homeassistant/helpers/translation.py +++ b/homeassistant/helpers/translation.py @@ -255,13 +255,16 @@ class _TranslationCache: categories.update(resource) for category in categories: - resource_func = ( - _merge_resources if category == "state" else _build_resources - ) new_resources: Mapping[str, dict[str, Any] | str] - new_resources = resource_func( # type: ignore[assignment] - translation_strings, components, category - ) + + if category in ("state", "entity_component"): + new_resources = _merge_resources( + translation_strings, components, category + ) + else: + new_resources = _build_resources( + translation_strings, components, category + ) for component, resource in new_resources.items(): category_cache: dict[str, Any] = cached.setdefault( @@ -299,7 +302,7 @@ async def async_get_translations( components = set(integrations) elif config_flow: components = (await async_get_config_flows(hass)) - hass.config.components - elif category == "state": + elif category in ("state", "entity_component"): components = set(hass.config.components) else: # Only 'state' supports merging, so remove platforms from selection diff --git a/script/hassfest/translations.py b/script/hassfest/translations.py index 92a1047c304..eb51d12c374 100644 --- a/script/hassfest/translations.py +++ b/script/hassfest/translations.py @@ -231,25 +231,6 @@ def gen_strings_schema(config: Config, integration: Integration) -> vol.Schema: vol.Optional("trigger_type"): {str: cv.string_with_no_html}, vol.Optional("trigger_subtype"): {str: cv.string_with_no_html}, }, - vol.Optional("state"): cv.schema_with_slug_keys( - cv.schema_with_slug_keys( - cv.string_with_no_html, slug_validator=translation_key_validator - ), - slug_validator=vol.Any("_", cv.slug), - ), - vol.Optional("state_attributes"): cv.schema_with_slug_keys( - cv.schema_with_slug_keys( - { - vol.Optional("name"): str, - vol.Optional("state"): cv.schema_with_slug_keys( - cv.string_with_no_html, - slug_validator=translation_key_validator, - ), - }, - slug_validator=translation_key_validator, - ), - slug_validator=vol.Any("_", cv.slug), - ), vol.Optional("system_health"): { vol.Optional("info"): cv.schema_with_slug_keys( cv.string_with_no_html, slug_validator=translation_key_validator @@ -283,26 +264,48 @@ def gen_strings_schema(config: Config, integration: Integration) -> vol.Schema: ), ) }, - vol.Optional("entity"): { - str: { - str: { + vol.Optional("entity_component"): cv.schema_with_slug_keys( + { + vol.Optional("state"): cv.schema_with_slug_keys( + cv.string_with_no_html, + slug_validator=translation_key_validator, + ), + vol.Optional("state_attributes"): cv.schema_with_slug_keys( + { + vol.Optional("name"): str, + vol.Optional("state"): cv.schema_with_slug_keys( + cv.string_with_no_html, + slug_validator=translation_key_validator, + ), + }, + slug_validator=translation_key_validator, + ), + }, + slug_validator=vol.Any("_", cv.slug), + ), + vol.Optional("entity"): cv.schema_with_slug_keys( + cv.schema_with_slug_keys( + { vol.Optional("name"): cv.string_with_no_html, - vol.Optional("state_attributes"): { - str: { + vol.Optional("state"): cv.schema_with_slug_keys( + cv.string_with_no_html, + slug_validator=translation_key_validator, + ), + vol.Optional("state_attributes"): cv.schema_with_slug_keys( + { vol.Optional("name"): cv.string_with_no_html, vol.Optional("state"): cv.schema_with_slug_keys( cv.string_with_no_html, slug_validator=translation_key_validator, ), - } - }, - vol.Optional("state"): cv.schema_with_slug_keys( - cv.string_with_no_html, + }, slug_validator=translation_key_validator, ), - } - } - }, + }, + slug_validator=translation_key_validator, + ), + slug_validator=cv.slug, + ), } ) diff --git a/tests/helpers/test_translation.py b/tests/helpers/test_translation.py index 25f1a742664..197053ba2b8 100644 --- a/tests/helpers/test_translation.py +++ b/tests/helpers/test_translation.py @@ -373,32 +373,32 @@ async def test_caching(hass: HomeAssistant) -> None: "homeassistant.helpers.translation._merge_resources", side_effect=translation._merge_resources, ) as mock_merge: - load1 = await translation.async_get_translations(hass, "en", "state") + load1 = await translation.async_get_translations(hass, "en", "entity_component") assert len(mock_merge.mock_calls) == 1 - load2 = await translation.async_get_translations(hass, "en", "state") + load2 = await translation.async_get_translations(hass, "en", "entity_component") assert len(mock_merge.mock_calls) == 1 assert load1 == load2 for key in load1: - assert key.startswith("component.sensor.state.") or key.startswith( - "component.light.state." - ) + assert key.startswith( + "component.sensor.entity_component._.state." + ) or key.startswith("component.light.entity_component._.state.") load_sensor_only = await translation.async_get_translations( - hass, "en", "state", integrations={"sensor"} + hass, "en", "entity_component", integrations={"sensor"} ) assert load_sensor_only for key in load_sensor_only: - assert key.startswith("component.sensor.state.") + assert key.startswith("component.sensor.entity_component._.state.") load_light_only = await translation.async_get_translations( - hass, "en", "state", integrations={"light"} + hass, "en", "entity_component", integrations={"light"} ) assert load_light_only for key in load_light_only: - assert key.startswith("component.light.state.") + assert key.startswith("component.light.entity_component._.state.") hass.config.components.add("media_player")