SR-G / current-cost-forwarder

Forwards readings from a Current Cost ENVIR through a MQTT Broker
8 stars 0 forks source link

Multiple Now Connected messages #1

Closed elyobelyob closed 9 years ago

elyobelyob commented 9 years ago

Hi,

Trying this out on a Raspberry Pi, I just seem to get lots of Now Connected messages.

17:55:38.684 [main] INFO org.tensin.ccf.CurrentCostForwarder - Now starting reader 17:55:38.695 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Trying to autodect mirror4j device in [/dev/] with pattern [ttyUSB.*] 17:55:38.792 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Auto-detected current cost device [/dev/ttyUSB0] 17:55:38.913 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Starting CurrentCostForwarder reader thread on device [/dev/ttyUSB0] 17:55:38.915 [main] INFO org.tensin.ccf.CurrentCostForwarder - CurrentCostForwarder started in [572ms] 17:55:38.918 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.020 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.120 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.220 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.320 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.420 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.520 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.620 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.720 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.820 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:39.920 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:40.020 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:40.120 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:40.220 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:40.320 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 17:55:40.420 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0]

SR-G commented 9 years ago

With such a high rate, I guess it doesn't work on your side because it constantly disconnects/reconnects. Are you sure your current cost device is on /dev/ttyUSB0 ? What are your permissions on /dev/ttyUSB0 ?

On my side i have :

cubox-i# ll /dev/ttyUSB crw-rw---T 1 root dialout 188, 0 Jan 1 1970 /dev/ttyUSB0

And :

cubox-i# lsusb Bus 001 Device 002: ID 1da8:1301 Bus 002 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I'll check the code to see why you don't have any exceptions / additionnal informations (maybe in the meanwhile you could add the --debug parameter in the .sh or at your launch command).

elyobelyob commented 9 years ago

Thanks for response.

pi@raspberrypi ~/currentcost $ ls -l /dev/ttyUSB0 crw-rw---T 1 root dialout 188, 0 Feb 5 18:45 /dev/ttyUSB0

pi@raspberrypi ~/currentcost $ lsusb Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 007: ID 04d9:1603 Holtek Semiconductor, Inc. Keyboard Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 006: ID 174c:5106 ASMedia Technology Inc. Transcend StoreJet 25M3 Bus 001 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I am running the currentcost through a 7 port powered hub, as I have moved the OS onto a HDD. Could that be anything to do with it?

On Thu, Feb 5, 2015 at 7:00 PM, Serge notifications@github.com wrote:

With such a high rate, I guess it doesn't work on your side because it constantly disconnects/reconnects. Are you sure your current cost device is on /dev/ttyUSB0 ? What are your permissions on /dev/ttyUSB0 ?

On my side i have :

cubox-i# ll /dev/ttyUSB crw-rw---T 1 root dialout 188, 0 Jan 1 1970 /dev/ttyUSB0

And :

cubox-i# lsusb Bus 001 Device 002: ID 1da8:1301 Bus 002 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I'll check the code to see why you don't have any exceptions / additionnal informations (maybe in the meanwhile you could add the --debug parameter in the .sh or at your launch command).

— Reply to this email directly or view it on GitHub https://github.com/SR-G/current-cost-forwarder/issues/1#issuecomment-73105006 .

SR-G commented 9 years ago

Ok so :

elyobelyob commented 9 years ago

Am running the latest Raspbian on a pi2 ...

There is only ttyUSB0, no *1's

pi@raspberrypi ~/currentcost $ ls /dev/ttyU* /dev/ttyUSB0

with debug on...

pi@raspberrypi ~/currentcost $ ./current-cost-forwarder.sh --debug 0 [main] INFO org.tensin.ccf.boot.CurrentCostForwarder - Classpath : initial classpath=

0 [main] INFO org.tensin.ccf.boot.CurrentCostForwarder - Manifest : Manifest-Version: 1.0 Implementation-Title: current-cost-forwarder Implementation-Version: 1.0.0-SNAPSHOT Main-Class: org.tensin.ccf.boot.CurrentCostForwarder

