Only show zwave_js command classes that are on the node (#54794)

This commit is contained in:
Raman Gupta 2021-08-18 11:53:00 -04:00 committed by GitHub
parent a6ac55390a
commit c1595d5ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -197,7 +197,10 @@ async def async_get_condition_capabilities(
"extra_fields": vol.Schema(
{
vol.Required(ATTR_COMMAND_CLASS): vol.In(
{cc.value: cc.name for cc in CommandClass}
{
CommandClass(cc.id).value: CommandClass(cc.id).name
for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return]
}
),
vol.Required(ATTR_PROPERTY): cv.string,
vol.Optional(ATTR_PROPERTY_KEY): cv.string,