Scrin / RuuviCollector

Utility to collect measurements from RuuviTags and store them in InfluxDB
MIT License
125 stars 62 forks source link

BUG:named-filter does not recognise ruuvi-names.properties #48

Closed codemiha closed 4 years ago

codemiha commented 4 years ago

Describe the bug

named-filter does not recognise ruuvi-names.properties

To Reproduce Configure ruuvi-names.properties: miha@ruuvitag:~/RuuviCollector/target$ tail -2 ruuvi-names.properties EA:D6:63:18:F3:82=Fridge C7:60:16:8C:BB:4F=Freezer

Configure ruuvi-collector.properties:

filter.mode=none

filter.mode=named

filter.macs=Fridge,Freezer

Expected behavior Collector should send data to remote influxd-machine. That does not happen (followed with netstat -nputwc) However, with filter.mode=none and filer.macs commented out, collector works.

Environment OS and device (ie. Raspbian on RaspberryPI): NanoPI Neo AIr Java version (check with java -version): openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-1~deb9u1-b09) OpenJDK Client VM (build 25.232-b09, mixed mode)

Additional information Any other information that may help in diagnosing this issue miha@ruuvitag:/RuuviCollector/target$ pwd /home/miha/RuuviCollector/target miha@ruuvitag:/RuuviCollector/target$ ls -la total 4864 drwxr-xr-x 9 miha miha 4096 May 9 14:42 . drwxr-xr-x 6 miha miha 4096 May 9 09:29 .. drwxr-xr-x 3 miha miha 4096 May 9 09:29 classes drwxr-xr-x 3 miha miha 4096 May 9 09:29 generated-sources drwxr-xr-x 3 miha miha 4096 May 9 09:29 generated-test-sources drwxr-xr-x 2 miha miha 4096 May 9 09:29 maven-archiver drwxr-xr-x 3 miha miha 4096 May 9 09:29 maven-status -rw-r--r-- 1 miha miha 53771 May 9 09:29 original-ruuvi-collector-0.2.jar -rw-r--r-- 1 miha miha 4867034 May 9 09:29 ruuvi-collector-0.2.jar -rw-r--r-- 1 miha miha 5328 May 9 14:41 ruuvi-collector.properties -rw-r--r-- 1 miha miha 479 May 9 14:42 ruuvi-names.properties drwxr-xr-x 2 miha miha 4096 May 9 09:29 surefire-reports drwxr-xr-x 3 miha miha 4096 May 9 09:29 test-classes miha@ruuvitag:/RuuviCollector/target$ tail -2 ruuvi-names.properties EA:D6:63:18:F3:82=Fridge C7:60:16:8C:BB:4F=Freezer miha@ruuvitag:/RuuviCollector/target$ grep named ruuvi-collector.properties filter.mode=named miha@ruuvitag:/RuuviCollector/target$ sudo java -jar -Xdebug ruuvi-collector-0.2.jar 2020-05-09 14:48:09.184 DEBUG [Config] Tag names: /home/miha/RuuviCollector/target/ruuvi-names.properties 2020-05-09 14:48:09.217 DEBUG [Config] Config: /home/miha/RuuviCollector/target/ruuvi-collector.properties Exception in thread "main" java.lang.ExceptionInInitializerError at fi.tkgwf.ruuvi.Main.startHciListeners(Main.java:41) at fi.tkgwf.ruuvi.Main.run(Main.java:63) at fi.tkgwf.ruuvi.Main.main(Main.java:30) Caused by: java.lang.IllegalStateException: You have set filter.mode=named but left ruuvi-names.properties empty. Please select a different filter.mode value or populate ruuvi-names.properties. at fi.tkgwf.ruuvi.config.Config.parseFilterMode(Config.java:260) at fi.tkgwf.ruuvi.config.Config.readConfigFromProperties(Config.java:145) at fi.tkgwf.ruuvi.config.Config.readConfig(Config.java:127) at fi.tkgwf.ruuvi.config.Config.reload(Config.java:88) at fi.tkgwf.ruuvi.config.Config.reload(Config.java:81) at fi.tkgwf.ruuvi.config.Config.(Config.java:77) ... 3 more miha@ruuvitag:~/RuuviCollector/target$

codemiha commented 4 years ago

Ok, works now. ruuvi-names.properties must be: EAD66318F382=Fridge C760168CBB4F=Freezer