Add entity translation to Aussie broadband (#95134)

This commit is contained in:
Joost Lekkerkerker 2023-06-26 23:39:02 +02:00 committed by GitHub
parent 185936deda
commit dbe4252d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 12 deletions

View File

@ -35,7 +35,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
# Internet Services sensors # Internet Services sensors
SensorValueEntityDescription( SensorValueEntityDescription(
key="usedMb", key="usedMb",
name="Data used", translation_key="data_used",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfInformation.MEGABYTES, native_unit_of_measurement=UnitOfInformation.MEGABYTES,
device_class=SensorDeviceClass.DATA_SIZE, device_class=SensorDeviceClass.DATA_SIZE,
@ -43,7 +43,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="downloadedMb", key="downloadedMb",
name="Downloaded", translation_key="downloaded",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfInformation.MEGABYTES, native_unit_of_measurement=UnitOfInformation.MEGABYTES,
device_class=SensorDeviceClass.DATA_SIZE, device_class=SensorDeviceClass.DATA_SIZE,
@ -51,7 +51,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="uploadedMb", key="uploadedMb",
name="Uploaded", translation_key="uploaded",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfInformation.MEGABYTES, native_unit_of_measurement=UnitOfInformation.MEGABYTES,
device_class=SensorDeviceClass.DATA_SIZE, device_class=SensorDeviceClass.DATA_SIZE,
@ -60,21 +60,21 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
# Mobile Phone Services sensors # Mobile Phone Services sensors
SensorValueEntityDescription( SensorValueEntityDescription(
key="national", key="national",
name="National calls", translation_key="national_calls",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone", icon="mdi:phone",
value=lambda x: x.get("calls"), value=lambda x: x.get("calls"),
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="mobile", key="mobile",
name="Mobile calls", translation_key="mobile_calls",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone", icon="mdi:phone",
value=lambda x: x.get("calls"), value=lambda x: x.get("calls"),
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="international", key="international",
name="International calls", translation_key="international_calls",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone-plus", icon="mdi:phone-plus",
@ -82,14 +82,14 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="sms", key="sms",
name="SMS sent", translation_key="sms_sent",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:message-processing", icon="mdi:message-processing",
value=lambda x: x.get("calls"), value=lambda x: x.get("calls"),
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="internet", key="internet",
name="Data used", translation_key="data_used",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfInformation.KILOBYTES, native_unit_of_measurement=UnitOfInformation.KILOBYTES,
device_class=SensorDeviceClass.DATA_SIZE, device_class=SensorDeviceClass.DATA_SIZE,
@ -98,7 +98,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="voicemail", key="voicemail",
name="Voicemail calls", translation_key="voicemail_calls",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone", icon="mdi:phone",
@ -106,7 +106,7 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="other", key="other",
name="Other calls", translation_key="other_calls",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:phone", icon="mdi:phone",
@ -115,13 +115,13 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
# Generic sensors # Generic sensors
SensorValueEntityDescription( SensorValueEntityDescription(
key="daysTotal", key="daysTotal",
name="Billing cycle length", translation_key="billing_cycle_length",
native_unit_of_measurement=UnitOfTime.DAYS, native_unit_of_measurement=UnitOfTime.DAYS,
icon="mdi:calendar-range", icon="mdi:calendar-range",
), ),
SensorValueEntityDescription( SensorValueEntityDescription(
key="daysRemaining", key="daysRemaining",
name="Billing cycle remaining", translation_key="billing_cycle_remaining",
native_unit_of_measurement=UnitOfTime.DAYS, native_unit_of_measurement=UnitOfTime.DAYS,
icon="mdi:calendar-clock", icon="mdi:calendar-clock",
), ),

View File

@ -46,5 +46,42 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
} }
},
"entity": {
"sensor": {
"data_used": {
"name": "Data used"
},
"downloaded": {
"name": "Downloaded"
},
"uploaded": {
"name": "Uploaded"
},
"national_calls": {
"name": "National calls"
},
"mobile_calls": {
"name": "Mobile calls"
},
"international_calls": {
"name": "International calls"
},
"sms_sent": {
"name": "SMS sent"
},
"voicemail_calls": {
"name": "Voicemail calls"
},
"other_calls": {
"name": "Other calls"
},
"billing_cycle_length": {
"name": "Billing cycle length"
},
"billing_cycle_remaining": {
"name": "Billing cycle remaining"
}
}
} }
} }