Code Monkey home page Code Monkey logo

aw-watcher-table's Introduction

aw-watcher-table

Create releases for Linux and Windows stars

An Activity Watch watcher which monitors whether you have set your height-adjustable table to sitting or standing.

Also try my new utilization watcher: aw-watcher-utilization

1

Idea

Unfortunately my adjustable table doesn't have either an API or anything similar. Therefore I need an external device which measures the height of the table. This external device must have internet access and a distance sensor.

Implementation

Hardware

Electronics

I have used an ESP8266 micro controller. It has built-in Wi-Fi and GPIOs to control sensors. As a distance sensor I have used an HC-SR04 Ultrasonic Sensor, because I already had it on hand.

Case

I printed my case using the Prusa I3 MK3. As modeling software I used Fusion360. You can download the 3D model here (Thingiverse).

0

Price

Name Price
ESP8266 €6.50
HC-SR04 €5.16
3D Printed Case ~€0.25
Total €11.91

Definitely affordable.

Test

When the hardware is finished and powered on, it should be possible to get the table height via the curl command:

# curl http://192.168.2.4/measure
{"table_height":128}

Software

Install

  1. Go to the config directory. Find the path for your OS here.
  2. In the aw-qt directory find the aw-qt.ini file.
  3. Add the aw-table-watcher to autostart_modules to enable auto-start. It should look like this:
[aw-qt]
autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window", "aw-watcher-table"]

[aw-qt-testing]
autostart_modules = ["aw-server", "aw-watcher-afk", "aw-watcher-window", "aw-watcher-table"]

DEV setup

Install

virtualenv venv # create virtual environment
venv\Scripts\activate # activate virtual environment
poetry install # install required packages

Run

poetry run aw-watcher-table [--testing] [-v] [--verbose]

Build

pyinstaller --clean pyinstaller.spec

Test

  1. Move the aw-watcher-table folder to the Activity Watch installation folder
  2. Restart Activity Watch
  3. Right click the Activity Watch tray icon. Under Modules find the aw-table-watcher. Check it to start the aw-watcher-table.

2

aw-watcher-table's People

Contributors

alwinator avatar smnmsr avatar zhaw-moss avatar

Stargazers

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

Watchers

 avatar  avatar

aw-watcher-table's Issues

README outdated and with typo

  • In the description of the module autostart there's a typo: "aw-table-watcher" instead of "aw-watcher-table"
  • it is not the file aw-qt.ini anymore
  • the README lacks information on the installation of the visualization

TypeError: '<=' not supported between instances of 'int' and 'NoneType'

alwin@monster ~/.c/a/aw-qt> 2021-05-10 13:02:12 [WARNING]: aw-watcher-table: Measurement failed! Please make sure http://192.168.2.4/measure delivers a JSON object which includes the field "table_height"  (aw_watcher_table.watcher:52)
2021-05-10 13:02:12 [ERROR]: Unhandled exception  (root:43)
Traceback (most recent call last):
  File "aw_watcher_table/__init__.py", line 29, in <module>
  File "aw_watcher_table/__init__.py", line 25, in main
  File "aw_watcher_table/watcher.py", line 34, in run
  File "aw_watcher_table/watcher.py", line 63, in heartbeat_loop
  File "aw_watcher_table/watcher.py", line 40, in ping
  File "aw_watcher_table/watcher.py", line 57, in get_table_status
  File "aw_watcher_table/settings.py", line 20, in height_level
  File "aw_watcher_table/settings.py", line 36, in __contains__
TypeError: '<=' not supported between instances of 'int' and 'NoneType'
[22632] Failed to execute script __init__

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.