Add entity translations to Notion (#95755)

* Add entity translations to Notion

* Use device class translations

* Use device class translations
pull/95782/head^2
Joost Lekkerkerker 2023-07-03 18:31:07 +02:00 committed by GitHub
parent 0a165bb35a
commit f0eb084908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 11 deletions

View File

@ -52,7 +52,6 @@ class NotionBinarySensorDescription(
BINARY_SENSOR_DESCRIPTIONS = (
NotionBinarySensorDescription(
key=SENSOR_BATTERY,
name="Low battery",
device_class=BinarySensorDeviceClass.BATTERY,
entity_category=EntityCategory.DIAGNOSTIC,
listener_kind=ListenerKind.BATTERY,
@ -60,28 +59,24 @@ BINARY_SENSOR_DESCRIPTIONS = (
),
NotionBinarySensorDescription(
key=SENSOR_DOOR,
name="Door",
device_class=BinarySensorDeviceClass.DOOR,
listener_kind=ListenerKind.DOOR,
on_state="open",
),
NotionBinarySensorDescription(
key=SENSOR_GARAGE_DOOR,
name="Garage door",
device_class=BinarySensorDeviceClass.GARAGE_DOOR,
listener_kind=ListenerKind.GARAGE_DOOR,
on_state="open",
),
NotionBinarySensorDescription(
key=SENSOR_LEAK,
name="Leak detector",
device_class=BinarySensorDeviceClass.MOISTURE,
listener_kind=ListenerKind.LEAK_STATUS,
on_state="leak",
),
NotionBinarySensorDescription(
key=SENSOR_MISSING,
name="Missing",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
entity_category=EntityCategory.DIAGNOSTIC,
listener_kind=ListenerKind.CONNECTED,
@ -89,28 +84,28 @@ BINARY_SENSOR_DESCRIPTIONS = (
),
NotionBinarySensorDescription(
key=SENSOR_SAFE,
name="Safe",
translation_key="safe",
device_class=BinarySensorDeviceClass.DOOR,
listener_kind=ListenerKind.SAFE,
on_state="open",
),
NotionBinarySensorDescription(
key=SENSOR_SLIDING,
name="Sliding door/window",
translation_key="sliding_door_window",
device_class=BinarySensorDeviceClass.DOOR,
listener_kind=ListenerKind.SLIDING_DOOR_OR_WINDOW,
on_state="open",
),
NotionBinarySensorDescription(
key=SENSOR_SMOKE_CO,
name="Smoke/Carbon monoxide detector",
translation_key="smoke_carbon_monoxide_detector",
device_class=BinarySensorDeviceClass.SMOKE,
listener_kind=ListenerKind.SMOKE,
on_state="alarm",
),
NotionBinarySensorDescription(
key=SENSOR_WINDOW_HINGED,
name="Hinged window",
translation_key="hinged_window",
listener_kind=ListenerKind.HINGED_WINDOW,
on_state="open",
),

View File

@ -27,13 +27,12 @@ class NotionSensorDescription(SensorEntityDescription, NotionEntityDescriptionMi
SENSOR_DESCRIPTIONS = (
NotionSensorDescription(
key=SENSOR_MOLD,
name="Mold risk",
translation_key="mold_risk",
icon="mdi:liquid-spot",
listener_kind=ListenerKind.MOLD,
),
NotionSensorDescription(
key=SENSOR_TEMPERATURE,
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,

View File

@ -24,5 +24,26 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
}
},
"entity": {
"binary_sensor": {
"safe": {
"name": "Safe"
},
"sliding_door_window": {
"name": "Sliding door/window"
},
"smoke_carbon_monoxide_detector": {
"name": "Smoke/Carbon monoxide detector"
},
"hinged_window": {
"name": "Hinged window"
}
},
"sensor": {
"mold_risk": {
"name": "Mold risk"
}
}
}
}