Add entity translation strings for ScreenLogic (#130708)

* Add translation strings for entities

* Translation key updates

* Mach original name

* Remove state translations

* Sentence case entity names

* Fix tests

* Add missing translation_key for Air temperature

* Revert inadvertant entity_id change on last_dose_time sensors

* Update homeassistant/components/screenlogic/strings.json

Lowercase 'entry'

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Define translations for each circuit delay sensor

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
pull/133570/head
Kevin Worrel 2024-12-21 00:25:21 -08:00 committed by GitHub
parent 861d9b3341
commit e38a85da64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 207 additions and 9 deletions

View File

@ -49,26 +49,31 @@ SUPPORTED_CORE_SENSORS = [
data_root=(DEVICE.CONTROLLER, GROUP.SENSOR),
key=VALUE.ACTIVE_ALERT,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="active_alert",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.STATUS_CHANGED,
data_root=(DEVICE.CONTROLLER, GROUP.SENSOR),
key=VALUE.CLEANER_DELAY,
translation_key="cleaner_delay",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.STATUS_CHANGED,
data_root=(DEVICE.CONTROLLER, GROUP.SENSOR),
key=VALUE.FREEZE_MODE,
translation_key="freeze_mode",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.STATUS_CHANGED,
data_root=(DEVICE.CONTROLLER, GROUP.SENSOR),
key=VALUE.POOL_DELAY,
translation_key="pool_delay",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.STATUS_CHANGED,
data_root=(DEVICE.CONTROLLER, GROUP.SENSOR),
key=VALUE.SPA_DELAY,
translation_key="spa_delay",
),
]
@ -85,75 +90,96 @@ SUPPORTED_INTELLICHEM_SENSORS = [
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.FLOW_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="flow_alarm",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.ORP_HIGH_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_high_alarm",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.ORP_LOW_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_low_alarm",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.ORP_SUPPLY_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_supply_alarm",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.PH_HIGH_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_high_alarm",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.PH_LOW_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_low_alarm",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.PH_SUPPLY_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="chem_supply_alarm",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALARM),
key=VALUE.PROBE_FAULT_ALARM,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="probe_fault_alarm",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALERT),
key=VALUE.ORP_LIMIT,
translation_key="chem_limit",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALERT),
key=VALUE.PH_LIMIT,
translation_key="chem_limit",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.ALERT),
key=VALUE.PH_LOCKOUT,
translation_key="ph_lockout",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.WATER_BALANCE),
key=VALUE.CORROSIVE,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="corosive",
),
ScreenLogicPushBinarySensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.WATER_BALANCE),
key=VALUE.SCALING,
device_class=BinarySensorDeviceClass.PROBLEM,
translation_key="scaling",
),
]
@ -161,6 +187,7 @@ SUPPORTED_SCG_SENSORS = [
ScreenLogicBinarySensorDescription(
data_root=(DEVICE.SCG, GROUP.SENSOR),
key=VALUE.STATE,
translation_key="scg_state",
)
]

View File

@ -56,6 +56,7 @@ async def async_setup_entry(
subscription_code=CODE.STATUS_CHANGED,
data_root=(DEVICE.BODY,),
key=body_index,
translation_key=f"body_{body_index}",
),
)
for body_index in gateway.get_data(DEVICE.BODY)
@ -97,7 +98,6 @@ class ScreenLogicClimate(ScreenLogicPushEntity, ClimateEntity, RestoreEntity):
self._attr_min_temp = self.entity_data[ATTR.MIN_SETPOINT]
self._attr_max_temp = self.entity_data[ATTR.MAX_SETPOINT]
self._attr_name = self.entity_data[VALUE.HEAT_STATE][ATTR.NAME]
self._last_preset = None
@property

View File

@ -55,7 +55,8 @@ class ScreenLogicEntity(CoordinatorEntity[ScreenlogicDataUpdateCoordinator]):
self._data_path = (*self.entity_description.data_root, self._data_key)
mac = self.mac
self._attr_unique_id = f"{mac}_{generate_unique_id(*self._data_path)}"
self._attr_name = self.entity_data[ATTR.NAME]
if not entity_description.translation_key:
self._attr_name = self.entity_data[ATTR.NAME]
assert mac is not None
self._attr_device_info = DeviceInfo(
connections={(dr.CONNECTION_NETWORK_MAC, mac)},

View File

@ -57,6 +57,7 @@ SUPPORTED_INTELLICHEM_NUMBERS = [
key=VALUE.CALCIUM_HARDNESS,
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
translation_key="calcium_hardness",
),
ScreenLogicPushNumberDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -64,6 +65,7 @@ SUPPORTED_INTELLICHEM_NUMBERS = [
key=VALUE.CYA,
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
translation_key="cya",
),
ScreenLogicPushNumberDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -71,6 +73,7 @@ SUPPORTED_INTELLICHEM_NUMBERS = [
key=VALUE.TOTAL_ALKALINITY,
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
translation_key="total_alkalinity",
),
ScreenLogicPushNumberDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -78,6 +81,7 @@ SUPPORTED_INTELLICHEM_NUMBERS = [
key=VALUE.SALT_TDS_PPM,
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
translation_key="salt_tds_ppm",
),
]
@ -86,11 +90,13 @@ SUPPORTED_SCG_NUMBERS = [
data_root=(DEVICE.SCG, GROUP.CONFIGURATION),
key=VALUE.POOL_SETPOINT,
entity_category=EntityCategory.CONFIG,
translation_key="pool_setpoint",
),
ScreenLogicNumberDescription(
data_root=(DEVICE.SCG, GROUP.CONFIGURATION),
key=VALUE.SPA_SETPOINT,
entity_category=EntityCategory.CONFIG,
translation_key="spa_setpoint",
),
]