00:18:50.227 [main] INFO org.tensin.ccf.CurrentCostForwarder - Debug activated 00:18:50.271 [main] INFO org.tensin.ccf.CurrentCostForwarder - Writing retrieved PID [10731] in PID file [./current-cost-forwarder.pid] 00:18:50.338 [main] INFO org.tensin.ccf.CurrentCostForwarder - Now starting CurrentCostForwarder 00:18:50.412 [main] INFO org.tensin.ccf.forwarder.mqtt.ForwarderMQTT - Starting MQTT forwarder with topic base name [metrics/current-cost], mqtt broker MQTTBrokerDefinition : broker-auth [false], broker-url [tcp://127.0.0.1:1883], broker-password [] 00:18:50.460 [main] INFO org.tensin.ccf.forwarder.mqtt.ForwarderMQTT - Now starting MQTT client on broker url [tcp://127.0.0.1:1883], client ID is [pi.1423181930456], without authentification 00:18:50.674 [main] INFO org.tensin.ccf.CurrentCostForwarder - Now starting reader 00:18:50.684 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Trying to autodect mirror4j device in [/dev/] with pattern [ttyUSB.*] 00:18:50.782 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Auto-detected current cost device [/dev/ttyUSB0] 00:18:50.900 [main] INFO org.tensin.ccf.reader.CurrentCostReader - Starting CurrentCostForwarder reader thread on device [/dev/ttyUSB0] 00:18:50.902 [main] INFO org.tensin.ccf.CurrentCostForwarder - CurrentCostForwarder started in [564ms] 00:18:50.905 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.000 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.100 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.200 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.300 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.400 [THREAD-CURRENT-COST-FORWARDER-READER] INFO org.tensin.ccf.reader.CurrentCostReader - Now connected on specified device [/dev/ttyUSB0] 00:18:51.500 [THREAD-CURRENT-COST-FORWARDER-READER] INFO

SR-G commented 9 years ago

Hey again, I've uploaded a new snapshot distribution. It won't correct your problem as i have no clue what's going on on your side, but there are a few additionnal debug logs and some global exceptions betterly catchted that could now help to understand what's happening.

Could you please try that distribution (still with --debug) and give me back the log ? (still the same link than before, https://github.com/SR-G/current-cost-forwarder/releases/download/1.0.0-SNAPSHOT/current-cost-forwarder-1.0.0-SNAPSHOT.zip )

elyobelyob commented 9 years ago

I only have ttyUSB0 .. no more shown.

pi@raspberrypi ~/currentcost $ ./current-cost-forwarder.sh --debug 0 [main] INFO org.tensin.ccf.boot.CurrentCostForwarder - Classpath : initial classpath=

0 [main] INFO org.tensin.ccf.boot.CurrentCostForwarder - Manifest : Manifest-Version: 1.0 Implementation-Title: current-cost-forwarder Implementation-Version: 1.0.0-SNAPSHOT Main-Class: org.tensin.ccf.boot.CurrentCostForwarder Source-Compatibility: 1.6 Target-Compatibility: 1.6 Built-JDK: 1.6.0_45 Built-Date: Fri Feb 06 14:15:17 CET 2015

14:47:18.578 [main] INFO org.tensin.ccf.CurrentCostForwarder - Debug activated 14:47:18.621 [main] INFO org.tensin.ccf.CurrentCostForwarder - Writing retrieved PID [27352] in PID file [./current-cost-forwarder.pid] 14:47:18.688 [main] INFO org.tensin.ccf.CurrentCostForwarder - Now starting CurrentCostForwarder 14:47:18.693 [main] INFO org.tensin.ccf.forwarder.console.ForwarderConsole

On Fri, Feb 6, 2015 at 1:28 PM, Serge notifications@github.com wrote:

Hey again, I've uploaded a new snapshot distribution. It won't correct your problem as i have no clue what's going on on your side, but there are a few additionnal debug logs and some global exceptions betterly catchted that could now help to understand what's happening.

Could you please try that distribution (still with --debug) and give me back the log ? (still the same link than before, https://github.com/SR-G/current-cost-forwarder/releases/download/1.0.0-SNAPSHOT/current-cost-forwarder-1.0.0-SNAPSHOT.zip )

— Reply to this email directly or view it on GitHub https://github.com/SR-G/current-cost-forwarder/issues/1#issuecomment-73235915 .

SR-G commented 9 years ago

I'm really lost :( Everything seems to be fine on your side, i don't see why the code is behaving that way (no exception, error on the CurrentCostReader > FileInputStream.read() method on the device ... Which java version are you running ?

cubox-i# java -version
java version "1.7.0_71"
Java(TM) SE Embedded Runtime Environment (build 1.7.0_71-b14, headless)
Java HotSpot(TM) Embedded Client VM (build 24.71-b01, mixed mode)

On my side i don't un with an openjdk implementation but with a JRE provided by Oracle.

elyobelyob commented 9 years ago

pi@raspberrypi ~/currentcost $ java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)

On Fri, Feb 6, 2015 at 3:07 PM, Serge notifications@github.com wrote:

I'm really lost :( Everything seems to be fine on your side, i don't see why the code is behaving that way (no exception, error on the CurrentCostReader > FileInputStream.read() method on the device ... Which java version are you running ?

cubox-i# java -version java version "1.7.0_71" Java(TM) SE Embedded Runtime Environment (build 1.7.0_71-b14, headless) Java HotSpot(TM) Embedded Client VM (build 24.71-b01, mixed mode)

On my side i don't un with an openjdk implementation but with a JRE provided by Oracle.

— Reply to this email directly or view it on GitHub https://github.com/SR-G/current-cost-forwarder/issues/1#issuecomment-73250108 .

SR-G commented 9 years ago

I'll try with a jre 1.8.0 but would be surprised to be the problem. Are you running the program as root ? Otherwise (as stated in the doc) you have to put 666 permissions on the device (chmod a+r,a+w /dev/ttyUBS0).

elyobelyob commented 9 years ago

Interestingly, it now says this .. is this good news?

20:02:07.597 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device 20:02:07.598 [THREAD-CURRENT-COST-FORWARDER-READER] DEBUG org.tensin.ccf.reader.CurrentCostReader - Just received some characters from device

SR-G commented 9 years ago

Hey, if you are still interested, the problem you had in the end (connection ok but no messages decode) may have been resolved (see other issue https://github.com/SR-G/current-cost-forwarder/issues/2) (was a different separator between my (old) current cost and new ones).

elyobelyob commented 9 years ago

Great thanks. I am now receiving data through. Unfortunately it's all gobbledegook. I've ordered a new CC cable, as this one may have got damaged when it fell out. Alternatively, is the baud setting defaulted or needs to be manually set?

SR-G commented 9 years ago

Hey. About baud rate setting : it is invisible from the program view (which only use an usb device) and as far as i know, dealed only inside the linux device layer used with the RS232 <> USB adapter. You can check your device baud rate with : stty -F /dev/ttyUSB0 Or change it with : stty -F /dev/ttyUSB0 115200 (but on my side, no need to change anything about this).

What do you mean by gobbledegook, could you post some log (in debug mode, with today .zip) ?

elyobelyob commented 9 years ago

Give me a few days for the replacement cable. It was giving me spurious results under python as well. Cable fell apart. On 2 Mar 2015 19:07, "Serge" notifications@github.com wrote:

Hey. About baud rate setting : it is invisible from the program view (which only use an usb device) and as far as i know, dealed only inside the linux device layer used with the RS232 <> USB adapter. You can check your device baud rate with : stty -F /dev/ttyUSB0 Or change it with : stty -F /dev/ttyUSB0 115200 (but on my side, no need to change anything about this).

What do you mean by gobbledegook, could you post some log (in debug mode, with today .zip) ?

— Reply to this email directly or view it on GitHub https://github.com/SR-G/current-cost-forwarder/issues/1#issuecomment-76784406 .

elyobelyob commented 9 years ago

OK, all working. Looks like the cable was also slightly dodgy and was corrupting the data.

SR-G commented 9 years ago

Great to hear that. Closing the issue.