-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
When querying an RLC-820A on the latest firmware the response from the camera is that the wifi is 0
and not a boolean false
I have written a fairly ugly function to manage this here - https://github.com/parkervcp/reolinkapigo/blob/update_deviceinfo/internal/pkg/models/system.go#L53
I am not saying it's "the" fix to use but it is "a" fix that works right now. It handles both the int and bool values and errors on any other value.
example data from my camera
{
"B485" : 0,
"IOInputNum" : 0,
"IOOutputNum" : 0,
"audioNum" : 1,
"buildDay" : "build 21073001",
"cfgVer" : "v3.0.0.0",
"channelNum" : 1,
"detail" : "IPC_523128M8MPS18E1W01100000001",
"diskNum" : 1,
"firmVer" : "v3.0.0.494_21073001",
"frameworkVer" : 1,
"hardVer" : "IPC_523128M8MP",
"model" : "RLC-820A",
"name" : "Camera1",
"pakSuffix" : "pak,paks",
"serial" : "00000000HEIGSDH",
"type" : "IPC",
"wifi" : 0
}
example code:
cam, err := reolink.NewCamera("admin", "", "192.168.10.106")
if err != nil {
log.Errorln(err)
}
_, err = cam.Login()(cam.RestHandler)
if err != nil {
log.Errorln(err)
}
camInfo, err := cam.GetDeviceInformation()(cam.RestHandler)
if err != nil {
log.Errorln(err)
}
log.Printf("%v", camInfo.Name)
error:
2021/11/06 23:20:33 token data unmarshalled &{60d05f1bfa4516b 3600}
2021/11/06 23:20:34 token data unmarshalled &{b1ab49e8c6d468c 3600}
ERRO[0000] json: cannot unmarshal number into Go struct field DeviceInformation.wifi of type bool
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x6432f9]
goroutine 1 [running]:
main.main()
/home/nvr/test/vnCT5zWjiz/test.go:48 +0x179
Metadata
Metadata
Assignees
Labels
No labels