Add support for translating custom attribute state (#83386)

* Add support for translating custom attribute state

* Address review comment

* Rename attribute to state_attributes, allow naming attributes
This commit is contained in:
Erik Montnemery 2022-12-21 10:43:49 +01:00 committed by GitHub
parent fc94569a0d
commit 255f35b979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 6 deletions

View file

@ -269,9 +269,15 @@ def gen_strings_schema(config: Config, integration: Integration) -> vol.Schema:
},
vol.Optional("entity"): {
str: {
str: vol.Schema(
{vol.Optional("state"): {str: cv.string_with_no_html}}
)
str: {
vol.Optional("state_attributes"): {
str: {
vol.Optional("name"): cv.string_with_no_html,
vol.Optional("state"): {str: cv.string_with_no_html},
}
},
vol.Optional("state"): {str: cv.string_with_no_html},
}
}
},
}