Add entity translations to Flume (#95350)

This commit is contained in:
Joost Lekkerkerker 2023-06-27 18:54:32 +02:00 committed by GitHub
parent 0b32a6e0d1
commit 09bfb08067
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 11 deletions

View file

@ -34,8 +34,7 @@ from .entity import FlumeEntity
from .util import get_valid_flume_devices
BINARY_SENSOR_DESCRIPTION_CONNECTED = BinarySensorEntityDescription(
name="Connected",
key="connected",
key="connected", device_class=BinarySensorDeviceClass.CONNECTIVITY
)
@ -56,14 +55,14 @@ class FlumeBinarySensorEntityDescription(
FLUME_BINARY_NOTIFICATION_SENSORS: tuple[FlumeBinarySensorEntityDescription, ...] = (
FlumeBinarySensorEntityDescription(
key="leak",
name="Leak detected",
translation_key="leak",
entity_category=EntityCategory.DIAGNOSTIC,
event_rule=NOTIFICATION_LEAK_DETECTED,
icon="mdi:pipe-leak",
),
FlumeBinarySensorEntityDescription(
key="flow",
name="High flow",
translation_key="flow",
entity_category=EntityCategory.DIAGNOSTIC,
event_rule=NOTIFICATION_HIGH_FLOW,
icon="mdi:waves",

View file

@ -33,13 +33,13 @@ from .util import get_valid_flume_devices
FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="current_interval",
name="Current",
translation_key="current_interval",
suggested_display_precision=2,
native_unit_of_measurement=f"{UnitOfVolume.GALLONS}/m",
),
SensorEntityDescription(
key="month_to_date",
name="Current Month",
translation_key="month_to_date",
suggested_display_precision=2,
native_unit_of_measurement=UnitOfVolume.GALLONS,
device_class=SensorDeviceClass.WATER,
@ -47,7 +47,7 @@ FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = (
),
SensorEntityDescription(
key="week_to_date",
name="Current Week",
translation_key="week_to_date",
suggested_display_precision=2,
native_unit_of_measurement=UnitOfVolume.GALLONS,
device_class=SensorDeviceClass.WATER,
@ -55,7 +55,7 @@ FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = (
),
SensorEntityDescription(
key="today",
name="Current Day",
translation_key="today",
suggested_display_precision=2,
native_unit_of_measurement=UnitOfVolume.GALLONS,
device_class=SensorDeviceClass.WATER,
@ -63,21 +63,21 @@ FLUME_QUERIES_SENSOR: tuple[SensorEntityDescription, ...] = (
),
SensorEntityDescription(
key="last_60_min",
name="60 Minutes",
translation_key="last_60_min",
suggested_display_precision=2,
native_unit_of_measurement=f"{UnitOfVolume.GALLONS}/h",
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="last_24_hrs",
name="24 Hours",
translation_key="last_24_hrs",
suggested_display_precision=2,
native_unit_of_measurement=f"{UnitOfVolume.GALLONS}/d",
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="last_30_days",
name="30 Days",
translation_key="last_30_days",
suggested_display_precision=2,
native_unit_of_measurement=f"{UnitOfVolume.GALLONS}/mo",
state_class=SensorStateClass.MEASUREMENT,

View file

@ -28,5 +28,38 @@
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
}
},
"entity": {
"binary_sensor": {
"leak": {
"name": "Leak detected"
},
"flow": {
"name": "High flow"
}
},
"sensor": {
"current_interval": {
"name": "Current"
},
"month_to_date": {
"name": "Current month"
},
"week_to_date": {
"name": "Current week"
},
"today": {
"name": "Current day"
},
"last_60_min": {
"name": "60 minutes"
},
"last_24_hrs": {
"name": "24 hours"
},
"last_30_days": {
"name": "30 days"
}
}
}
}