Skip to content
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

main.go:427: json unmarshal: json: Unmarshal(nil) #26

Closed
brotherdust opened this issue Sep 13, 2020 · 6 comments
Closed

main.go:427: json unmarshal: json: Unmarshal(nil) #26

brotherdust opened this issue Sep 13, 2020 · 6 comments

Comments

@brotherdust
Copy link

Hi! Thanks for making this great software!

I've run into a bit of a problem... when I run rtlamr-collect, I get the message main.go:427: json unmarshal: json: Unmarshal(nil). I've verified that rtlamr is outputting valid JSON:

$ rtlamr -msgtype="all" -format=json
10:53:34.045567 flags.go:111: Environment variable "RTLAMR_FILTERID" overrides flag "filterid" with "XXX"
10:53:34.046319 decode.go:45: CenterFreq: 912380000
10:53:34.046330 decode.go:46: SampleRate: 2359296
10:53:34.046338 decode.go:47: DataRate: 32768
10:53:34.046356 decode.go:48: ChipLength: 72
10:53:34.046366 decode.go:49: PreambleSymbols: 32
10:53:34.046377 decode.go:50: PreambleLength: 4608
10:53:34.046394 decode.go:51: PacketSymbols: 736
10:53:34.046400 decode.go:52: PacketLength: 105984
10:53:34.046407 decode.go:59: Protocols: scm,scm+,idm,r900
10:53:34.046413 decode.go:60: Preambles: 111110010101001100000,0001011010100011,01010101010101010001011010100011,00000000000000001110010101100100
10:53:34.046419 main.go:111: GainCount: 29
{"Time":"2020-09-13T10:53:43.338550439-06:00","Offset":0,"Length":0,"Message":{"ID":XXX,"Unkn1":163,"NoUse":0,"BackFlow":0,"Consumption":4058505,"Unkn3":0,"Leak":2,"LeakNow":0}}

Any ideas why unmarshaling is returning nil?

Thanks much!

@brotherdust
Copy link
Author

Ok. I think I have an idea why this is happening, either:
a) my meter(s) don't output some of the expected fields
b) the decoder isn't decoding the fields and/or outputting them

As I'm not a Go developer, I have no idea how to make these fields optional. I guess it's time to learn Go! ha.

@bemasher
Copy link
Owner

bemasher commented Sep 14, 2020

The version of rtlamr you are using is not compatible with rtlamr-collect, the output is missing the Type field.

@brotherdust
Copy link
Author

The version of rtlamr you are using is not compatible with rtlamr-collect, the output is missing the Type field.

Oh. I just pulled from master. What version should I be using?

@brotherdust
Copy link
Author

It would seem that rtlamr should be outputting the Type field:

https://github.com/bemasher/rtlamr/blob/22749a729e9dfb82be1016d2454026ca74126480/main.go#L249

@brotherdust
Copy link
Author

Yeah nevermind. I was telling nix to build from an old tag, not master. Serves me right. Thanks!

@bemasher
Copy link
Owner

I found the issue. I had made a new tag including the commits necessary for compatibility with this version of rtlamr-collect, but had not pushed it to the repository, new clones should behave as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants