diff --git a/README.md b/README.md index 0d76b8b..35ce35f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +# Licence Information + +I am pleased to offer this solution freely for personal use, in perpetuity, as my contribution to care in the community. If you are interested in developing a commercial product based on this repository, feel free to reach out. I am available for consultancy work, or we can arrange a licensing agreement. + +If you find this project helpful and would like to show your appreciation, you can buy me a coffee at https://ko-fi.com/laurencemolloy + +Thank you for your support + # SignsOfLife (User Activity Monitor) This project monitors user activity on a computer and sends email notifications when no user activity is detected for a specified period and also when user activity resumes. It tracks both keyboard and mouse events and triggers alerts accordingly. @@ -44,3 +52,53 @@ Combine_states.py runs every 30 minutes via CI/CD (see combine_states.yml in the Testing shows the process takes about 20 seconds of CI/CD runner time per run. At 30-minute intervals, this amounts to roughly 500 minutes per month. With GitHub providing 2000 free CI/CD minutes monthly, this should comfortably fit within your free allowance - assuming light CI/CD usage elsewhere. +# Changing the timings + +This solution was developed to monitor a relative who works from home, ensuring timely response while minimizing false alarms. Regular activity checks help improve reaction times without generating unnecessary alerts. + +If your use case differs - such as monitoring a device that is used less frequently - you can adjust the timing settings to reduce false alarms. + +### Key Variables to Modify + +To customize the check and alert intervals, adjust the following variables: + +- **`CHECK_INTERVAL_SECONDS`** +- **`ALERT_INTERVAL_SECONDS`** + +### Where to Update These Variables + +You will need to modify these settings in two locations: + +- Client: **Local `.env` file** +- Server: **GitHub Repository Environment Variables** + +**To update GitHub environment variables:** + +1. Go to **Settings** in your GitHub repository. +2. Navigate to **Secrets & Variables > Actions**. +3. Select the **Variables** tab. +4. Update the relevant variables in the **Environment Variables** table. + +### Recommended Configuration + +For optimal performance, set the **`CHECK_INTERVAL_SECONDS`** to **1/3 or 1/4** of the **`ALERT_INTERVAL_SECONDS`**. This ensures multiple checks will occur between repository updates, increasing accuracy without overloading the system. + + +# Building a solution for other devices + +The current solution is designed for desktops and laptops. Expanding to include mobile devices and tablets is a future possibility, requiring the development of Android and iOS versions of signs_of_life.py. + +The Android solution would need to: + + - Assess user activity state every 5 minutes. + - Maintain a local state. + - Commit changes to data/states/state_xxx.txt and data/heartbeats/heartbeat_xxx.txt to the designated GitHub repository every 15 minutes. + +xxx represents your device ID and must be unique within your device estate. + +User activity state is evaluated over the past 15 minutes. If any activity is detected during this window, the state is "active"; otherwise, it is "inactive." + + - state.txt must contain either "active" or "inactive". + - heartbeat.txt must contain a timestamp only. + +I welcome pull requests that add Android or Apple iOS signs-of-life monitoring capabilities to the repository. diff --git a/src/client/windows/signs_of_life.py b/src/client/windows/signs_of_life.py index 6a352c8..c11432a 100644 --- a/src/client/windows/signs_of_life.py +++ b/src/client/windows/signs_of_life.py @@ -1,3 +1,10 @@ +# Capture this error and report to the user by EMAIL!!! +# +# To https://github.com/LaurenceMolloy/SignsOfLife.git +# ! [remote rejected] main -> main (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/combine_states.yml` without `workflow` scope) +# error: failed to push some refs to 'https://github.com/LaurenceMolloy/SignsOfLife.git' +# Failed to push changes: Command '['git', 'push', '--force', 'https://@github.com/LaurenceMolloy/SignsOfLife.git', 'main']' returned non-zero exit status 1. + import time import subprocess from pynput import mouse, keyboard