This script can be used to test the function of the pyvesync library and log output to a file for better support with issues. It supports testing the library's functionality with various devices and configurations.
- Clone the repo branch
devor replacedevwith the branch you wish to test:
git clone -b dev --single-branch https://github.com/webdjoe/pyvesync.git- Navigate to the repository directory:
cd pyvesync
Optionally create a virtual environment:
python -m venv venv
source venv/bin/activate # On Powershell use `venv\Scripts\activate.ps1`-
Install the current branch:
pip install -e . -
Run the testing script:
python testing_scripts/vs_console_script.py --email <your_email> --password <your_password> [optional arguments]
-
Create a directory and navigate to it:
mkdir pyvesync_testing cd pyvesync_testing -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Powershell use `venv\Scripts\activate.ps1`
-
Install the
pyvesynclibrary branchdevor replacedevwith the branch you wish to test:pip install git+https://github.com/webdjoe/pyvesync.git@dev # Or install from a PR pip install git+https://github.com/webdjoe/pyvesync.git@refs/pull/<PR_NUMBER>/head
-
Download the
vs_console_script.pyfile from thetesting_scriptsdirectory of the repository and place it in your current directory using a browser orwget/curlcommand:wget https://raw.githubusercontent.com/webdjoe/pyvesync/dev/testing_scripts/vs_console_script.py
-
Run the testing script:
python vs_test_script.py --email <your_email> --password <your_password> [optional arguments]
The script can be run directly in an IDE like Visual Studio Code. Open the vs_console_script.py file and edit the USERNAME and PASSWORD variables at the top of the file with your VeSync account credentials, along with any other . Then run the script using the IDE's debug command.
WARNING: The script will try to return the device to original state after testing, but it is not guaranteed to restore all states.
You can configure the script by modifying the following variables in the vs_console_script.py file:
USERNAME: Your VeSync account email.PASSWORD: Your VeSync account password.TEST_DEVICES: Set toTrueto test device functionality.TEST_TIMERS: Set toTrueto test timer functionality.OUTPUT_FILE: Path to the output file for logging.TEST_DEV_TYPE: Specific device type to test (Options are "bulbs", "switches", "outlets", "humidifiers", "air_purifiers", "fans").
CONFIGURING VIA COMMAND LINE:
You can also configure the script via command line arguments:
python vs_test_script.py \ # or testing_scripts/vs_test_script.py if using repository method
--email <your_email> \
--password <your_password> \
--test-devices \ # Include device methods in the test
--test-timers \ # Include timer methods in the test
--output-file <output_file> \
--test-dev-type <device_type> # Options: "bulbs", "switches", "outlets", "humidifiers", "air_purifiers", "fans"The script logs output to both the console and a file specified by the OUTPUT_FILE variable.