|
| 1 | +# How to Access Data from the DashIO Server |
| 2 | + |
| 3 | +This guide explains how to retrieve data from the DashIO server for time graphs, maps, and logs using the utility `dashio_data_exporter` included in the dashio library package. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3 |
| 8 | +- DashIO library package |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +```bash |
| 13 | +pip3 install dashio |
| 14 | +``` |
| 15 | + |
| 16 | +The data retrieval script is included as a utility in the dashio package. |
| 17 | + |
| 18 | +## Basic Usage |
| 19 | + |
| 20 | +```bash |
| 21 | +python -m dashio.utilities.get_data -u USERNAME -p PASSWORD -d DEVICE_ID -c CONTROL_ID [options] |
| 22 | +``` |
| 23 | + |
| 24 | +## Command Line Arguments |
| 25 | + |
| 26 | +| Argument | Description | |
| 27 | +|----------|-------------| |
| 28 | +| `-u`, `--username` | Your DashIO username | |
| 29 | +| `-p`, `--password` | Your DashIO password | |
| 30 | +| `-d`, `--device_id` | The ID of the device to access | |
| 31 | +| `-c`, `--control_id` | The ID of the control to access | |
| 32 | +| `-t`, `--type` | Control type: `TGRPH` (time graph), `MAP`, or `LOG` (default: `TGRPH`) | |
| 33 | +| `-n`, `--number_of_days` | Number of days of data to retrieve (default: 1) | |
| 34 | +| `-f`, `--format` | Output format: `raw` or `csv` (default: `raw`) | |
| 35 | +| `-s`, `--screen` | Display output to the screen | |
| 36 | +| `-o`, `--outfile` | Write output to file(s) | |
| 37 | + |
| 38 | +## Examples |
| 39 | + |
| 40 | +### Retrieving Time Graph Data |
| 41 | + |
| 42 | +```bash |
| 43 | +python -m dashio.utilities.get_data -u myusername -p mypassword -d mydevice -c mygraph -t TGRPH -n 3 -s |
| 44 | +``` |
| 45 | + |
| 46 | +This retrieves 3 days of time graph data for the specified device and control, displaying the output on screen. |
| 47 | + |
| 48 | +### Saving Map Data to a File |
| 49 | + |
| 50 | +```bash |
| 51 | +python -m dashio.utilities.get_data -u myusername -p mypassword -d mydevice -c mymap -t MAP -f csv -o |
| 52 | +``` |
| 53 | + |
| 54 | +This retrieves map data in CSV format and saves it to a file. |
| 55 | + |
| 56 | +### Getting Log Data |
| 57 | + |
| 58 | +```bash |
| 59 | +python -m dashio.utilities.get_data -u myusername -p mypassword -d mydevice -c mylog -t LOG -s -o |
| 60 | +``` |
| 61 | + |
| 62 | +This retrieves log data, displaying it on screen and saving it to a file. |
| 63 | + |
| 64 | +## Output File Naming |
| 65 | + |
| 66 | +When using the `-o` option, files are named using the pattern: |
| 67 | +``` |
| 68 | +[device_id]_[control_type]_[control_id]_[line_id].[format] |
| 69 | +``` |
| 70 | + |
| 71 | +## Understanding Output Formats |
| 72 | + |
| 73 | +### Raw Format |
| 74 | + |
| 75 | +The raw format preserves the original structure from the server with tab-separated values: |
| 76 | +``` |
| 77 | +[device_id] [control_type] [control_id] [data...] |
| 78 | +``` |
| 79 | + |
| 80 | +### CSV Format |
| 81 | + |
| 82 | +The CSV format converts time graph data to a more readable format: |
| 83 | +``` |
| 84 | +# [device_id], TGRPH, [control_id], [line_id], [line_name], [line_type], [line_color], [line_axis] |
| 85 | +Timestamp, Value |
| 86 | +[timestamp], [value] |
| 87 | +[timestamp], [value] |
| 88 | +... |
| 89 | +``` |
0 commit comments