Giter Site home page Giter Site logo

myoung34 / tilty Goto Github PK

View Code? Open in Web Editor NEW
14.0 5.0 4.0 5.51 MB

A pluggable system to receive and transmit bluetooth events from the Tilt Hydrometer

License: MIT License

Dockerfile 2.13% Makefile 1.22% Go 96.66%
bluetooth webhook beer golang hydrometer ibeacon hacktoberfest hacktoberfest-accepted

tilty's Introduction

Tilty

This project has moved to the more generic bluey which supports the same functionality with slightly different configurations

tilty's People

Contributors

dependabot[bot] avatar myoung34 avatar nalabelle avatar ozamosi avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

tilty's Issues

Set and use calibration information

I've found that my Tilt is off slightly when calibrated in filtered water. The Tilt iOS app takes this into account, but this project does not seem to do the same. I'm not sure if this would be as simple as adding an offset when pulling the current gravity.

Unhandled http exception crash in daemon mode

When running in daemon mode (-r/--keep-running) an unhandled http exception will halt the process.

Considering fixing this, but would like to know if you have any preferences for how to handle these?

Thinking of putting a generic exception handler around scan_and_emit in the thread loop: tilty/cli.py#L74, having it log the errors+traces, but keep going. Alternatively, maybe the webhook emitter should do its own exception handling for the common http error cases. Also, in that case, should retryable http errors get retried or just wait for the next event loop?

Specific problem below; I think this might just be intermittent connection issues on my network. Trace line numbers might be slightly off due to local changes:

Exception in thread tilty_daemon:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xffff83d1d5b0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3.8/site-packages/urllib3-1.25.10-py3.8.egg/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='log.brewfather.net', port=443): Max retries exceeded with url: /tilt?id=[REDACTED] (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff83d1d5b0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/site-packages/Tilty-0.6.3-py3.8.egg/tilty/cli.py", line 74, in scan_and_emit_thread
  File "/usr/lib/python3.8/site-packages/Tilty-0.6.3-py3.8.egg/tilty/cli.py", line 52, in scan_and_emit
  File "/usr/lib/python3.8/site-packages/Tilty-0.6.3-py3.8.egg/tilty/tilty.py", line 59, in emit
  File "/usr/lib/python3.8/site-packages/Tilty-0.6.3-py3.8.egg/tilty/emitters/webhook.py", line 80, in emit
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests-2.24.0-py3.8.egg/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='log.brewfather.net', port=443): Max retries exceeded with url: /tilt?id=[REDACTED] (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xffff83d1d5b0>: Failed to establish a new connection: [Errno -3] Try again'))                                                                                                                                                                                                                                                                                                                                                         

Tilty always uses 100% CPU

The last 2 lines in cli.py creates an infinite loop that busy-waits, which will always try to use up one complete CPU core. This causes my raspberry pi to become hot.

I considered a lazy solution of just replacing the pass with sleep, but then I'm a bit confused why that thread needs to exist at all.

Any way to distinguish between two tilts that are the same color?

Hi

I am testing the tilt devices out and want to use them in large quantities (more than the 8 colours).
Is there a way using your system to monitor more than one of the same colour (e.g. two yellow tilts).

I understand that they have different UUID but thought there might be a way around it.

Thanks

configparser breaks on duplicate sections

$ poetry run tilty -c config.ini
Traceback (most recent call last):
  File "/home/myoung/.cache/pypoetry/virtualenvs/tilty-2nsyYZ1s-py3.7/bin/tilty", line 33, in <module>
    sys.exit(load_entry_point('Tilty', 'console_scripts', 'tilty')())
  File "/home/myoung/.cache/pypoetry/virtualenvs/tilty-2nsyYZ1s-py3.7/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/myoung/.cache/pypoetry/virtualenvs/tilty-2nsyYZ1s-py3.7/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/myoung/.cache/pypoetry/virtualenvs/tilty-2nsyYZ1s-py3.7/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/myoung/.cache/pypoetry/virtualenvs/tilty-2nsyYZ1s-py3.7/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/myoung/repos/github/tilty/tilty/cli.py", line 66, in run
    CONFIG.read(config_file)
  File "/home/myoung/.asdf/installs/python/3.7.2/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/myoung/.asdf/installs/python/3.7.2/lib/python3.7/configparser.py", line 1065, in _read
    lineno)
configparser.DuplicateSectionError: While reading from 'config.ini' [line 18]: section 'webhook' already exists

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.