Giter Site home page Giter Site logo

abaker / emu2influx Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 6.0 362 KB

Import Rainforest Automation EMU-2 energy monitoring data into InfluxDB

License: Apache License 2.0

Python 96.75% Dockerfile 2.13% Shell 1.12%
smartmeter home-assistant-sensor docker influxdb

emu2influx's Introduction

emu2influx uses Rainforest Automation's Emu-Serial-API to insert EMU-2 (Amazon.com) energy monitoring data into InfluxDB

armhf and amd64 images are available on Docker Hub at bakerba/emu2influx

Your EMU-2 must be provisioned with your utility company and connected to your PC

Prerequisites

$ brew install python2 influxdb
$ brew services start influxdb
  • Debian/Ubuntu:
sudo apt install python-pip libxslt1-dev influxdb

Setup

$ git clone --recursive https://github.com/abaker/emu2influx.git
$ cd emu2influx
$ pip install -r requirements.txt 

Run

$ python emu2influx.py <emu2_serial_port>

By default emu2influx will connect to a local InfluxDB install, use the default credentials, and store data in a table named rainforest

usage: emu2influx.py [-h] [--debug] [--host HOST] [--port PORT]
                     [--username USERNAME] [--password PASSWORD] [--db DB]
                     [--retries RETRIES]
                     serial_port

positional arguments:
  serial_port          Rainforest serial port, e.g. 'ttyACM0'

optional arguments:
  -h, --help           show this help message and exit
  --debug              enable debug logging
  --host HOST          influx host
  --port PORT          influx port
  --username USERNAME  influx username
  --password PASSWORD  influx password
  --db DB              influx database name
  --retries RETRIES    influx retries

Docker

$ docker run --device=/dev/ttyACM0 bakerba/emu2influx --host <influx_ip> ttyACM0

Example usage in docker-compose.yml

version: '3.3'

services:
  emu2influx:
    image: bakerba/emu2influx
    container_name: emu2influx
    network_mode: host
    devices:
      - /dev/ttyACM0:/dev/ttyACM0
    restart: unless-stopped
    command: '--host <influx_ip> ttyACM0'

What next?

emu2influx's People

Contributors

abaker avatar jfessard avatar kpabap avatar peplin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

emu2influx's Issues

homeassistant/influxDB sensor example request

You mention creating an influxDB sensor in the homeassistant config so that it can be used directly in the "What next" section/
Did you manage to do it? The syntax is all but clear, and I am not sure if I can create a sensor that reads from a different influx DB than the home_assistant one (I chose to upload the demand values to a seprarate db.)

thanks.

[Python2] `int() Can't convert non-string with explicit base`

Hi, Every time I run, after a few minutes, it hits that error and just completely stops running altogether. (I have to kill -9 the python2 process)
Any idea what it could be? Maybe some bad data comes in the serial once in a while and breaks it?
Running from direct command line on ubuntu, Python 2.7.17 (default, Jul 20 2020, 15:37:01)

Apart from that, the tool is perfect!

Traceback (most recent call last):
  File "./emu2influx.py", line 127, in <module>
    main(client=emu(args.serial_port), db=influx)
  File "./emu2influx.py", line 65, in main
    timestamp = get_timestamp(instantaneous_demand)
  File "./emu2influx.py", line 16, in get_timestamp
    return datetime.utcfromtimestamp(Y2K + int(obj.TimeStamp, 16)).isoformat()
TypeError: int() can't convert non-string with explicit base

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.