diff --git a/fritzbox_upnp/service.go b/fritzbox_upnp/service.go index 116b1fd..eff6db2 100644 --- a/fritzbox_upnp/service.go +++ b/fritzbox_upnp/service.go @@ -256,11 +256,12 @@ func convertResult(val string, arg *Argument) (interface{}, error) { return bool(val == "1"), nil case "ui1", "ui2", "ui4": - res, err := strconv.ParseUint(val, 10, 32) + // type ui4 can contain values greater than 2^32! + res, err := strconv.ParseUint(val, 10, 64) if err != nil { return nil, err } - return uint32(res), nil + return uint64(res), nil default: return nil, fmt.Errorf("unknown datatype: %s", arg.StateVariable.DataType) diff --git a/main.go b/main.go index aead9d1..cc936b9 100644 --- a/main.go +++ b/main.go @@ -199,7 +199,7 @@ func (fc *FritzboxCollector) Collect(ch chan<- prometheus.Metric) { var floatval float64 switch tval := val.(type) { - case uint32: + case uint64: floatval = float64(tval) case bool: if tval {