Guests who received their WiFi code by SMS and entered it directly into
Omada never hit the /portal/auth callback, so their access_token stayed
'unused' with locked_mac=NULL even while actively consuming the voucher.
Both reconciliation paths matched tokens to sessions by locked_mac only,
so these paid clients showed up as orphan sessions and were undercounted.
- Add voucherReconcile util: matches Omada hotspot clients by voucherCode
and backfills locked_mac/status/expires_at + session link (mirrors
recordOmadaVoucherUse). Refuses to reassign a MAC-locked token or
reactivate expired/revoked ones.
- pollSessions: run reconcileDeviceTokens per device before session sync.
- /orphan-live: treat clients consuming a paid voucher (locked_mac OR
voucherCode match) as non-orphan.
- omada: clamp voucher group names to 32 UTF-8 chars (fixes errorCode
-1001 on plans whose name + ' - single-user' suffix exceeded the limit).
When access_token_id is null, join access_tokens on locked_mac so
token_code, expires_at, remaining_seconds and plan_name still populate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- app.js: comment out per-request HTTP logger (floods logs with webhook bodies)
- omada.js: strip verbose request/response interceptors; keep only error logging
with method+url+status+body for failed requests
- pollSessions.job.js: warn when a new session has no matching token so MAC
format mismatches show up clearly in logs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add missing portal customization properties (backgroundPictureId, logoSize, etc.)
- Always set httpsRedirectEnable to true for portal endpoints
- Include pageType and landingPage in portal updates
- Fix server URL construction to always end with '?' for external portal
- Remove redundant portalCustomize merge in updatePortalUrl since full object is now provided
fix(omada): ensure portalCustomize fields are included in PATCH requestsβ
When updating Omada portal SSID or URL, the API requires a complete portalCustomize object. Previously, missing fields could cause validation errors. Now we merge current portalCustomize with mandatory defaults to ensure successful synchronization.
Also sync portal URL updates to Omada when device is linked, maintaining external portal activation.
- Omada: log request body and full (untruncated) response per call
- Express: log every incoming request with method, URL, body, status
code, and response time
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ssid): update portal serverUrl to our server on every SSID setβ
When reusing an existing portal (or re-linking an SSID), the portal's
externalPortal.serverUrl was left pointing to whatever was set before.
Now patches the URL to mbonea-wifibiz.hf.space/portal/{siteId} every
time an SSID is created or updated.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(ssid): reuse existing Omada portal instead of creating duplicateβ
Creating a new portal failed with -34337 when the SSID was already
bound to an existing portal. Now fetches existing portals for the site
first β reuses one if found, creates a new one only if none exist.
Also adds getPortals() to the omada service.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(omada): align createPortal with actual API shapeβ
- Set httpsRedirectEnable based on PORTAL_SCHEME env var
- Use device name (not id) for lazy portal creation
- Minor portalCustomize field alignment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(omada): extract ssidId from createSSID response; create portal lazily with SSIDβ
- createSSID returned [object Object] β Omada uses ssidId not id field
- createPortal fails on newer Omada with empty ssidList; now created
lazily in PATCH /ssid once we have the SSID id to attach
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(omada): extract siteId string from createSite response objectβ
Omada returns result as {siteId: "..."} not a plain string β passing
the object to MySQL as a VARCHAR caused Incorrect arguments to
mysqld_stmt_execute on device registration.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(omada): correct rateLimits path and handle direct-array result shapeβ
- Correct path is /profiles/rateLimits (camelCase), not ratelimit
- Omada returns result as a plain array, not result.data β fix extraction
so the profile ID is actually found and included in createSSID payload
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Omada rejects SSID creation with "rateLimit should not be null".
Now fetches the site's rate limit profiles first and includes the
first profile's ID in the rateLimit and ssidRateLimit fields.
Also corrects band from 3 (2.4+5GHz) to 1 (2.4GHz only) for
EAP110-Outdoor compatibility.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat(devices): browser-triggered polling, full SSID update payload, and SSID deleteβ
- GET /api/devices now fires pollDevices.throttled() so device status
syncs from Omada on every dashboard load, not just the 15-min cron
- Move pollDevices throttle state into the job module so /api/devices
and /api/dashboard/summary share one 60s window
- Fix updateSSID to fetch the existing SSID and PATCH with the full
object β Omada requires a complete payload, not a sparse merge
- Add deleteSSID to omada service and expose it via DELETE /api/devices/:id/ssid
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>