View File

@ -58,6 +58,7 @@ SUPPORTED_CORE_SENSORS = [
key=VALUE.AIR_TEMPERATURE,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
translation_key="air_temperature",
),
]
@ -97,12 +98,16 @@ SUPPORTED_INTELLICHEM_SENSORS = [
data_root=(DEVICE.INTELLICHEM, GROUP.SENSOR),
key=VALUE.ORP_NOW,
state_class=SensorStateClass.MEASUREMENT,
translation_key="chem_now",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.SENSOR),
key=VALUE.PH_NOW,
state_class=SensorStateClass.MEASUREMENT,
translation_key="chem_now",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -110,6 +115,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.ORP_SUPPLY_LEVEL,
state_class=SensorStateClass.MEASUREMENT,
value_mod=lambda val: int(val) - 1,
translation_key="chem_supply_level",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -117,6 +124,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.PH_SUPPLY_LEVEL,
state_class=SensorStateClass.MEASUREMENT,
value_mod=lambda val: int(val) - 1,
translation_key="chem_supply_level",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -124,46 +133,56 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.PH_PROBE_WATER_TEMP,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
translation_key="ph_probe_water_temp",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.SENSOR),
key=VALUE.SATURATION,
state_class=SensorStateClass.MEASUREMENT,
translation_key="saturation",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.CALCIUM_HARDNESS,
entity_registry_enabled_default=False, # Superseded by number entity
translation_key="calcium_hardness",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.CYA,
entity_registry_enabled_default=False, # Superseded by number entity
translation_key="cya",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.ORP_SETPOINT,
translation_key="chem_setpoint",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.PH_SETPOINT,
translation_key="chem_setpoint",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.TOTAL_ALKALINITY,
entity_registry_enabled_default=False, # Superseded by number entity
translation_key="total_alkalinity",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
data_root=(DEVICE.INTELLICHEM, GROUP.CONFIGURATION),
key=VALUE.SALT_TDS_PPM,
entity_registry_enabled_default=False, # Superseded by number entity
translation_key="salt_tds_ppm",
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -172,6 +191,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
device_class=SensorDeviceClass.ENUM,
options=["Dosing", "Mixing", "Monitoring"],
value_mod=lambda val: DOSE_STATE(val).title,
translation_key="chem_dose_state",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -179,6 +200,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.ORP_LAST_DOSE_TIME,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="chem_last_dose_time",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -186,6 +209,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.ORP_LAST_DOSE_VOLUME,
device_class=SensorDeviceClass.VOLUME,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="chem_last_dose_volume",
translation_placeholders={"chem": "ORP"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -194,6 +219,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
device_class=SensorDeviceClass.ENUM,
options=["Dosing", "Mixing", "Monitoring"],
value_mod=lambda val: DOSE_STATE(val).title,
translation_key="chem_dose_state",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -201,6 +228,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.PH_LAST_DOSE_TIME,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="chem_last_dose_time",
translation_placeholders={"chem": "pH"},
),
ScreenLogicPushSensorDescription(
subscription_code=CODE.CHEMISTRY_CHANGED,
@ -208,6 +237,8 @@ SUPPORTED_INTELLICHEM_SENSORS = [
key=VALUE.PH_LAST_DOSE_VOLUME,
device_class=SensorDeviceClass.VOLUME,
state_class=SensorStateClass.TOTAL_INCREASING,
translation_key="chem_last_dose_volume",
translation_placeholders={"chem": "pH"},
),
]
@ -216,10 +247,12 @@ SUPPORTED_SCG_SENSORS = [
data_root=(DEVICE.SCG, GROUP.SENSOR),
key=VALUE.SALT_PPM,
state_class=SensorStateClass.MEASUREMENT,
translation_key="salt_ppm",
),
ScreenLogicSensorDescription(
data_root=(DEVICE.SCG, GROUP.CONFIGURATION),
key=VALUE.SUPER_CHLOR_TIMER,
translation_key="super_chlor_timer",
),
]

