Coder Social home page Coder Social logo

easymeter-py's Introduction

easymeter-py

Python script to read power meter data from Easymeter meters and publish them via mqtt and/or into a sqlite database.

I'm using this script on a Raspberry Pi 4 with rasbian buster and the "IR Schreib/Lesekopf USB (Optokopf)" USB IR reader from Weidmann with an EASYMETER Q3DA. Maybe you have to change something for other setups.

Requirements

  • You need an optical interface e.g. https://shop.weidmann-elektronik.de/index.php?page=product&info=24 with serial output.
  • Python3 is required (developed with 3.8.1)
  • If you want to use the sqlite export, it is a little bit more complex, because the compiled python3 packages from apt-get have no sqlite support and you have to compile python on our own (see below)

Installation

Install python3

With sqlite support

  • run compile_python_sqlite.sh to compile python with sqlite support (takes long time!)

Without sqlite support

  • sudo apt-get install python3

Setup python3

Setup a virtual environment

  • I recommend to create and use a virtual python environment for this script
  • Open the easymeter-py path
  • python3.8 -m venv py-env to create a virtual env
  • source py-env/bin/activate to use virtual env
  • pip3 install -r requirements.txt to install python modules

Setup without virtual environment

  • pip3 install -r requirements.txt to install python modules

Edit Config

  • Edit config.py, set your device path ("dev"), mqtt settings, sqlite path...
  • Possible loglevels are: ERROR, DEBUG (others are currently not in use). Set loglevel to "DEBUG" for testing

First run

  • Set the loglevel in config.py to "DEBUG" and run ./easymeter-py.sh
  • You should see a lot debug informations, but no Exceptions
  • Check if the sqlite database has been created in the specified path (config.py)
  • Check if the mqtt messages will be published correctly
  • Exit with CTRL+C

Install systemd service and enable autostart

  • Remind to set loglevel back to "ERROR" (in config.py) to avoid huge log files
  • Set the correct path for easymeter-py.sh in easymeter-py.service
  • sudo cp easymeter-py.service /etc/systemd/system to copy the service to your systemd path
  • sudo systemctl enable easymeter-py to start easymeter-py automatically
  • sudo systemctl start easymeter-py to start easymeter-py now
  • sudo systemctl status easymeter-py to check if there are erorrs (1 error "reading failed" at the begining is ok)

Misc

For bugs or feature requests, please create an issue on github. "Star" or "Watch" the github repo if you like my work.

Regards, Arne Drees

easymeter-py's People

Contributors

arneman avatar

Watchers

James Cloos 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.