Code Monkey home page Code Monkey logo

timesheet-cube's Introduction

timesheet-cube

A janky Timeular alternative using an Aqara cube and an Office365 calendar

I am not paying £70 for a bit of plastic and £10 a month to use it. But I would find some of the features, namely, a way of tracking which project I'm currently working on and for it to be historically referable. Ideally I would like it to magically fill in my timesheets for various clients automatically, but, I'm a realist and will settle for an Outlook calendar being populated for me.

I already have an Office 365 subscription with calendars and I don't mind spending £20 on AliExpress for some bits.

Shopping list

  1. An Aqara Cube: https://www.aliexpress.com/af/aqara-cube.html
  2. A USB Zigbee gateway: https://www.aliexpress.com/af/usb-zigbee.html

Setup

Create a new calendar Create an Office365 Enterprise app with the calendar permissions identified in https://github.com/O365/python-o365#calendar Populate a '.env' file in the root of this repo when cloned with the info for your calendar and EA

CALENDAR_NAME="YourNewCalendar"
CALENDAR_OWNER="[email protected]"
CLIENT_ID="0000-0000-0000-0000-0000"
CLIENT_SECRET="000000000000"
TENANT_ID="0000-0000-0000-0000-0000"

Add some more to make things a bit more readable

INTERVAL=1
CUBE_FACE_ONE="OFF"
CUBE_FACE_TWO="label"
CUBE_FACE_THREE="label"
CUBE_FACE_FOUR="label"
CUBE_FACE_FIVE="label"
CUBE_FACE_SIX="label"

Running it

docker-compose -f docker-compose.yaml up --build OR ./run-locally

Using it

You should now have an API that accepts a 'new_face' query string to a 'change' endpoint, eg 127.0.0.1:8000/change?new_face=three.

In my setup I have a HomeAssistance container configured with a ZigBee network and the cube as a registered device. A helper stores the current value of the cube and a custom script for each 'face' triggers a curl to the new API

The blueprint is here: 'misc/homeassistant-automation.yaml' the 'config/configuration.yaml' looks like

shell_command:
  flip_face_one: curl -s --request POST '192.168.111.200:8000/change?new_face=one'
  flip_face_two: curl -s --request POST '192.168.111.200:8000/change?new_face=two'
  flip_face_three: curl -s --request POST '192.168.111.200:8000/change?new_face=three'
  flip_face_four: curl -s --request POST '192.168.111.200:8000/change?new_face=four'
  flip_face_five: curl -s --request POST '192.168.111.200:8000/change?new_face=five'
  flip_face_six: curl -s --request POST '192.168.111.200:8000/change?new_face=six'

timesheet-cube's People

Contributors

avaines avatar

Stargazers

 avatar Edmund Craske avatar

Watchers

 avatar Edmund Craske 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.