-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError on OmadaListDevice.need_upgrade and OmadaListDevice.fw_download #18
Comments
Here's the raw data for a connected AP: {
"type":"ap",
"mac":"MA-CA-DD-RE-SS-xx",
"name":"EAP24502",
"model":"EAP245",
"compoundModel":"EAP245(EU) v3.0",
"showModel":"EAP245(EU) v3.0",
"modelVersion":"3.0",
"firmwareVersion":"5.0.6 Build 20220429 Rel. 44315",
"version":"5.0.6",
"hwVersion":"3.0",
"ip":"IP.ADD.RE.SS",
"uptime":"12day(s) 20h 8m 17s",
"uptimeLong":1109297,
"statusCategory":1,
"status":14,
"adoptFailType":-1,
"lastSeen":1682857232591,
"needUpgrade":false,
"fwDownload":false,
"cpuUtil":1,
"memUtil":50,
"download":80275048449,
"upload":56655231893,
"site":"*****",
"location":{
"located":false
},
"clientNum":9,
"compatible":0,
"locateEnable":false,
"sn":"*****",
"combinedGateway":false,
"wirelessLinked":false,
"deviceMisc":{
"support5g":true,
"support5g2":false,
"support6g":false,
"support11ac":true,
"supportLag":false,
"supportMesh":1,
"customizeRegion":276,
"minPower2G":9,
"maxPower2G":20,
"minPower5G":10,
"maxPower5G":28,
"supportChannelLimit":false,
"supportDfs":7,
"supportRoaming":1
},
"devCap":{
"supportPa":0,
"meshChainNum":3,
"supportOFDMA2g":false,
"supportOFDMA5g":false,
"supportOFDMA5g2":false,
"supportOFDMA6g":false,
"supportMeshPriority":true,
"supportL3Access":false
},
"wlanGroup":"Default + Guest",
"override":"0/7",
"bssids":[
"MA-CA-DD-RE-SS-xx",
"MA-CA-DD-RE-SS-xx",
"MA-CA-DD-RE-SS-xx"
],
"radioSetting2g":{
"radioEnable":true,
"channelWidth":"4",
"channel":"0",
"txPower":20,
"txPowerLevel":2
},
"radioSetting5g":{
"radioEnable":true,
"channelWidth":"6",
"channel":"0",
"txPower":28,
"txPowerLevel":2
},
"wp2g":{
"actualChannel":"6 / 2437MHz",
"maxTxRate":450,
"txPower":20,
"region":276,
"bandWidth":"Auto",
"rdMode":"b/g/n mixed",
"txUtil":4,
"rxUtil":12,
"interUtil":1
},
"wp5g":{
"actualChannel":"36 / 5180MHz",
"maxTxRate":1300,
"txPower":28,
"region":276,
"bandWidth":"Auto",
"rdMode":"a/n/ac mixed",
"txUtil":0,
"rxUtil":0,
"interUtil":0
},
"txRate":11634,
"rxRate":13696,
"clientNum2g":7,
"clientNum5g":2,
"clientNum5g2":0,
"clientNum6g":0,
"userNum":9,
"guestNum":0,
"hop":0,
"downlink":0,
"anyPoeEnable":false,
"licenseStatusStr":"-"
} |
And the raw data for a disconnected AP: {
"type":"ap",
"mac":"MA-CA-DD-RE-SS-xx",
"name":"EAP24503",
"model":"EAP245",
"compoundModel":"EAP245(EU) v3.0",
"showModel":"EAP245(EU) v3.0",
"modelVersion":"3.0",
"firmwareVersion":"5.0.6 Build 20220429 Rel. 44315",
"version":"5.0.6",
"hwVersion":"3.0",
"ip":"IP.ADD.RE.SS",
"statusCategory":0,
"status":0,
"lastSeen":1666277825817,
"site":"*****",
"location":{
"located":false
},
"clientNum":0,
"compatible":0,
"sn":"*****",
"combinedGateway":false,
"wirelessLinked":false,
"deviceMisc":{
"support5g":true,
"support5g2":false,
"support6g":false,
"support11ac":true,
"supportLag":false,
"supportMesh":1,
"customizeRegion":276,
"minPower2G":9,
"maxPower2G":20,
"minPower5G":10,
"maxPower5G":28,
"supportChannelLimit":false,
"supportDfs":7,
"supportRoaming":1
},
"devCap":{
"supportPa":0,
"meshChainNum":3,
"supportOFDMA2g":false,
"supportOFDMA5g":false,
"supportOFDMA5g2":false,
"supportOFDMA6g":false,
"supportMeshPriority":true,
"supportL3Access":false
},
"wlanGroup":"Default + Guest",
"override":"0/7",
"radioSetting2g":{
"radioEnable":true,
"channelWidth":"4",
"channel":"0",
"txPower":20,
"txPowerLevel":2
},
"radioSetting5g":{
"radioEnable":true,
"channelWidth":"6",
"channel":"0",
"txPower":28,
"txPowerLevel":2
},
"clientNum2g":0,
"clientNum5g":0,
"clientNum5g2":0,
"clientNum6g":0,
"hop":0,
"downlink":0,
"anyPoeEnable":false,
"licenseStatusStr":"-"
} |
Same behavior with |
This is incredibly useful information - thank you! |
Indeed, but there may be other cases in which the returned payload doesn't contain all of the properties the API can expose (pending device, isolated...) |
True. I might change the code to just report defaults if the key is missing instead. With the code as it is now, it may refuse to return information when it is actually present. |
I too thought about using default values according to each datatype. However by doing this the fact that the data is not available is completely obfuscated. Regarding the [EDIT] print("None is a " + ("truthy" if None else "falsy")) And Regarding the missing POE power returned as the default value, it's worth thinking of it.
The lack of PoE capability on one port can only be determined by a missing |
I created another MR for the PoE capability fix. |
(Seen on version 1.2.4)
When retrieving status on devices, I sometimes get the error
KeyError: 'needUpgrade'
orKeyError: 'fwDownload'
(see tracebacks below).It happens when, for example, the device is disconnected (seen on a spare AP that I keep in a closet).
The following code is used:
(same code with
need_upgrade
instead offw_download
can be used as well)Traceback for need_upgrade:
Traceback for fw_download:
The text was updated successfully, but these errors were encountered: