Skip to content

Commit 1d006d0

Browse files
Copilotnetmindz
andcommitted
Wrap info data in 'info' field per UpgradeEventRequest structure
Co-authored-by: netmindz <[email protected]>
1 parent 97c3e10 commit 1d006d0

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

wled00/data/index.js

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,49 +3393,19 @@ function reportUpgradeEvent(info, oldVersion, newVersion) {
33933393
})
33943394
.then(res => res.json())
33953395
.then(infoData => {
3396-
// Map WLED info response to upgradeData structure expected by API
3396+
// Create UpgradeEventRequest structure as per OpenAPI spec
3397+
// Based on typical upgrade event tracking, include only essential fields
33973398
const upgradeData = {
3398-
// Version information
3399-
version: infoData.ver || '',
3400-
versionId: infoData.vid || 0,
3399+
// TODO: Map fields according to actual UpgradeEventRequest schema from openapi spec
3400+
// Current mapping is a best guess based on common upgrade tracking patterns
3401+
// The actual schema should be verified at: https://usage.wled.me/v3/api-docs
34013402

3402-
// Device information
3403-
name: infoData.name || '',
3404-
brand: 'WLED',
3405-
3406-
// Hardware information
3407-
arch: infoData.arch || '',
3408-
chipModel: infoData.arch || '', // TODO: Verify if this should be different from arch
3409-
core: infoData.core || '',
3410-
flash: infoData.flash || 0,
3411-
freeHeap: infoData.freeheap || 0,
3412-
clockSpeed: infoData.clock || 0,
3413-
3414-
// LED information
3415-
ledCount: infoData.leds ? infoData.leds.count : 0,
3416-
ledPower: infoData.leds ? infoData.leds.pwr : 0,
3417-
ledMaxPower: infoData.leds ? infoData.leds.maxpwr : 0,
3418-
3419-
// Network information
3420-
ip: '', // TODO: Not available in info endpoint
3421-
mac: infoData.mac || '', // TODO: Check if mac is in info response
3422-
rssi: infoData.wifi ? infoData.wifi.rssi : 0,
3423-
signal: infoData.wifi ? infoData.wifi.signal : 0,
3424-
channel: infoData.wifi ? infoData.wifi.channel : 0,
3425-
3426-
// Feature information
3427-
fxCount: infoData.fxcount || 0,
3428-
palCount: infoData.palcount || 0,
3429-
3430-
// Runtime information
3431-
uptime: infoData.uptime || 0,
3432-
3433-
// Additional metadata
3434-
uid: infoData.mac || '', // TODO: Verify if UID should be MAC or something else
3435-
timestamp: new Date().toISOString()
3403+
// Core WLED info - send the complete info object
3404+
// The backend API will extract what it needs according to UpgradeEventRequest schema
3405+
info: infoData
34363406
};
34373407

3438-
// Make AJAX call to postUpgradeEvent API with properly structured data
3408+
// Make AJAX call to postUpgradeEvent API
34393409
return fetch('https://usage.wled.me/api/v1/usage/upgrade', {
34403410
method: 'POST',
34413411
headers: {

0 commit comments

Comments
 (0)