Improve Command Class choices for zwave_js device triggers and conditions (#54970)

This commit is contained in:
Raman Gupta 2021-08-21 02:57:20 -04:00 committed by GitHub
parent 2be50eb5b4
commit 726acc38c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 20 deletions

View File

@ -200,7 +200,7 @@ async def async_get_condition_capabilities(
{ {
vol.Required(ATTR_COMMAND_CLASS): vol.In( vol.Required(ATTR_COMMAND_CLASS): vol.In(
{ {
CommandClass(cc.id).value: CommandClass(cc.id).name CommandClass(cc.id).value: cc.name
for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return] for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return]
if cc.id != CommandClass.CONFIGURATION if cc.id != CommandClass.CONFIGURATION
} }

View File

@ -497,7 +497,7 @@ async def async_get_trigger_capabilities(
{ {
vol.Required(ATTR_COMMAND_CLASS): vol.In( vol.Required(ATTR_COMMAND_CLASS): vol.In(
{ {
CommandClass(cc.id).value: CommandClass(cc.id).name CommandClass(cc.id).value: cc.name
for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return] for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return]
if cc.id != CommandClass.CONFIGURATION if cc.id != CommandClass.CONFIGURATION
} }

View File

@ -431,15 +431,15 @@ async def test_get_condition_capabilities_value(
assert capabilities and "extra_fields" in capabilities assert capabilities and "extra_fields" in capabilities
cc_options = [ cc_options = [
(133, "ASSOCIATION"), (133, "Association"),
(128, "BATTERY"), (128, "Battery"),
(98, "DOOR_LOCK"), (98, "Door Lock"),
(122, "FIRMWARE_UPDATE_MD"), (122, "Firmware Update Meta Data"),
(114, "MANUFACTURER_SPECIFIC"), (114, "Manufacturer Specific"),
(113, "NOTIFICATION"), (113, "Notification"),
(152, "SECURITY"), (152, "Security"),
(99, "USER_CODE"), (99, "User Code"),
(134, "VERSION"), (134, "Version"),
] ]
assert voluptuous_serialize.convert( assert voluptuous_serialize.convert(

View File

@ -1085,15 +1085,15 @@ async def test_get_trigger_capabilities_value_updated_value(
"required": True, "required": True,
"type": "select", "type": "select",
"options": [ "options": [
(133, "ASSOCIATION"), (133, "Association"),
(128, "BATTERY"), (128, "Battery"),
(98, "DOOR_LOCK"), (98, "Door Lock"),
(122, "FIRMWARE_UPDATE_MD"), (122, "Firmware Update Meta Data"),
(114, "MANUFACTURER_SPECIFIC"), (114, "Manufacturer Specific"),
(113, "NOTIFICATION"), (113, "Notification"),
(152, "SECURITY"), (152, "Security"),
(99, "USER_CODE"), (99, "User Code"),
(134, "VERSION"), (134, "Version"),
], ],
}, },
{"name": "property", "required": True, "type": "string"}, {"name": "property", "required": True, "type": "string"},