Skip to content

jorgeffonte/Altaiclockin-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Altaiclockin Automation

Automates clock-in and clock-out on https://app.altaiclockin.com/ using Selenium. Available in two modes: Standalone script for manual execution and Docker API service altaiclockin_api/README.md for automation and Home Assistant integration.

πŸ“ Project Structure

Altaiclockin-Automation/
β”œβ”€β”€ altaiclockin.py      # Standalone script for manual execution
β”œβ”€β”€ requirements.txt     # Dependencies for standalone version
β”œβ”€β”€ README.md           # This file
└── altaiclockin_api/   # Docker API service
    β”œβ”€β”€ .env            # Environment configuration
    β”œβ”€β”€ .gitignore      # Git ignore rules for API directory
    β”œβ”€β”€ app.py          # FastAPI API
    β”œβ”€β”€ altaiclockin.py # Selenium script (API version)
    β”œβ”€β”€ docker-compose.yml # Docker Compose configuration
    β”œβ”€β”€ Dockerfile.slim # Optimized Docker image definition
    β”œβ”€β”€ requirements.txt # Dependencies for API version
    β”œβ”€β”€ install-altaiclockin.sh # Installation script for Proxmox LXC
    └── README.md       # Detailed Docker documentation

πŸš€ Quick Start

Option 1: Standalone Script (Manual execution)

Perfect for running manually or integrating with your own scripts.

Requirements
  • Python 3.8+
  • Firefox browser
  • Selenium WebDriver
Installation
# Clone the repository
git clone <repository-url>
cd altaiclockin_loger

# Install dependencies
pip install -r requirements.txt

# Set your credentials (recommended)
export ALTAICLOCKIN_USERNAME="your_username"
export ALTAICLOCKIN_PASSWORD="your_password"

# Or edit the script directly (lines 31-32 in altaiclockin.py)
Usage
# Clock in
python3 altaiclockin.py checkin

# Clock out
python3 altaiclockin.py checkout
Option 2: Docker API Service (Automation)

Perfect for Home Assistant integration and automated environments.

Features

  • 🐳 Docker containerized service
  • 🌐 REST API endpoints
  • 🏠 Home Assistant integration ready
  • πŸ“Š Health check endpoints
  • πŸ”§ Environment variable configuration
  • πŸ’Ύ Optimized image size (1.04GB)

For detailed Docker setup instructions, see: altaiclockin_api/README.md

πŸ”§ Configuration

Standalone Version Configuration

Set environment variables:

export ALTAICLOCKIN_USERNAME="your_username"
export ALTAICLOCKIN_PASSWORD="your_password"

Or edit the script directly (lines 31-32):

USERNAME = os.getenv("ALTAICLOCKIN_USERNAME", "your_username")
PASSWORD = os.getenv("ALTAICLOCKIN_PASSWORD", "your_password")
Docker API Version Configuration

Configure via .env file in altaiclockin_api/ directory:

ALTAICLOCKIN_USERNAME=your_username
ALTAICLOCKIN_PASSWORD=your_password
PORT=8990

🏠 Home Assistant Integration

Step 1: Update configuration.yaml

First, add the REST commands to your Home Assistant configuration.yaml:

rest_command:
  altaiclockin_checkin:
    url: "http://<docker_host_ip>:8990/checkin"  # Replace with your server IP
    method: POST
    headers:
      Content-Type: "application/json"
    payload: "{}"
    timeout: 120

  altaiclockin_checkout:
    url: "http://<docker_host_ip>:8990/checkout"  # Replace with your server IP
    method: POST
    headers:
      Content-Type: "application/json"
    payload: "{}"
    timeout: 120
Step 2: Create Automations

Automatic check-in when entering work zone:

alias: "Register Check-in"
description: "Automatically clock in when entering work zone"
triggers:
  - trigger: zone
    entity_id: person.your_name  # Replace with your person entity
    zone: zone.work  # Replace with your work zone
    event: enter
conditions: []
actions:
  - action: rest_command.altaiclockin_checkin
    data: {}
    response_variable: altaiclockin_response
  - if:
      - condition: template
        value_template: "{{ altaiclockin_response.content.status == 'ok' }}"
    then:
      - action: notify.mobile_app_your_device  # Replace with your notification service
        data:
          title: "Altaiclockin Check-in"
          message: >-
            Check-in '{{ altaiclockin_response.content.status }}'
            completed successfully
    else:
      - action: notify.mobile_app_your_device
        data:
          title: "Altaiclockin ERROR"
          message: "Could not register check-in: {{ altaiclockin_response }}"
mode: single

Automatic check-out when leaving work zone:

alias: "Register Check-out"
description: "Automatically clock out when leaving work zone"
triggers:
  - trigger: zone
    entity_id: person.your_name  # Replace with your person entity
    zone: zone.work  # Replace with your work zone
    event: leave
conditions: []
actions:
  - action: rest_command.altaiclockin_checkout
    data: {}
    response_variable: altaiclockin_response
  - if:
      - condition: template
        value_template: "{{ altaiclockin_response.content.status == 'ok' }}"
    then:
      - action: notify.mobile_app_your_device
        data:
          title: "Altaiclockin Check-out"
          message: >-
            Check-out '{{ altaiclockin_response.content.status }}'
            completed successfully
    else:
      - action: notify.mobile_app_your_device
        data:
          title: "Altaiclockin ERROR"
          message: "Could not register check-out: {{ altaiclockin_response }}"
mode: single

Configuration Notes:

  • Replace <docker_host_ip> with your actual server IP address
  • Replace person.your_name with your actual person entity ID
  • Replace zone.work with your actual work zone entity ID
  • Replace mobile_app_your_device with your actual notification service
  • The timeout: 120 gives the Selenium automation enough time to complete

Docker API Version

See altaiclockin_api/README.md for Docker-specific troubleshooting.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test both standalone and Docker versions
  5. Submit a pull request

πŸ“„ License

This project is open source. Use responsibly and in accordance with your company's policies.

⚠️ Disclaimer

This tool is for automating your own legitimate clock-in/out activities. Ensure you comply with your company's policies and local labor laws.

About

Automated clock-in/out solution for Altaiclockin.com using Selenium. Includes standalone Python script and Docker API service with Home Assistant integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors