Add entity name translations to Elgato (#89629)

pull/90286/head
Franck Nijhof 2023-03-25 23:06:03 +01:00 committed by GitHub
parent 668b2726fe
commit 5c839e2367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 18 deletions

View File

@ -40,14 +40,14 @@ class ElgatoButtonEntityDescription(
BUTTONS = [
ElgatoButtonEntityDescription(
key="identify",
name="Identify",
translation_key="identify",
icon="mdi:help",
entity_category=EntityCategory.CONFIG,
press_fn=lambda client: client.identify(),
),
ElgatoButtonEntityDescription(
key="restart",
name="Restart",
translation_key="restart",
device_class=ButtonDeviceClass.RESTART,
entity_category=EntityCategory.CONFIG,
press_fn=lambda client: client.restart(),

View File

@ -45,7 +45,7 @@ class ElgatoSensorEntityDescription(
SENSORS = [
ElgatoSensorEntityDescription(
key="battery",
name="Battery",
translation_key="battery",
device_class=SensorDeviceClass.BATTERY,
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=PERCENTAGE,
@ -56,7 +56,7 @@ SENSORS = [
),
ElgatoSensorEntityDescription(
key="voltage",
name="Battery voltage",
translation_key="voltage",
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.VOLTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
@ -69,7 +69,7 @@ SENSORS = [
),
ElgatoSensorEntityDescription(
key="input_charge_current",
name="Charging current",
translation_key="input_charge_current",
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.CURRENT,
entity_category=EntityCategory.DIAGNOSTIC,
@ -82,7 +82,7 @@ SENSORS = [
),
ElgatoSensorEntityDescription(
key="charge_power",
name="Charging power",
translation_key="charge_power",
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.POWER,
entity_category=EntityCategory.DIAGNOSTIC,
@ -94,7 +94,7 @@ SENSORS = [
),
ElgatoSensorEntityDescription(
key="input_charge_voltage",
name="Charging voltage",
translation_key="input_charge_voltage",
entity_registry_enabled_default=False,
device_class=SensorDeviceClass.VOLTAGE,
entity_category=EntityCategory.DIAGNOSTIC,

View File

@ -21,5 +21,40 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
}
},
"entity": {
"button": {
"identify": {
"name": "Identify"
},
"restart": {
"name": "[%key:component::button::entity_component::restart::name%]"
}
},
"sensor": {
"battery": {
"name": "[%key:component::sensor::entity_component::battery::name%]"
},
"charge_power": {
"name": "Charging power"
},
"input_charge_current": {
"name": "Charging current"
},
"input_charge_voltage": {
"name": "Charging voltage"
},
"voltage": {
"name": "Battery voltage"
}
},
"switch": {
"bypass": {
"name": "Studio mode"
},
"energy_saving": {
"name": "Energy saving"
}
}
}
}

View File

@ -39,7 +39,7 @@ class ElgatoSwitchEntityDescription(
SWITCHES = [
ElgatoSwitchEntityDescription(
key="bypass",
name="Studio mode",
translation_key="bypass",
icon="mdi:battery-off-outline",
entity_category=EntityCategory.CONFIG,
has_fn=lambda x: x.battery is not None,
@ -48,7 +48,7 @@ SWITCHES = [
),
ElgatoSwitchEntityDescription(
key="energy_saving",
name="Energy saving",
translation_key="energy_saving",
icon="mdi:leaf",
entity_category=EntityCategory.CONFIG,
has_fn=lambda x: x.battery is not None,

View File

@ -37,7 +37,7 @@
'original_name': 'Identify',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'identify',
'unique_id': 'GW24L1A02987_identify',
'unit_of_measurement': None,
})
@ -111,7 +111,7 @@
'original_name': 'Restart',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'restart',
'unique_id': 'GW24L1A02987_restart',
'unit_of_measurement': None,
})

View File

@ -44,7 +44,7 @@
'original_name': 'Battery',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'battery',
'unique_id': 'GW24L1A02987_battery',
'unit_of_measurement': '%',
})
@ -128,7 +128,7 @@
'original_name': 'Battery voltage',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'voltage',
'unique_id': 'GW24L1A02987_voltage',
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
})
@ -212,7 +212,7 @@
'original_name': 'Charging current',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'input_charge_current',
'unique_id': 'GW24L1A02987_input_charge_current',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
})
@ -293,7 +293,7 @@
'original_name': 'Charging power',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'charge_power',
'unique_id': 'GW24L1A02987_charge_power',
'unit_of_measurement': <UnitOfPower.WATT: 'W'>,
})
@ -377,7 +377,7 @@
'original_name': 'Charging voltage',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'input_charge_voltage',
'unique_id': 'GW24L1A02987_input_charge_voltage',
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
})

View File

@ -37,7 +37,7 @@
'original_name': 'Energy saving',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'energy_saving',
'unique_id': 'GW24L1A02987_energy_saving',
'unit_of_measurement': None,
})
@ -111,7 +111,7 @@
'original_name': 'Studio mode',
'platform': 'elgato',
'supported_features': 0,
'translation_key': None,
'translation_key': 'bypass',
'unique_id': 'GW24L1A02987_bypass',
'unit_of_measurement': None,
})