Giter Club home page Giter Club logo

gas_meter_rest_service's Introduction

gas_meter_rest_service

SpringBoot REST Service to provide gas meter reading via i2c QMC5883L 3-Axis Magnetic Sensor on Raspberry Pi. Depends on Python driver for the QMC5883L 3-Axis Magnetic Sensor project

e.g. http://localhost:8081/energy

*{

  • "timestamp": "2020-10-03T15:19:17Z",
  • "consumption": 2352.0,
  • "serverID": "09 01 49 ... 4F 3E 5D", *}

Rest Service for use with OpenHAB

Rest Service can run on other server (Server B / Raspberry Pi) than OpenHAB server

Configuration for OpenHAB to visualize electricity meter data

openhab config files to visualize electricity meter included in project

Prerequisites

  1. Install OpenHab on Linux Server A e.g. via docker-compose.yml -> https://github.com/openhab/openhab-docker
  1. Pepare Linux Server B to serve the REST Service
  • Connect cable from 3-axis compass to raspberry pi
  • TODO: some more details.... (see below part)
  1. Build REST Service (tested with java11)
  • maven based SpringBoot Service (mvn clean package)
  1. Transfer build jar file to Server B and start REST Service
  • Start REST Service via "java -jar gas_meter_rest_service-1.0-SNAPSHOT.jar"
  • Crontab restart scenario:
  • @reboot /home/pi/git/gas_meter_rest_service/scripts/test_raw.sh > /dev/null 2>&1
  • @reboot /usr/bin/java -jar /home/pi/git/gas_meter_rest_service/target/gas_meter_rest_service-1.0-SNAPSHOT.jar > /dev/null 2>&1

Java

Following parameters are relevant

  • value of current gas meter in "currentGasValue.txt" file
  • id of gas meter in "gasMeterId.txt" file

Related links

  1. https://github.com/abhiTronix/py-qmc5883l
  2. https://www.kompf.de/tech/gascountmag.html

gas meter

sudo apt-get update ls /dev/i2c -> ls: cannot access '/dev/i2c': No such file or directory sudo apt-get install -y i2c-tools sudo raspi-config -> Enable "ARM I2C interface" sudo i2cdetect -y 1 -> shows some table information now ls /dev/i2c -> shows "/dev/i2c-1" sudo i2cget 1 0x0d 0x01 -> 0x00 sudo apt-get install python sudo apt-get install python-smbus sudo apt-get install python-pip git clone https://github.com/abhiTronix/py-qmc5883l.git vim py-qmc5883l/py_qmc5883l/init.py -> change from smbus2 to smbus cd py-qmc5883l sudo pip install . -> Successfully installed py-qmc5883l-0.1.1

cd ../gasmeter/ ./test_raw.sh

java -jar qmc5883l-0.0.1-SNAPSHOT.jar cd git/gasmeter/input/

gas_meter_rest_service's People

Contributors

tbet avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.