mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add translations for binary_sensor device classes (#58471)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
370c7a7ccf
commit
5e88760fa7
@ -207,5 +207,18 @@
|
||||
"off": "[%key:common::state::off%]",
|
||||
"on": "[%key:common::state::on%]"
|
||||
}
|
||||
},
|
||||
"device_class": {
|
||||
"cold": "cold",
|
||||
"gas": "gas",
|
||||
"heat": "heat",
|
||||
"moisture": "moisture",
|
||||
"motion": "motion",
|
||||
"occupancy": "occupancy",
|
||||
"power": "power",
|
||||
"problem": "problem",
|
||||
"smoke": "smoke",
|
||||
"sound": "sound",
|
||||
"vibration": "vibration"
|
||||
}
|
||||
}
|
@ -196,7 +196,7 @@ def gen_platform_strings_schema(config: Config, integration: Integration):
|
||||
"""
|
||||
|
||||
def device_class_validator(value):
|
||||
"""Key validator for platorm states.
|
||||
"""Key validator for platform states.
|
||||
|
||||
Platform states are only allowed to provide states for device classes they prefix.
|
||||
"""
|
||||
@ -246,6 +246,14 @@ def validate_translation_file(config: Config, integration: Integration, all_stri
|
||||
strings_schema = gen_auth_schema(config, integration)
|
||||
elif integration.domain == "onboarding":
|
||||
strings_schema = ONBOARDING_SCHEMA
|
||||
elif integration.domain == "binary_sensor":
|
||||
strings_schema = gen_strings_schema(config, integration).extend(
|
||||
{
|
||||
vol.Optional("device_class"): cv.schema_with_slug_keys(
|
||||
cv.string_with_no_html, slug_validator=vol.Any("_", cv.slug)
|
||||
)
|
||||
}
|
||||
)
|
||||
else:
|
||||
strings_schema = gen_strings_schema(config, integration)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user