Title
Webhook Notification Configuration: Double Configuration System Causes Confusion
Description
There are two competing webhook notification configuration systems in Nutify that create confusion:
- ups_opt_webhook table - Has
notify_onbatt, notify_online, notify_lowbatt, etc. fields
- ups_opt_notification table - Has
webhook_enabled and id_webhook fields
The problem: Only ups_opt_notification is actually used, but users see the notify_* fields in the UI/database and expect them to work.
Root Cause
send_event_notification() in webhook.py calls get_enabled_configs_for_event()
get_enabled_configs_for_event() in db.py reads ONLY from ups_opt_notification table
- The
notify_* fields in ups_opt_webhook are never checked or used
Expected Behavior
Users should be able to enable webhooks by setting notify_* flags in ups_opt_webhook, OR the UI should only show the actual configuration in ups_opt_notification.
Current Behavior
Enabling notify_onbatt, notify_online, etc. in ups_opt_webhook doesn't trigger webhooks. Users must manually enable webhooks in the disconnected ups_opt_notification table.
Files Affected
nutify/core/extranotifs/webhook/webhook.py - send_event_notification()
nutify/core/extranotifs/webhook/db.py - get_enabled_configs_for_event()
nutify/core/db/orm/orm_ups_opt_webhook.py - WebhookConfig model (legacy fields)
Solution Options
- Remove legacy fields - Delete
notify_* columns from ups_opt_webhook ORM model
- Unify the systems - Make
ups_opt_webhook.notify_* the source of truth instead of ups_opt_notification
- Document the issue - Clarify that only
ups_opt_notification controls routing
Workaround
Always configure webhooks via ups_opt_notification table with:
webhook_enabled = 1
id_webhook = <webhook_id>
target_id = NULL (for global) or specific target ID
Title
Webhook Notification Configuration: Double Configuration System Causes Confusion
Description
There are two competing webhook notification configuration systems in Nutify that create confusion:
notify_onbatt,notify_online,notify_lowbatt, etc. fieldswebhook_enabledandid_webhookfieldsThe problem: Only
ups_opt_notificationis actually used, but users see thenotify_*fields in the UI/database and expect them to work.Root Cause
send_event_notification()in webhook.py callsget_enabled_configs_for_event()get_enabled_configs_for_event()in db.py reads ONLY fromups_opt_notificationtablenotify_*fields inups_opt_webhookare never checked or usedExpected Behavior
Users should be able to enable webhooks by setting
notify_*flags inups_opt_webhook, OR the UI should only show the actual configuration inups_opt_notification.Current Behavior
Enabling
notify_onbatt,notify_online, etc. inups_opt_webhookdoesn't trigger webhooks. Users must manually enable webhooks in the disconnectedups_opt_notificationtable.Files Affected
nutify/core/extranotifs/webhook/webhook.py- send_event_notification()nutify/core/extranotifs/webhook/db.py- get_enabled_configs_for_event()nutify/core/db/orm/orm_ups_opt_webhook.py- WebhookConfig model (legacy fields)Solution Options
notify_*columns fromups_opt_webhookORM modelups_opt_webhook.notify_*the source of truth instead ofups_opt_notificationups_opt_notificationcontrols routingWorkaround
Always configure webhooks via
ups_opt_notificationtable with:webhook_enabled = 1id_webhook = <webhook_id>target_id = NULL(for global) or specific target ID