View File

@ -1,4 +1,11 @@
{
"common": {
"service_config_entry_name": "Config entry",
"service_config_entry_description": "The config entry to use for this action.",
"climate_preset_solar": "Solar",
"climate_preset_solar_prefered": "Solar Prefered",
"climate_preset_heater": "Heater"
},
"config": {
"flow_title": "{name}",
"error": {
@ -42,8 +49,8 @@
"description": "Sets the color mode for all color-capable lights attached to this ScreenLogic gateway.",
"fields": {
"config_entry": {
"name": "Config Entry",
"description": "The config entry to use for this action."
"name": "[%key:component::screenlogic::common::service_config_entry_name%]",
"description": "[%key:component::screenlogic::common::service_config_entry_description%]"
},
"color_mode": {
"name": "Color Mode",
@ -56,8 +63,8 @@
"description": "Begins super chlorination, running for the specified period or 24 hours if none is specified.",
"fields": {
"config_entry": {
"name": "Config Entry",
"description": "The config entry to use for this action."
"name": "[%key:component::screenlogic::common::service_config_entry_name%]",
"description": "[%key:component::screenlogic::common::service_config_entry_description%]"
},
"runtime": {
"name": "Run Time",
@ -70,10 +77,134 @@
"description": "Stops super chlorination.",
"fields": {
"config_entry": {
"name": "Config Entry",
"description": "The config entry to use for this action."
"name": "[%key:component::screenlogic::common::service_config_entry_name%]",
"description": "[%key:component::screenlogic::common::service_config_entry_description%]"
}
}
}
},
"entity": {
"binary_sensor": {
"active_alert": {
"name": "Active alert"
},
"pool_delay": {
"name": "Pool delay"
},
"spa_delay": {
"name": "Spa delay"
},
"cleaner_delay": {
"name": "Cleaner delay"
},
"freeze_mode": {
"name": "Freeze mode"
},
"flow_alarm": {
"name": "Flow alarm"
},
"chem_high_alarm": {
"name": "{chem} high alarm"
},
"chem_low_alarm": {
"name": "{chem} low alarm"
},
"chem_supply_alarm": {
"name": "{chem} supply alarm"
},
"probe_fault_alarm": {
"name": "Probe fault"
},
"chem_limit": {
"name": "{chem} dose limit reached"
},
"ph_lockout": {
"name": "pH lockout"
},
"corosive": {
"name": "SI corrosive"
},
"scaling": {
"name": "SI scaling"
},
"scg_state": {
"name": "Chlorinator"
}
},
"climate": {
"body_0": {
"name": "Pool heat"
},
"body_1": {
"name": "Spa heat"
}
},
"number": {
"calcium_hardness": {
"name": "Calcium hardness"
},
"cya": {
"name": "Cyanuric acid"
},
"total_alkalinity": {
"name": "Total alkalinity"
},
"salt_tds_ppm": {
"name": "Salt/TDS"
},
"pool_setpoint": {
"name": "Pool chlorinator setpoint"
},
"spa_setpoint": {
"name": "Spa chlorinator setpoint"
}
},
"sensor": {
"air_temperature": {
"name": "Air temperature"
},
"chem_now": {
"name": "{chem} now"
},
"chem_supply_level": {
"name": "{chem} supply level"
},
"ph_probe_water_temp": {
"name": "pH probe water temperature"
},
"saturation": {
"name": "Saturation index"
},
"chem_setpoint": {
"name": "{chem} setpoint"
},
"calcium_hardness": {
"name": "[%key:component::screenlogic::entity::number::calcium_hardness::name%]"
},
"cya": {
"name": "[%key:component::screenlogic::entity::number::cya::name%]"
},
"total_alkalinity": {
"name": "[%key:component::screenlogic::entity::number::total_alkalinity::name%]"
},
"salt_tds_ppm": {
"name": "[%key:component::screenlogic::entity::number::salt_tds_ppm::name%]"
},
"chem_dose_state": {
"name": "{chem} dosing state"
},
"chem_last_dose_time": {
"name": "{chem} last dose time"
},
"chem_last_dose_volume": {
"name": "{chem} last dose volume"
},
"salt_ppm": {
"name": "Chlorinator salt"
},
"super_chlor_timer": {
"name": "Super chlorination timer"
}
}
}
}

View File

@ -43,7 +43,7 @@ TEST_MIGRATING_ENTITIES = [
EntityMigrationData(
"Chemistry Alarm",
"chem_alarm",
"Active Alert",
"Active alert",
"active_alert",
BINARY_SENSOR_DOMAIN,
),