https://github.com/v-2841/tapo_socket_charging
This repository contains code for controlling a Tapo socket based on battery percentage of the host system
https://github.com/v-2841/tapo_socket_charging
python3 pywin32
Last synced: 12 months ago
JSON representation
This repository contains code for controlling a Tapo socket based on battery percentage of the host system
- Host: GitHub
- URL: https://github.com/v-2841/tapo_socket_charging
- Owner: v-2841
- License: mit
- Created: 2024-03-13T06:37:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-14T07:36:17.000Z (over 2 years ago)
- Last Synced: 2025-04-12T06:57:30.854Z (over 1 year ago)
- Topics: python3, pywin32
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Charging Control
This repository contains code for controlling a Tapo socket based on battery percentage of the host system. It ensures the socket is turned on when the battery falls below a certain threshold and turned off when the battery reaches a certain level while charging.
## Setup
1. Clone the repository and navigate to it in the command line:
```bash
git clone git@github.com:v-2841/tapo_socket_charging.git
cd tapo_socket_charging
```
2. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/Scripts/activate
```
3. Install dependencies from the requirements.txt file:
```bash
pip install -r requirements.txt
```
## Usage
The `charging.py` script monitors the battery percentage of the host system and controls the Tapo socket accordingly.
To use the script, run the following command in virtual environment:
```bash
python charging.py
```
### Command Line Arguments
- `--add-to-taskschd`: Adds the script to Windows Task Scheduler to run at user logon.
- `--remove-from-taskschd`: Removes the script from Windows Task Scheduler.
## Code Structure
The code consists of two main Python scripts:
1. `charging.py`: This script monitors the battery percentage and controls the Tapo socket accordingly.
2. `taskschd.py`: This script contains functions to add and remove the main script from Windows Task Scheduler.
## License
This project is licensed under the MIT License - see the LICENSE file for details.