diff --git a/src-api/openzwave/network.py b/src-api/openzwave/network.py index 91fa48b9..32c21340 100755 --- a/src-api/openzwave/network.py +++ b/src-api/openzwave/network.py @@ -105,6 +105,8 @@ class ZWaveNetwork(ZWaveObject): * SIGNAL_NOTIFICATION = 'Notification' * SIGNAL_CONTROLLER_COMMAND = 'ControllerCommand' * SIGNAL_CONTROLLER_WAITING = 'ControllerWaiting' + * SIGNAL_USER_ALERTS = 'UserAlerts' + * SIGNAL_MANUFACTURER_SPECIFIC_DB_READY = 'ManufacturerSpecificDBReady' The table presented below sets notifications in the order they might typically be received, and grouped into a few logically related categories. Of course, given the variety @@ -282,6 +284,8 @@ class ZWaveNetwork(ZWaveObject): SIGNAL_NOTIFICATION = 'Notification' SIGNAL_CONTROLLER_COMMAND = 'ControllerCommand' SIGNAL_CONTROLLER_WAITING = 'ControllerWaiting' + SIGNAL_USER_ALERTS = 'UserAlerts' + SIGNAL_MANUFACTURER_SPECIFIC_DB_READY = 'ManufacturerSpecificDBReady' STATE_STOPPED = 0 STATE_FAILED = 1 @@ -984,6 +988,10 @@ def zwcallback(self, args): self._handle_driver_removed(args) elif notify_type == self.SIGNAL_CONTROLLER_COMMAND: self._handle_controller_command(args) + elif notify_type == self.SIGNAL_USER_ALERTS: + self._handle_user_alerts(args) + elif notify_type == self.SIGNAL_MANUFACTURER_SPECIFIC_DB_READY: + self._handle_manufacturer_specific_db_ready(args) else: logger.warning(u'Skipping unhandled notification [%s]', args) except: @@ -1600,6 +1608,32 @@ def _handle_controller_command(self, args): """ self._controller._handle_controller_command(args) + def _handle_user_alerts(self, args): + """ + Called when the library generates a warning or notification for the user + (e.g. out-of-date config files). The actual warning text is missing from the args dict, + but it shows up in the C++ logging output. + + :param args: data sent by the notification + :type args: dict() + + """ + logger.info(u'Z-Wave Notification UserAlert, see OZW_Log for details : %s', args) + dispatcher.send(self.SIGNAL_USER_ALERTS, \ + **{'network': self}) + + def _handle_manufacturer_specific_db_ready(self, args): + """ + Called when the ManufacturerSpecific database is ready. + + :param args: data sent by the notification + :type args: dict() + + """ + logger.debug(u'Z-Wave Notification ManufacturerSpecificDBReady : %s', args) + dispatcher.send(self.SIGNAL_MANUFACTURER_SPECIFIC_DB_READY, \ + **{'network': self}) + def _handle_msg_complete(self, args): """ The last message that was sent is now complete. diff --git a/src-lib/libopenzwave/libopenzwave.pyx b/src-lib/libopenzwave/libopenzwave.pyx index 2753a7d5..b5a87fe7 100644 --- a/src-lib/libopenzwave/libopenzwave.pyx +++ b/src-lib/libopenzwave/libopenzwave.pyx @@ -197,6 +197,8 @@ PyNotifications = [ EnumWithDoc('DriverRemoved').setDoc("The Driver is being removed."), EnumWithDoc('ControllerCommand').setDoc("When Controller Commands are executed, Notifications of Success/Failure etc are communicated via this Notification."), EnumWithDoc('NodeReset').setDoc("A node has been reset from OpenZWave's set. The Device has been reset and thus removed from the NodeList in OZW."), + EnumWithDoc('UserAlerts').setDoc("Warnings and Notifications Generated by the library that should be displayed to the user (eg, out of date config files)."), + EnumWithDoc('ManufacturerSpecificDBReady').setDoc("The ManufacturerSpecific Database Is Ready."), ] PyNotificationCodes = [