diff --git a/test/model/test_node.py b/test/model/test_node.py index 3916c013f..c30d522e6 100644 --- a/test/model/test_node.py +++ b/test/model/test_node.py @@ -22,7 +22,6 @@ from zwave_js_server.exceptions import ( FailedCommand, NotFoundError, - NotificationHasUnsupportedCommandClass, UnwriteableValue, ) from zwave_js_server.model import endpoint as endpoint_pkg, node as node_pkg @@ -803,7 +802,11 @@ async def test_notification(lock_schlage_be469: node_pkg.Node): assert event.data["notification"].status == PowerLevelTestStatus.FAILED assert event.data["notification"].acknowledged_frames == 2 + +async def test_notification_unknown(lock_schlage_be469: node_pkg.Node, caplog): + """Test unrecognized command class notification events.""" # Validate that an unrecognized CC notification event raises Exception + node = lock_schlage_be469 event = Event( type="notification", data={ @@ -814,8 +817,9 @@ async def test_notification(lock_schlage_be469: node_pkg.Node): }, ) - with pytest.raises(NotificationHasUnsupportedCommandClass): - node.handle_notification(event) + node.handle_notification(event) + + assert "notification" not in event.data async def test_entry_control_notification(ring_keypad): diff --git a/zwave_js_server/exceptions.py b/zwave_js_server/exceptions.py index b6ee18d37..367855e7f 100644 --- a/zwave_js_server/exceptions.py +++ b/zwave_js_server/exceptions.py @@ -4,7 +4,6 @@ from .const import CommandClass if TYPE_CHECKING: - from .event import Event from .model.value import Value @@ -157,16 +156,3 @@ def __init__(self, value: "Value", path: str) -> None: "upstream issue with the driver or missing support for this data in the " "library" ) - - -class NotificationHasUnsupportedCommandClass(BaseZwaveJSServerError): - """Exception raised when notification is received for an unsupported CC.""" - - def __init__(self, event: "Event", command_class: CommandClass) -> None: - """Initialize an invalid Command Class error.""" - self.event_data = event.data - self.command_class = command_class - super().__init__( - "Notification received with unsupported command class " - f"{command_class.name}: {event.data}" - ) diff --git a/zwave_js_server/model/node/__init__.py b/zwave_js_server/model/node/__init__.py index a4bf27d2a..7c5281303 100644 --- a/zwave_js_server/model/node/__init__.py +++ b/zwave_js_server/model/node/__init__.py @@ -1,4 +1,5 @@ """Provide a model for the Z-Wave JS node.""" +import logging from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, cast from ...const import ( @@ -12,7 +13,6 @@ from ...exceptions import ( FailedCommand, NotFoundError, - NotificationHasUnsupportedCommandClass, UnparseableValue, UnwriteableValue, ) @@ -58,6 +58,9 @@ from ...client import Client +_LOGGER = logging.getLogger(__package__) + + class Node(EventBase): """Represent a Z-Wave JS node.""" @@ -789,7 +792,7 @@ def handle_notification(self, event: Event) -> None: self, cast(PowerLevelNotificationDataType, event.data) ) else: - raise NotificationHasUnsupportedCommandClass(event, command_class) + _LOGGER.info("Unhandled notification command class: %s", command_class.name) def handle_firmware_update_progress(self, event: Event) -> None: """Process a node firmware update progress event."""