@@ -36,24 +36,22 @@ async def execute_platform_entity_command(
36
36
method_name : str ,
37
37
) -> None :
38
38
"""Get the platform entity and execute a method based on the command."""
39
- try :
40
- _LOGGER .debug ("command: %s" , command )
41
- if command .group_id :
42
- group = gateway .get_group (command .group_id )
43
- platform_entity = group .group_entities [command .unique_id ]
44
- else :
45
- device = gateway .get_device (command .ieee )
46
- platform_entity = device .get_platform_entity (
47
- command .platform , command .unique_id
48
- )
49
- except ValueError as err :
50
- _LOGGER .exception (
51
- "Error executing command: %s method_name: %s" ,
52
- command ,
53
- method_name ,
54
- exc_info = err ,
39
+
40
+ _LOGGER .debug ("attempting to execute platform entity command: %s" , command )
41
+
42
+ if command .group_id :
43
+ group = gateway .get_group (command .group_id )
44
+ platform_entity = group .group_entities [command .unique_id ]
45
+ else :
46
+ device = gateway .get_device (command .ieee )
47
+ platform_entity = device .get_platform_entity (
48
+ command .platform , command .unique_id
49
+ )
50
+
51
+ if not platform_entity :
52
+ client .send_result_error (
53
+ command , "PLATFORM_ENTITY_COMMAND_ERROR" , "platform entity not found"
55
54
)
56
- client .send_result_error (command , "PLATFORM_ENTITY_COMMAND_ERROR" , str (err ))
57
55
return None
58
56
59
57
try :
@@ -69,7 +67,7 @@ async def execute_platform_entity_command(
69
67
else :
70
68
action () # the only argument is self
71
69
72
- except Exception as err :
70
+ except Exception as err : # pylint: disable=broad-except
73
71
_LOGGER .exception ("Error executing command: %s" , method_name , exc_info = err )
74
72
client .send_result_error (command , "PLATFORM_ENTITY_ACTION_ERROR" , str (err ))
75
73
return
0 commit comments