Skip to main content

LSPM - Laptop Smart Power Manager

Project description

LSPM - Laptop Smart Power Manager

The Laptop Smart Power Manager is a lightweight tool designed to autonomously manage laptop battery charge cycles with the help of a Smart Plug.

Description

When we are at home or at work, we may tend to leave our laptop plugged in and constantly charging. The problem of this practice is that it will damage the laptop battery prematurely.
To extend the battery life, it is recommended to unplug the charger before the battery reaches 100% and plug it in long before the battery is completely discharged. However, constantly keeping an eye on your computer's battery level turns out to be difficult in practice.

This is what the Laptop Smart Power Manager has to offer: it takes care of managing, for you, the charging cycles of your laptop in order to optimize its battery life.

To achieve this, LSPM needs an additional accessory: a Smart Plug.
The laptop must be plugged into the Smart Plug and both must be connected to the same local network:

Diagram of LSPM

The operating principle is quite simple:

  • if the battery level drops below 20%, LSPM tells the Smart Plug to turn on. The laptop then starts charging.
  • if the battery level reaches 100%, LSPM tells the Smart Plug to turn off. The laptop then stops charging.

Table of Contents

Installation

lspm can be installed using the package manager pip.

pip install lspm

Configuration

Prerequisites

Before using LSPM, your Smart Plug must be plugged in, configured and connected to the same local network as your laptop.

To work properly, LSPM needs some information about the Smart Plug:

  • IP Address
  • Username
  • Password

Command Line Interface

The easiest way is to use the command line tool lspm.

For the first use, enter the configuration parameters of your Smart Plug using the command lspm config:

$> lspm config
Enter the Smart Plug IP Address:
Enter a new username: 
Enter a new password: 

To get the available options for this command, run lspm config --help.

Usage

Command Line Interface

The easiest way is to use the command line tool lspm.

To start LSPM, run the command lspm start:

$> lspm start
Laptop Smart Power Manager started correctly
To stop it, press CTRL + C (on macOS, Command + .)

To stop it, press CTRL + C (or Command + . on macOS). Then, the following message should show up:

Laptop Smart Power Manager stopped successfully

Supported devices

TP-Link

  • Tapo
    • P100
    • P105 (not tested)
    • P110 (not tested)

Contributing

Contributions, issues and feature requests are always welcome!

License

Copyright © 2023 Imanol Setoain.
This project is MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lspm-0.1.dev1.tar.gz (13.5 kB view hashes)

Uploaded Source

Built Distribution

lspm-0.1.dev1-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page