mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Protect add/remove node services from invalid instance ID (#41334)
This commit is contained in:
parent
bfb00b9bb5
commit
d6ad85bba7
@ -111,6 +111,8 @@ class ZWaveServices:
|
|||||||
instance_id = service.data[const.ATTR_INSTANCE_ID]
|
instance_id = service.data[const.ATTR_INSTANCE_ID]
|
||||||
secure = service.data[const.ATTR_SECURE]
|
secure = service.data[const.ATTR_SECURE]
|
||||||
instance = self._manager.get_instance(instance_id)
|
instance = self._manager.get_instance(instance_id)
|
||||||
|
if instance is None:
|
||||||
|
raise ValueError(f"No OpenZWave Instance with ID {instance_id}")
|
||||||
instance.add_node(secure)
|
instance.add_node(secure)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
@ -118,6 +120,8 @@ class ZWaveServices:
|
|||||||
"""Enter exclusion mode on the controller."""
|
"""Enter exclusion mode on the controller."""
|
||||||
instance_id = service.data[const.ATTR_INSTANCE_ID]
|
instance_id = service.data[const.ATTR_INSTANCE_ID]
|
||||||
instance = self._manager.get_instance(instance_id)
|
instance = self._manager.get_instance(instance_id)
|
||||||
|
if instance is None:
|
||||||
|
raise ValueError(f"No OpenZWave Instance with ID {instance_id}")
|
||||||
instance.remove_node()
|
instance.remove_node()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user