magcode / sem6000-mqtt

MQTT for VOLTCRAFT SEM6000
GNU General Public License v3.0
17 stars 4 forks source link

Don't understand how to work #2

Open everything-everything opened 3 years ago

everything-everything commented 3 years ago

Hallo, i try to use this on ubuntu 21.04 with an bluetooth dongle but it doesn't work.

15:41:21.139 [main] INFO Sem6000MqttClient - Started

15:41:26.141 [main] INFO Sem6000MqttClient - Loading properties from /home/Schreibtisch/Voltcraft/Java/sem6000.properties

Exception in thread "main" java.lang.NumberFormatException: For input string: "30 "

at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.base/java.lang.Integer.parseInt(Integer.java:652)

at java.base/java.lang.Integer.valueOf(Integer.java:983)

at org.magcode.sem6000.mqtt.Sem6000MqttClient.readProps(Sem6000MqttClient.java:143)

at org.magcode.sem6000.mqtt.Sem6000MqttClient.main(Sem6000MqttClient.java:43)

i get that on if i type java -jar sem6000.jar volt1 power java -jar sem6000.jar /volt1 /power java -jar sem6000.jar /volt1/power java -jar sem6000.jar /volt1 power java -jar sem6000.jar

yes i know its renamed the jar file but it doesn't matter

The log file looks like 021-05-29 15:23:09.096 [main] INFO Sem6000MqttClient - Started

2021-05-29 15:23:14.100 [main] INFO Sem6000MqttClient - Loading properties from /home/power1/Schreibtisch/Voltcraft/Java/sem6000.properties

2021-05-29 15:23:47.092 [main] INFO Sem6000MqttClient - Started

2021-05-29 15:23:52.098 [main] INFO Sem6000MqttClient - Loading properties from /home/Schreibtisch/Voltcraft/Java/sem6000.properties

2021-05-29 15:24:06.728 [main] INFO Sem6000MqttClient - Started

2021-05-29 15:24:11.731 [main] INFO Sem6000MqttClient - Loading properties from /home/Schreibtisch/Voltcraft/Java/sem6000.properties --> there is the propertie file and jar file

rootTopic=/media/sf_Linux/Voltcraft
mqttServer=tcp://10.0.2.15 # Mqtt Service runs under linux have a rule in firewall... should be lokal. Have i add here the device?

sem1.mac=XX:XX:XX:XX:XX:XX # Mac adress is new

sem1.pin=0000 by default

sem1.name=volt1

sem1.refresh=30

Note the expection shell script works fine Heckie works fine.

what make i wrong ? do i need a special mqtt server. Make i something wrong with root directory , ports etc? I see in vm that it comunicate with sem6000 in virtualbox

magcode commented 3 years ago

Please build it from the sources and try again. For your convenience I published release 1.0.1

everything-everything commented 3 years ago

Ok what have i to do ?

git clone https://github.com/magcode/sem6000-mqtt/

and than? What do i need to compile this to jar file ? Sorry it is a very new knowledge for me.

i see you have compiled it and uploaded newer Version. Thanks for that . Will try .

so i have anothter Question. You write :

Raspberry PI 3 B, Raspbian 10 Buster, OpenJDK 11.0.7, Bluez 5.50, built-in Bluetooth adapter usb:v1D6Bp0246d0532 Raspberry PI 3 B, Raspbian 10 Buster, OpenJDK 11.0.7, Bluez 5.50, USB Bluetooth adapter 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle Virtual machine, Ubuntu 20.04, OpenJDK 11.0.7, Bluez 5.54, Intel Bluetooth adapter 8087:0a2b

In configuration file you have specify an MQTT Server. If i execute jar file need i an specified MQTT Server, or does the Jar File Create a MQTT Server Session?

And what about this explanation :

//voltage (voltage) is that mean java -jar sem6000.jar /volt1 /power or what does that mean`?
everything-everything commented 3 years ago

Note this isn't close :D does it automatical :D by past information

FibreFoX commented 2 years ago

@everything-everything This is a Java project that uses Maven as its build-system. You could either install maven yourself (https://maven.apache.org/download.cgi) and run mvn package in the cloned folder, or you could use the prebuilt that got provided by the author: https://github.com/magcode/sem6000-mqtt/releases/download/1.0.1/sem6000-mqtt-1.0.1-jar-with-dependencies.jar

So when having your configuration file, which contains the broker and your sensor-details, this tool will send gathered data from the sensor via MQTT packages to the MQTT broker. So <roottopic from properties file>/<name of sem6000 from properties file>/voltage does not mean parameters for running this tool, but the data packages that get posted to the MQTT broker.

All in all this is some kind of a "active sensor data publisher" that actively requests data from the sensor and converts it into MQTT messages. Your configuration rootTopic=/media/sf_Linux/Voltcraft suggest that you think this is some kind of "file storage", but this is one of the MQTT message parts, not a filename where the data gets stored. And yes, you are required to have your own MQTT server running somewhere where all the data is pushed from this tool.

I hope this helps a bit.

franq77 commented 1 year ago

I have all installed, compiled, properties file configured and and musquito mqtt server running inside Homeassistant. The mqtt server is properly working, tested that. Unfortunately when I run the java tool (inside the home assistant console) I get an "Exception in thread "main" Not authorized to connect".

Any idea how to resolve this?