File: README.md

package info (click to toggle)
pyvesync 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,824 kB
  • sloc: python: 15,994; makefile: 3
file content (106 lines) | stat: -rw-r--r-- 3,553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# pyvesync testing script

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.

## Setup and Installation

### From Repository

1. Clone the repo branch `dev` or replace `dev` with the branch you wish to test:

```bash
git clone -b dev --single-branch https://github.com/webdjoe/pyvesync.git
```

2. Navigate to the repository directory: `cd pyvesync`

Optionally create a virtual environment:

   ```bash
   python -m venv venv
   source venv/bin/activate  # On Powershell use `venv\Scripts\activate.ps1`
   ```

3. Install the current branch:

   ```bash
   pip install -e .
   ```

4. Run the testing script:

   ```bash
   python testing_scripts/vs_console_script.py --email <your_email> --password <your_password> [optional arguments]
    ```

### Just run the script

1. Create a directory and navigate to it:

   ```bash
   mkdir pyvesync_testing
   cd pyvesync_testing
   ```

2. Create a virtual environment:

   ```bash
    python -m venv venv
    source venv/bin/activate  # On Powershell use `venv\Scripts\activate.ps1`
    ```

3. Install the `pyvesync` library branch `dev` or replace `dev` with the branch you wish to test:

   ```bash
   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
   ```

4. Download the `vs_console_script.py` file from the `testing_scripts` directory of the repository and place it in your current directory using a browser or `wget`/`curl` command:

   ```bash
   wget https://raw.githubusercontent.com/webdjoe/pyvesync/dev/testing_scripts/vs_console_script.py
   ```

5. Run the testing script:

   ```bash
    python vs_test_script.py --email <your_email> --password <your_password> [optional arguments]
    ```

### Running in VS Code or other IDE's

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.

## Configuration

**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 to `True` to test device functionality.
- `TEST_TIMERS`: Set to `True` to test timer functionality.
- `OUTPUT_FILE`: Path to the output file for logging.
- `TEST_DEV_TYPE`: Specific device type to test (Options are  "bulbs", "switchs", "outlets", "humidifiers", "air_purifiers", "fans").

CONFIGURING VIA COMMAND LINE:

You can also configure the script via command line arguments:

```bash
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", "switchs", "outlets", "humidifiers", "air_purifiers", "fans"
```

## Logging

The script logs output to both the console and a file specified by the `OUTPUT_FILE` variable.