python-openzwave icon indicating copy to clipboard operation
python-openzwave copied to clipboard

Handle UserAlerts and ManufacturerSpecificDBReady notifications

Open nickrbogdanov opened this issue 4 years ago • 0 comments

On installations where the /etc/openzwave device configuration database is missing files, the Python wrapper can generate these unhelpful errors:

2021-04-09 09:01:26,267 notif_callback : new notification
2021-04-09 09:01:26,268 notif_callback : Notification type : 30, nodeId : 0
2021-04-09 09:01:26,268 notif_callback exception
Traceback (most recent call last):
  File "src-lib/libopenzwave/libopenzwave.pyx", line 512, in libopenzwave.notif_callback
IndexError: list index out of range
UnboundLocalError: local variable 'n' referenced before assignment
Exception ignored in: 'libopenzwave.notif_callback'
UnboundLocalError: local variable 'n' referenced before assignment
2021-04-09 09:01:26,269 notif_callback : new notification
2021-04-09 09:01:26,269 notif_callback : Notification type : 30, nodeId : 0
2021-04-09 09:01:26,269 notif_callback exception
Traceback (most recent call last):
  File "src-lib/libopenzwave/libopenzwave.pyx", line 512, in libopenzwave.notif_callback
IndexError: list index out of range

They correspond to these messages in the C++ library's log:

2021-04-09 09:10:23.476 Warning, Config Revision of ManufacturerSpecific Database is out of date
2021-04-09 09:10:23.476 Info, Queuing download for http://download.db.openzwave.com/mfs.xml
2021-04-09 09:10:23.477 Warning, File Removal failed: /etc/openzwave/manufacturer_specific.xml
2021-04-09 09:10:23.477 Warning, File Transfer Failed. Could not Rotate Existing File: /etc/openzwave/manufacturer_specific.xml
2021-04-09 09:10:23.477 Warning, Can't download ManufacturerSpecifix.xml Config file
2021-04-09 09:10:23.477 Info, ManufacturerSpecificDB Initialized
2021-04-09 09:10:23.477 Detail, Notification: User Alert - Manufacturer_specific.xml out of Date
2021-04-09 09:10:23.478 Detail, Notification: A Config File Failed to download
2021-04-09 09:10:23.478 Detail, Notification: ManufacturerSpecificDB Ready

Update the Python wrapper to handle the notifications properly instead of generating IndexError exceptions.

nickrbogdanov avatar Apr 10 '21 18:04 nickrbogdanov