Comments (4)
Turns out @latest
will pull the latest tagged commit. I will need to make a new release to correct this. In the meantime, I would recommend cloning the repositories for rtlamr and rtlamr-collect directly with git.
from rtlamr-collect.
Did a little more digging and it looks like logMsg.Type doesn't have a value.
index fef931d..8694029 100644
--- a/main.go
+++ b/main.go
@@ -390,12 +390,17 @@ func main() {
msg = new(IDM)
case "R900", "R900BCD":
msg = new(R900)
+ default:
+ log.Printf("logMsg.Type not set. %+v\n", logMsg)
}
// Parse the encapsulated message.
err = json.Unmarshal(logMsg.Message, msg)
if err != nil {
log.Println(errors.Wrap(err, "json unmarshal"))
+ log.Printf("logMsg: %+v\n", logMsg)
+ log.Printf("logMsg.Message: %v\n", string(logMsg.Message))
+ log.Printf("msg: %T %+v\n", msg, msg)
continue
}
The output is then:
$ rtlamr | tee /dev/pts/1 | rtlamr-collect
11:44:18.240748 flags.go:111: Environment variable "RTLAMR_FORMAT" overrides flag "format" with "json"
11:44:18.241134 decode.go:45: CenterFreq: 912600155
11:44:18.241148 decode.go:46: SampleRate: 2359296
11:44:18.241153 decode.go:47: DataRate: 32768
11:44:18.241157 decode.go:48: ChipLength: 72
11:44:18.241161 decode.go:49: PreambleSymbols: 21
11:44:18.241167 decode.go:50: PreambleLength: 3024
11:44:18.241172 decode.go:51: PacketSymbols: 96
11:44:18.241176 decode.go:52: PacketLength: 13824
11:44:18.241180 decode.go:59: Protocols: scm
11:44:18.241186 decode.go:60: Preambles: 111110010101001100000
11:44:18.241192 main.go:111: GainCount: 29
11:44:18.242200 main.go:353: connecting to "rtluser"@"http://localhost:8086/"
{"Time":"2019-08-19T11:44:34.307117087-04:00","Offset":0,"Length":0,"Message":{"ID":6581xxxx,"Type":12,"TamperPhy":3,"TamperEnc":0,"Consumption":185077,"ChecksumVal":53xxx}}
11:44:34.308239 main.go:394: logMsg.Type not set. {Time:2019-08-19 11:44:34.307117087 -0400 EDT Type:}
11:44:34.308312 main.go:400: json unmarshal: json: Unmarshal(nil)
11:44:34.308332 main.go:401: logMsg: {Time:2019-08-19 11:44:34.307117087 -0400 EDT Type:}
11:44:34.308358 main.go:402: logMsg.Message: {"ID":6581xxxx,"Type":12,"TamperPhy":3,"TamperEnc":0,"Consumption":185077,"ChecksumVal":53xxx}
11:44:34.308371 main.go:403: msg: <nil> <nil>
from rtlamr-collect.
Ah yeah, you're using incompatible versions of rtlamr and rtlamr-collect. The lastest flavor of rtlamr-collect expects there to be a "Type" field in each message and the latest version of rtlamr provides that field, but I've not yet made a tagged release including those changes. The release of go modules has been somewhat turbulent for this project.
Try:
go get -v github.com/bemasher/rtlamr@latest
go get -v github.com/bemasher/rtlamr-collect@latest
from rtlamr-collect.
I just collected the latest versions using
go get -v github.com/bemasher/rtlamr@latest
go get -v github.com/bemasher/rtlamr-collect@latest
And received an infinite stream of Unmarshal(nil)
:
/ $ /home/pi/go/bin/rtlamr -msgtype=scm,scm+,idm,netidm -format=json | /home/pi/go/bin/rtlamr-collect
02:10:53.574854 decode.go:45: CenterFreq: 912600155
02:10:53.575536 decode.go:46: SampleRate: 2359296
02:10:53.575648 decode.go:47: DataRate: 32768
02:10:53.575746 decode.go:48: ChipLength: 72
02:10:53.575843 decode.go:49: PreambleSymbols: 32
02:10:53.575939 decode.go:50: PreambleLength: 4608
02:10:53.576034 decode.go:51: PacketSymbols: 736
02:10:53.576130 decode.go:52: PacketLength: 105984
02:10:53.576252 decode.go:59: Protocols: scm,scm+,idm,netidm
02:10:53.576418 decode.go:60: Preambles: 0001011010100011,01010101010101010001011010100011,111110010101001100000
02:10:53.576528 main.go:111: GainCount: 29
02:10:53.575070 main.go:355: connecting to "power"@"http://localhost:8086"
02:10:54.458244 main.go:400: json unmarshal: json: Unmarshal(nil)
02:11:00.488564 main.go:400: json unmarshal: json: Unmarshal(nil)
However, getting them normally seemed to work fine:
/ $ go get -v github.com/bemasher/rtlamr
/ $ go get -v github.com/bemasher/rtlamr-collect
/ $ /home/pi/go/bin/rtlamr -msgtype=scm,scm+,idm,netidm -format=json | /home/pi/go/bin/rtlamr-collect
02:22:18.158155 decode.go:45: CenterFreq: 912600155
02:22:18.158797 decode.go:46: SampleRate: 2359296
02:22:18.158852 decode.go:47: DataRate: 32768
02:22:18.158900 decode.go:48: ChipLength: 72
02:22:18.158946 decode.go:49: PreambleSymbols: 32
02:22:18.158995 decode.go:50: PreambleLength: 4608
02:22:18.159042 decode.go:51: PacketSymbols: 736
02:22:18.159090 decode.go:52: PacketLength: 105984
02:22:18.159155 decode.go:59: Protocols: scm,scm+,idm,netidm
02:22:18.159245 decode.go:60: Preambles: 111110010101001100000,0001011010100011,01010101010101010001011010100011
02:22:18.159302 main.go:119: GainCount: 29
02:22:18.159884 main.go:355: connecting to "power"@"http://localhost:8086"
02:22:19.980280 main.go:431: rtlamr,endpoint_id=105_____,endpoint_type=12,msg_type=cumulative,protocol=SCM consumption=4996i 157_______________________
02:22:23.851680 main.go:431: rtlamr,endpoint_id=150_____,endpoint_type=12,msg_type=cumulative,protocol=SCM consumption=29428i 157_______________________
...
from rtlamr-collect.
Related Issues (20)
- Using 2 instances on rtlamr-collect HOT 1
- Runtime error due to no PowerOutageFlags in NetIDM meters HOT 3
- invalid memory address HOT 2
- main.go:427: json unmarshal: json: Unmarshal(nil) HOT 6
- 404 Error HOT 5
- InfluxDB 2 support HOT 3
- Error Message Install HOT 1
- Print collected data to stdout HOT 5
- stumped on "COLLECT_INFLUXDB_TOKEN" undefined HOT 4
- Diagnosing Influx issues HOT 2
- Invalid character error HOT 4
- Can you give us some info on how to set up influxdb? HOT 1
- Where to set envinronment variables (Using Windows) HOT 2
- Depeding on grafana zoom level, water meter gallons used is different HOT 2
- unexpected end of JSON input main.main invalid character C /f E M C E . HOT 3
- Unable to build / install HOT 2
- endpoint_type varying for R900 water meter
- Go install instructions fail
- Grafana Dashboards
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtlamr-collect.