change stp_priority to numberOrString

This commit is contained in:
Paul Tyng
2022-10-31 15:48:42 -04:00
parent 2f6ecf5ab8
commit 6de33139b5
3 changed files with 5 additions and 4 deletions

View File

@@ -331,8 +331,7 @@ func main() {
case "X", "Y": case "X", "Y":
f.FieldType = "float64" f.FieldType = "float64"
case "StpPriority": case "StpPriority":
f.FieldType = "string" f.CustomUnmarshalType = "numberOrString"
f.CustomUnmarshalType = ""
case "Ht": case "Ht":
f.FieldType = "int" f.FieldType = "int"
case "Channel", "BackupChannel", "TxPower": case "Channel", "BackupChannel", "TxPower":

View File

@@ -87,7 +87,7 @@ type Device struct {
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255} SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255} SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
State DeviceState `json:"state"` State DeviceState `json:"state"`
StpPriority string `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440 StpPriority int `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"` SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"`
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128} UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
@@ -109,6 +109,7 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
LtePoe booleanishString `json:"lte_poe"` LtePoe booleanishString `json:"lte_poe"`
LteSimPin emptyStringInt `json:"lte_sim_pin"` LteSimPin emptyStringInt `json:"lte_sim_pin"`
LteSoftLimit emptyStringInt `json:"lte_soft_limit"` LteSoftLimit emptyStringInt `json:"lte_soft_limit"`
StpPriority numberOrString `json:"stp_priority"`
Volume emptyStringInt `json:"volume"` Volume emptyStringInt `json:"volume"`
*Alias *Alias
@@ -128,6 +129,7 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
dst.LtePoe = bool(aux.LtePoe) dst.LtePoe = bool(aux.LtePoe)
dst.LteSimPin = int(aux.LteSimPin) dst.LteSimPin = int(aux.LteSimPin)
dst.LteSoftLimit = int(aux.LteSoftLimit) dst.LteSoftLimit = int(aux.LteSoftLimit)
dst.StpPriority = int(aux.StpPriority)
dst.Volume = int(aux.Volume) dst.Volume = int(aux.Volume)
return nil return nil

View File

@@ -2,4 +2,4 @@
package unifi package unifi
const UnifiVersion = "7.2.94" const UnifiVersion = "7.2.95"