Skip to content

ingeint/idempiere-scaleconnector-plugin

Repository files navigation

iDempiere ScaleConnector Plugin

This project is an integration between iDempiere and digital scales with the aim of get the sensor measure from iDempiere. ScaleConnector can be configured to sync with any device or sensor (temperature, humidity, pressure, weighing, accountant, etc.) that communicate through the RS-232 serial port.

Official documentation here

Dependencies

  • Java 11
  • iDempiere 8

Components

ScaleConnector GUI

Running the application as developer:

./gradlew run --args="gui"

Installing the application:

./gradlew build
sudo unzip -d /opt/ ./scaleconnector-gui/build/distributions/scaleconnector-gui.zip
sudo ln -s /opt/scaleconnector-gui/bin/scaleconnector-gui /usr/local/bin/scaleconnector-gui

Printing help:

scaleconnector-gui -h

Running on GUI mode:

scaleconnector-gui gui

Running on console TCP server mode:

scaleconnector-gui server -p 5000

Creating a linux service:

sudo mkdir -p /var/lib/scaleconnector-gui
sudo cp ./scaleconnector-gui/scaleconnector.service /etc/systemd/system/scaleconnector.service
sudo systemctl daemon-reload
sudo systemctl enable scaleconnector
sudo systemctl start scaleconnector

ScaleConnector REST

Installing httpie (REST client):

sudo apt install httpie

Running the application as developer:

./gradlew bootRun --args="--server.port=9090"
http :9090/actuator/health

Executing a test request:

http :9090/read type=TEST date=$(date +"%Y-%m-%dT%T")

Executing a read request:

http :9090/read < ./scaleconnector-rest/read-request.json

Installing the application:

./gradlew bootJar
sudo mkdir -p /opt/scaleconnector-rest
sudo cp ./scaleconnector-rest/build/libs/scaleconnector-rest.jar /opt/scaleconnector-rest/
java -jar /opt/scaleconnector-rest/scaleconnector-rest.jar --server.port=9090

Creating a linux service:

sudo mkdir -p /var/lib/scaleconnector-rest
sudo cp ./scaleconnector-rest/scaleconnector-rest.service /etc/systemd/system/scaleconnector-rest.service
sudo systemctl daemon-reload
sudo systemctl enable scaleconnector-rest
sudo systemctl start scaleconnector-rest

ScaleConnector Plugin

Copying and Building plugin:

./build-plugin

The env variable IDEMPIERE_REPOSITORY is needed for building the plugin.

Output ./scaleconnector-plugin/com.ingeint.scaleconnector.targetplatform/target/

Other useful commands

Emulating a serial port on linux:

sudo usermod -a -G dialout $(whoami)
sudo apt install socat
socat -d -d \
  pty,raw,nonblock,echo=0,iexten=0,link=/tmp/tty.fake.slave \
  pty,raw,nonblock,echo=0,iexten=0,link=/tmp/tty.fake.master
while :; do echo "B0+0000155 Kg054B" > /tmp/tty.fake.master; sleep 0.2; done

Sometimes it's necessary to restart the session after adding new users to a group

Check physical serial port:

setserial -g /dev/ttyS*

Check logs for servers:

tail -f /var/log/syslog | grep scaleconnector

Run test:

./gradlew test

About

Digital Scales Integration to iDempiere

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages