Giter VIP home page Giter VIP logo

hoplite's Introduction

HOPLITE

Screenshots

Hardware

Configuration

Wiki

A Python application to monitor the status of a kegerator. Runs on a Raspberry Pi that has one or more HX711 load cell amplifiers and an ST7735 LCD attached.

Hardware docs are barebones at the moment. After the reference hardware has been reworked, better documentation will be provided.

Supports:

  • Monitoring beer levels via weight, using HX711 load cell amplifiers
  • Monitoring CO2 tank levels, also via HX711s
  • Temperature monitoring via DS18B20 1-wire bus temp sensor
  • Outputting data to an attached ST7735 LCD
  • A web interface that reports data and allows configuring keg names and sizes on-the-fly in a more convenient manner

SECURITY

THIS SOFTWARE IS NOT BEING CREATED WITH ANY SORT OF SECURITY CONSIDERATIONS IN MIND.

DO NOT EXPOSE THIS APPLICATION TO THE INTERNET, ESPECIALLY THE WEB INTERFACE.

IF YOU REALLY WANT REMOTE ACCESS, USE A VPN.

INSTALLATION

AS OF VERSION 1.2.0 PYTHON 3 IS REQUIRED.

You'll save time and skip having to install gfortran if you install the repo version of python-numpy.

sudo apt-get update
sudo apt-get install python3-numpy

I also recommend disabling CPU frequency scaling. On my system, this helped with weight updates occasionally failing, causing keg weights to fluctuate randomly.

sudo apt-get install cpufrequtils
echo "GOVERNOR=performance" | sudo tee /etc/default/cpufrequtils
sudo systemctl restart cpufrequtils

The only prerequisite that you'll need to manually install is the hx711py module.

sudo pip3 install git+https://github.com/tatobari/hx711py.git

After installing hx711py, clone this respository and run

sudo python3 setup.py install

Or use pip:

sudo pip3 install git+https://github.com/yesrod/hoplite.git

HARDWARE

See Hardware

CONFIGURATION

All configuration is done via the REST API. Hoplite will start with an empty config to allow you to customize the config to your setup.

API documentation can be found on the wiki.

After you have a roughly accurate config, stop Hoplite and tare all the connected HX711s. Make sure the load sensor platforms are empty!

python -m hoplite --tare --config /etc/hoplite/config.json

Then get a known weight of some sort (in grams) and calibrate your weight sensors:

# this example assumes a 1000 gram test weight
python -m hoplite --cal 1 A 1000 --config /etc/hoplite/config.json
# repeat for all channels defined in the config

Then start Hoplite again - weights should be accurate after tare and calibration.

RUNNING HOPLITE

For the main daemon (start this before the web interface)

python -m hoplite

Optionally, specify a config file location

python -m hoplite --config /etc/hoplite/config.json

For the web interface

python -m hoplite.web

systemd

Systemd service files are in the systemd/ folder in the repo.

These will run Hoplite as root - this isn't a requirement, however. Hoplite will run as a non-root user, as long as the user is a member of the gpio, i2c and spi groups.

cp systemd/hoplite*.system /etc/systemd/system/
systemctl daemon-reload
systemctl start hoplite
systemctl start hoplite-web

To start on boot, install the files as above, then

systemctl enable hoplite
systemctl enable hoplite-web

hoplite's People

Contributors

yesrod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kaschik

hoplite's Issues

Add an About page on the web GUI

Would be neat to have a help/about page on the Web GUI that links to the wiki, and has the current version of Hoplite, the hardware it's running on, and maybe an update checker.

Applying settings in web interface causes duplicates of weight data

Ended up with this mess during troubleshooting of #5 - every time I attempt to save data back to the shmem, the weight data is duplicated.

pi@hoplite:~ $ sudo cat /dev/shm/hoplite
{
  "data": {
    "co2": [
      60
    ],
    "temp": -687,
    "weight": [
      [
        17446,
        -9628
      ],
      [
        6189,
        1295
      ],
      [
        17447,
        -9604
      ],
      [
        6192,
        1283
      ],
      [
        17443,
        -9657
      ],
      [
        6188,
        1250
      ],
      [
        17443,
        -9602
      ],
      [
        6187,
        1296
      ],
      [
        17444,
        -9624
      ],
      [
        6185,
        1332
      ]
    ]
  },
  "config": {
    "hx": [
      {
        "channels": {
          "A": {
            "co2": false,
            "name": "Not Quite Cherry Gose",
            "weight": 17391,
            "tare": 4,
            "volume": 18.9,
            "refunit": 20.958,
            "offset": 298472,
            "size": "corny"
          }
        },
        "pd_sck": 6,
        "dout": 5
      },
      {
        "channels": {
          "A": {
            "co2": true,
            "name": "CO2",
            "weight": 6185,
            "tare": 4.82,
            "volume": 2.27,
            "refunit": 21.401,
            "offset": 128516,
            "size": "custom"
          }
        },
        "pd_sck": 13,
        "dout": 12
      }
    ],
    "weight_mode": "as_kg_net"
  }
}

Python 3 support/cutover

In theory Hoplite should still run with Python3 from the work done for v1.0.6 but I haven't tested it yet.

Since Python 2 is EOL I should make Hoplite Python3 only.

SNMP, LLDP, MDNS support

Adding additional protocols and things could make the experience a lot more pleasant and extensible.

Setting a keg tare weight or volume to 0 causes a division by zero error

This happens in both web and main processes.

Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/__main__.py", lin
Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/__main__.py", lin
Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/hoplite.py", line
Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/hoplite.py", line
Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/hoplite.py", line
Apr 26 21:18:37 hoplite python2[2293]:   File "build/bdist.linux-armv6l/egg/hoplite/hoplite.py", line
Apr 26 21:18:37 hoplite python2[2293]: ZeroDivisionError: float division by zero
Apr 26 21:18:37 hoplite python2[2294]: remi.update      ERROR    error updating gui
Apr 26 21:18:37 hoplite python2[2294]: Traceback (most recent call last):
Apr 26 21:18:37 hoplite python2[2294]:   File "/usr/local/lib/python2.7/dist-packages/remi/server.py"
Apr 26 21:18:37 hoplite python2[2294]:     client.idle()
Apr 26 21:18:37 hoplite python2[2294]:   File "build/bdist.linux-armv6l/egg/hoplite/web.py", line 95,
Apr 26 21:18:37 hoplite python2[2294]:     i = int(index) - 1
Apr 26 21:18:37 hoplite python2[2294]:   File "build/bdist.linux-armv6l/egg/hoplite/web.py", line 77,
Apr 26 21:18:37 hoplite python2[2294]:     except KeyError:
Apr 26 21:18:37 hoplite python2[2294]: ZeroDivisionError: float division by zero

Automatically build RasPi images

Figure out a way to use pipelines to build RasPi images for releases and on every commit. There should be an existing method to build a minimal Raspbian/Ubuntu/LibreELEC image via GitHub, then cram in Hoplite.

Backend rework for 2.0

  • Introduce a tap object
    • Taps are where the beer comes out
    • Single object associated with kegs, specific sensor channels, in both real life and Hoplite
    • tap object will have references to a specific sensor instance and a single channel on said instance
    • also a reference to the currently loaded keg object for that tap
  • Create a generic sensor object
    • Subclass that object for hx711_sensor
    • Allows common logic for different sensor types in the future
  • Move all weight->volume logic inside keg objects
    • update() function for getting new weight data, converting to available volume
    • available_volume() function for getting that converted data out
    • data stored internally as metric volume, do all weight->volume conversion during update()
  • Rework UI process
    • Create sensor, define type, channels, etc.
    • Create tap, associate with sensor
    • Create keg with sizes, beer names, etc.
    • Associate keg with specific tap

Expand web UI configuration options

Need to be able to perform all tasks from the Web UI:

  • Create/delete sensor listings
  • Add/remove kegs from sensor listings
  • Change system-wide settings (preferred units, etc.)

Can't set weight mode via web interface anymore

Something somewhere is stomping on the weight_mode setting when its set via the web interface.

I can change keg settings and they stick, but if I change keg setting plus weight_mode, everything reverts.

The shmem stuff is a mess anyway, may fix this by moving the web interface to using the API.

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.