4
4
5
5
Support RDTech UM24C, UM25C, UM34C.
6
6
7
- ## Running
7
+ ## Library usage
8
8
9
- ### Bluetooth initialisation
9
+ Open an UM-Meter interface and request data:
10
+
11
+ ``` python
12
+ from pyummeter import UMmeter
13
+
14
+ with UMmeter(" /path/to/serial/port" ) as meter:
15
+ data = meter.get_data()
16
+ print (f " { data[' voltage' ]} V / { data[' power' ]} W " )
17
+ ```
10
18
19
+ It is also possible to export the data to a CSV file:
20
+
21
+ ``` python
22
+ from datetime import datetime
23
+ from pyummeter import UMmeter
24
+ from pyummeter.export_csv import ExportCSV
25
+
26
+ csv = ExportCSV(" /path/to/csv" )
27
+ with UMmeter(" /path/to/serial/port" ) as meter:
28
+ csv.update(datetime.now(), meter.get_data())
11
29
```
30
+
31
+ List of data available:
32
+
33
+ - ` model ` : UM-Meter model name (* exported to CSV* )
34
+ - ` voltage ` : Voltage (V) (* exported to CSV* )
35
+ - ` intensity ` : Intensity (A) (* exported to CSV* )
36
+ - ` power ` : Power (W) (* exported to CSV* )
37
+ - ` resistance ` : Resistance (Ohm) (* exported to CSV* )
38
+ - ` usb_voltage_dp ` : USB Voltage D+ (V) (* exported to CSV* )
39
+ - ` usb_voltage_dn ` : USB Voltage D- (V) (* exported to CSV* )
40
+ - ` charging_mode ` : Charging mode short name (* exported to CSV* )
41
+ - ` charging_mode_full ` : Charging mode full name
42
+ - ` temperature_celsius ` : Temperature (°C) (* exported to CSV* )
43
+ - ` temperature_fahrenheit ` : Temperature (°F)
44
+ - ` data_group_selected ` : Selected data group (index)
45
+ - ` data_group ` : Data for each data group (list) (* exported to CSV, only the selected group* )
46
+ - ` capacity ` : Capacity (Ah)
47
+ - ` energy ` : Energy (Wh)
48
+ - ` record_capacity_threshold ` : [ Record mode] Capacity threshold (Ah) (* exported to CSV* )
49
+ - ` record_energy_threshold ` : [ Record mode] Energy threshold (Wh) (* exported to CSV* )
50
+ - ` record_intensity_threshold ` : [ Record mode] Intensity threshold (A) (* exported to CSV* )
51
+ - ` record_duration ` : [ Record mode] Duration (seconds) (* exported to CSV* )
52
+ - ` record_enabled ` : [ Record mode] Enable status (* exported to CSV* )
53
+ - ` screen_index ` : Screen index
54
+ - ` screen_timeout ` : Screen timeout
55
+ - ` screen_brightness ` : Screen brightness
56
+ - ` checksum ` : Checksum of all data
57
+
58
+ Meter control managed (not available on all model):
59
+
60
+ - Screen control:
61
+ - Change (next/previous)
62
+ - Rotate
63
+ - Set timeout (0 to 9 minutes)
64
+ - Set brightness (0 to 5)
65
+ - Data group control:
66
+ - Select (0 to 9, next)
67
+ - Clear
68
+ - Record threshold (0 to 300 mA)
69
+
70
+ ## Running example
71
+
72
+ ### Bluetooth initialisation
73
+
74
+ ``` shell
12
75
$ sudo killall rfcomm
13
76
$ rfkill block bluetooth
14
77
$ rfkill unblock bluetooth
@@ -22,7 +85,7 @@ $ sudo rfcomm connect /dev/rfcomm0 <MAC>
22
85
23
86
### Demo application usage
24
87
25
- ```
26
- $ poetry install --no-dev
27
- $ poetry run task demo -p /dev/rfcomm0
88
+ ``` shell
89
+ poetry install
90
+ poetry run task demo -t /dev/rfcomm0
28
91
```
0 commit comments