/workorder

A Python app with Selenium to automatically populate work time :office: :clock3: in a web form :pencil: combined with a (local) API with database to receive and store data send from Tasker. Running in Docker🐳 containers. This repo is monitored with drone for build🔨 and deploy🚀

Primary LanguagePython

Workorder

GitHub repo size GitHub commit activity GitHub last commit (branch)

Application running in Kubernetes K8s

Table of contents:

Requirements

  • A server, PC, or other device running Docker.
  • Android device to run Tasker.

How it works

  1. Your phone (Tasker) monitors whether you arrive at work 🏢 based on the WiFi signal that your phone receives and stores the date and start time locally in a tasker variable, the same happens when you leave work, an end time will be stored. A notification with the saved time appears after a trigger

  2. If new data is stored in Tasker the saved times will be sent to the API and stored in a database only if the phone is connected to the home 🏠 WiFi network because the API can only be accessed from the locale network. This will be executed at fixed time 04:00 in the morning, the time can be changed in the Tasker XML or in the Tasker App.

  3. At 07:00 data is retrieved from the same database, entered into the workorder and sent. A python script take care of this part. (Docker Worker container)

Setup

Docker host

  1. Clone this repository to your docker host.
git clone https://github.com/theautomation/workorder.git
  1. Change "prd-workorder-app.env.example to "prd-workorder-app.env".
mv ./prd-workorder-app.env.example ./prd-workorder-app.env
  1. Fill in the environment variables in the "prd-workorder-app.env" file.
# URL to open
WEB_URL="https://example.com"

# Credentials for login
WEB_USERNAME="username"
WEB_PASSWORD="password"

# To find and fill in the correct workorder, make a comma separated list of words to search for.
# The words may be part of text for e.g. if the word "dienst" is in the list it will find "Weekenddienst", "Avonddienst" and "Dagdienst"
WORKORDER_WORDS="dienst, Operator, motorkap"

# Save a .png image of the workorder with filled in time
# Set true to save a image otherwise set false or empty
# The path where images will be saved in the 'worker' docker container is '/app/log'
SAVE_IMAGE=true
  1. Bring up the containers with docker-compose up -d

Android

  1. Install Tasker.
  2. Download or copy the Tasker project XML on your device Link
  3. Change wifi SSID's in the XML or later in the Tasker app after importing the XML
  4. Import the XML in Tasker.
  5. Make sure that Tasker is allowed to run in background. More info at dontkillmyapp.com