ents 2.3.4__tar.gz → 2.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {ents-2.3.4 → ents-2.3.6}/PKG-INFO +58 -104
  2. {ents-2.3.4 → ents-2.3.6}/README.md +56 -102
  3. {ents-2.3.4 → ents-2.3.6}/pyproject.toml +2 -2
  4. {ents-2.3.4 → ents-2.3.6}/src/ents/__init__.py +4 -1
  5. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/recorder.py +4 -4
  6. {ents-2.3.4 → ents-2.3.6}/src/ents/cli.py +321 -6
  7. {ents-2.3.4 → ents-2.3.6}/src/ents/config/user_config.py +1 -4
  8. ents-2.3.6/src/ents/dirtviz/__init__.py +8 -0
  9. ents-2.3.6/src/ents/dirtviz/client.py +223 -0
  10. ents-2.3.6/src/ents/dirtviz/plots.py +50 -0
  11. ents-2.3.6/src/ents/proto/sensor.py +290 -0
  12. ents-2.3.6/src/ents/proto/sensor_pb2.py +48 -0
  13. ents-2.3.6/src/ents/proto/soil_power_sensor_pb2.py +118 -0
  14. {ents-2.3.4 → ents-2.3.6}/src/ents/simulator/node.py +159 -0
  15. ents-2.3.6/tests/test_sensor.py +219 -0
  16. {ents-2.3.4 → ents-2.3.6}/tests/test_simulator.py +3 -0
  17. ents-2.3.4/src/ents/demo/demoPullRequests.py +0 -119
  18. ents-2.3.4/src/ents/proto/soil_power_sensor_pb2.py +0 -90
  19. {ents-2.3.4 → ents-2.3.6}/.gitignore +0 -0
  20. {ents-2.3.4 → ents-2.3.6}/LICENSE +0 -0
  21. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/PingSMU.py +0 -0
  22. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/PingSPS.py +0 -0
  23. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/README.md +0 -0
  24. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/__init__.py +0 -0
  25. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/linear_regression.py +0 -0
  26. {ents-2.3.4 → ents-2.3.6}/src/ents/calibrate/plots.py +0 -0
  27. {ents-2.3.4 → ents-2.3.6}/src/ents/config/README.md +0 -0
  28. {ents-2.3.4 → ents-2.3.6}/src/ents/config/__init__.py +0 -0
  29. {ents-2.3.4 → ents-2.3.6}/src/ents/config/adv_trace.py +0 -0
  30. {ents-2.3.4 → ents-2.3.6}/src/ents/proto/__init__.py +0 -0
  31. {ents-2.3.4 → ents-2.3.6}/src/ents/proto/decode.py +0 -0
  32. {ents-2.3.4 → ents-2.3.6}/src/ents/proto/encode.py +0 -0
  33. {ents-2.3.4 → ents-2.3.6}/src/ents/proto/esp32.py +0 -0
  34. {ents-2.3.4 → ents-2.3.6}/src/ents/simulator/__init__.py +0 -0
  35. {ents-2.3.4 → ents-2.3.6}/tests/__init__.py +0 -0
  36. {ents-2.3.4 → ents-2.3.6}/tests/test_generic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ents
3
- Version: 2.3.4
3
+ Version: 2.3.6
4
4
  Summary: Python package for Environmental NeTworked Sensor (ENTS)
5
5
  Project-URL: Homepage, https://github.com/jlab-sensing/soil-power-sensor-firmware
6
6
  Project-URL: Issues, https://github.com/jlab-sensing/soil-power-sensor-firmware/issues
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.11
13
13
  Requires-Dist: matplotlib
14
14
  Requires-Dist: pandas
15
- Requires-Dist: protobuf==6.31.1
15
+ Requires-Dist: protobuf==6.33.4
16
16
  Requires-Dist: pyserial
17
17
  Requires-Dist: requests
18
18
  Requires-Dist: scikit-learn
@@ -34,14 +34,14 @@ The soil power sensor protobuf protocol is implemented as a Python package that
34
34
  Use the following to install the `ents` package with gui via `pip`:
35
35
 
36
36
  ```bash
37
- pip install ents[gui]
37
+ pip install ents
38
38
  ```
39
39
 
40
40
  You can also install the package from source with the following:
41
41
 
42
42
  ```bash
43
43
  # install package
44
- pip install .[gui]
44
+ pip install .
45
45
  ```
46
46
 
47
47
  If you are planning to develop the package we recommend you install the package
@@ -51,114 +51,68 @@ reinstall it.
51
51
 
52
52
  ```bash
53
53
  # install development dependencies
54
- pip install -e .[gui,dev]
54
+ pip install -e .[dev]
55
55
  ```
56
56
 
57
- ## Usage
57
+ To install the *deprecated* user config gui, use the following: =
58
+ ```bash
59
+ pip install -e ents[gui]
60
+ ```
58
61
 
59
- The following example code demonstrates decoding the measurement message and encoding a response.
60
62
 
61
- ```python
62
- from ents import encode, decode
63
63
 
64
- # get data encoded by the soil power sensor
65
- data = ...
64
+ ## Simulator (New)
66
65
 
67
- meas_dict = decode(data)
66
+ The webserver `tools/http_decoder.py` can be used to decode uploaded measurements.
67
+
68
+ ### CLI Usage
69
+
70
+ ```
71
+ usage: ents sim_generic [-h] [-v] [--url URL] --sensor SENSOR [SENSOR ...] [--min MIN] [--max MAX] --cell CELL --logger LOGGER [--start START] [--end END] [--freq FREQ] {batch,stream}
72
+
73
+ positional arguments:
74
+ {batch,stream} Upload mode
75
+
76
+ options:
77
+ -h, --help show this help message and exit
78
+ -v, --verbose Print addiitional request information.
79
+ --url URL URL of the dirtviz instance (default: http://localhost:8000)
80
+ --sensor SENSOR [SENSOR ...]
81
+ Type of sensor to simulate
82
+ --min MIN Minimum sensor value (default: -1.0)
83
+ --max MAX Maximum sensor value (default: 1.0)
84
+ --cell CELL Cell Id
85
+ --logger LOGGER Logger Id
86
+
87
+ Batch:
88
+ --start START Start date
89
+ --end END End date
90
+
91
+ Stream:
92
+ --freq FREQ Frequency of uploads (default: 10s)
93
+ ```
94
+
95
+ ### Examples
96
+
97
+ You can find the available sensors in the `sensors.proto` file.
98
+
99
+ Example uploading single measurement
100
+ ```
101
+ ents sim_generic stream --sensor POWER_VOLTAGE --min 20 --max 30 --cell 1 --logger 1
102
+ ```
103
+
104
+ Example uploading multiple measuremnets
105
+ ```
106
+ ents sim_generic stream --sensor TEROS12_VWC_ADJ TEROS12_TEMP TEROS12_EC --min 10 --max 100 --cell 1 --logger 1
107
+ ```
108
+
109
+ Example batch uploads
110
+ ```
111
+ ents sim_generic batch --sensor POWER_CURRENT --cell 1 --logger 1 --start 2026-01-19 --end 2026-01-20 --freq 60
112
+ ```
68
113
 
69
- # process data
70
- ...
71
114
 
72
- # send response
73
- resp_str = encode(success=True)
74
- ```
75
-
76
- The formatting of the dictionary depends on the type of measurement sent. The key `type` is included on all measurement types and can be used to determine the type of message. See the source `*.proto` files to get the full list of types to get the full list of types and keys. A list is provided in [Message Types](#message-types). The Python protobuf API uses camel case when naming keys. The key `ts` is in ISO 8601 format as a string.
77
-
78
- ## Message Types
79
-
80
- Type `power`
81
- ```python
82
- meas_dict = {
83
- "type": "power",
84
- "loggerId": ...,
85
- "cellId": ...,
86
- "ts": ...,
87
- "data": {
88
- "voltage": ...,
89
- "current": ...
90
- },
91
- "data_type": {
92
- "voltage": float,
93
- "voltage": float
94
- }
95
- }
96
- ```
97
-
98
- Type `teros12`
99
- ```python
100
- meas_dict = {
101
- "type": "teros12",
102
- "loggerId": ...,
103
- "cellId": ...,
104
- "ts": ...,
105
- "data": {
106
- "vwcRaw": ...,
107
- "vwcAdj": ...,
108
- "temp": ...,
109
- "ec": ...
110
- },
111
- "data_type": {
112
- "vwcRaw": float,
113
- "vwcAdj": float,
114
- "temp": float,
115
- "ec": int
116
- }
117
- }
118
- ```
119
-
120
- Type `bme280` with `raw=True` (default)
121
- ```python
122
- meas_dict = {
123
- "type": "bme280",
124
- "loggerId": ...,
125
- "cellId": ...,
126
- "ts": ...,
127
- "data": {
128
- "pressure": ...,
129
- "temperature": ...,
130
- "humidity": ...,
131
- },
132
- "data_type": {
133
- "pressure": int,
134
- "temperature": int,
135
- "humidity": int,
136
- }
137
- }
138
- ```
139
-
140
- Type `bme280` with `raw=False`
141
- ```python
142
- meas_dict = {
143
- "type": "bme280",
144
- "loggerId": ...,
145
- "cellId": ...,
146
- "ts": ...,
147
- "data": {
148
- "pressure": ...,
149
- "temperature": ...,
150
- "humidity": ...,
151
- },
152
- "data_type": {
153
- "pressure": float,
154
- "temperature": float,
155
- "humidity": float,
156
- }
157
- }
158
- ```
159
-
160
-
161
- ## Simulator
115
+ ## Simulator (Old)
162
116
 
163
117
  Simulate WiFi sensor uploads without requiring ENTS hardware.
164
118
 
@@ -8,14 +8,14 @@ The soil power sensor protobuf protocol is implemented as a Python package that
8
8
  Use the following to install the `ents` package with gui via `pip`:
9
9
 
10
10
  ```bash
11
- pip install ents[gui]
11
+ pip install ents
12
12
  ```
13
13
 
14
14
  You can also install the package from source with the following:
15
15
 
16
16
  ```bash
17
17
  # install package
18
- pip install .[gui]
18
+ pip install .
19
19
  ```
20
20
 
21
21
  If you are planning to develop the package we recommend you install the package
@@ -25,114 +25,68 @@ reinstall it.
25
25
 
26
26
  ```bash
27
27
  # install development dependencies
28
- pip install -e .[gui,dev]
28
+ pip install -e .[dev]
29
29
  ```
30
30
 
31
- ## Usage
31
+ To install the *deprecated* user config gui, use the following: =
32
+ ```bash
33
+ pip install -e ents[gui]
34
+ ```
32
35
 
33
- The following example code demonstrates decoding the measurement message and encoding a response.
34
36
 
35
- ```python
36
- from ents import encode, decode
37
37
 
38
- # get data encoded by the soil power sensor
39
- data = ...
38
+ ## Simulator (New)
40
39
 
41
- meas_dict = decode(data)
40
+ The webserver `tools/http_decoder.py` can be used to decode uploaded measurements.
41
+
42
+ ### CLI Usage
43
+
44
+ ```
45
+ usage: ents sim_generic [-h] [-v] [--url URL] --sensor SENSOR [SENSOR ...] [--min MIN] [--max MAX] --cell CELL --logger LOGGER [--start START] [--end END] [--freq FREQ] {batch,stream}
46
+
47
+ positional arguments:
48
+ {batch,stream} Upload mode
49
+
50
+ options:
51
+ -h, --help show this help message and exit
52
+ -v, --verbose Print addiitional request information.
53
+ --url URL URL of the dirtviz instance (default: http://localhost:8000)
54
+ --sensor SENSOR [SENSOR ...]
55
+ Type of sensor to simulate
56
+ --min MIN Minimum sensor value (default: -1.0)
57
+ --max MAX Maximum sensor value (default: 1.0)
58
+ --cell CELL Cell Id
59
+ --logger LOGGER Logger Id
60
+
61
+ Batch:
62
+ --start START Start date
63
+ --end END End date
64
+
65
+ Stream:
66
+ --freq FREQ Frequency of uploads (default: 10s)
67
+ ```
68
+
69
+ ### Examples
70
+
71
+ You can find the available sensors in the `sensors.proto` file.
72
+
73
+ Example uploading single measurement
74
+ ```
75
+ ents sim_generic stream --sensor POWER_VOLTAGE --min 20 --max 30 --cell 1 --logger 1
76
+ ```
77
+
78
+ Example uploading multiple measuremnets
79
+ ```
80
+ ents sim_generic stream --sensor TEROS12_VWC_ADJ TEROS12_TEMP TEROS12_EC --min 10 --max 100 --cell 1 --logger 1
81
+ ```
82
+
83
+ Example batch uploads
84
+ ```
85
+ ents sim_generic batch --sensor POWER_CURRENT --cell 1 --logger 1 --start 2026-01-19 --end 2026-01-20 --freq 60
86
+ ```
42
87
 
43
- # process data
44
- ...
45
88
 
46
- # send response
47
- resp_str = encode(success=True)
48
- ```
49
-
50
- The formatting of the dictionary depends on the type of measurement sent. The key `type` is included on all measurement types and can be used to determine the type of message. See the source `*.proto` files to get the full list of types to get the full list of types and keys. A list is provided in [Message Types](#message-types). The Python protobuf API uses camel case when naming keys. The key `ts` is in ISO 8601 format as a string.
51
-
52
- ## Message Types
53
-
54
- Type `power`
55
- ```python
56
- meas_dict = {
57
- "type": "power",
58
- "loggerId": ...,
59
- "cellId": ...,
60
- "ts": ...,
61
- "data": {
62
- "voltage": ...,
63
- "current": ...
64
- },
65
- "data_type": {
66
- "voltage": float,
67
- "voltage": float
68
- }
69
- }
70
- ```
71
-
72
- Type `teros12`
73
- ```python
74
- meas_dict = {
75
- "type": "teros12",
76
- "loggerId": ...,
77
- "cellId": ...,
78
- "ts": ...,
79
- "data": {
80
- "vwcRaw": ...,
81
- "vwcAdj": ...,
82
- "temp": ...,
83
- "ec": ...
84
- },
85
- "data_type": {
86
- "vwcRaw": float,
87
- "vwcAdj": float,
88
- "temp": float,
89
- "ec": int
90
- }
91
- }
92
- ```
93
-
94
- Type `bme280` with `raw=True` (default)
95
- ```python
96
- meas_dict = {
97
- "type": "bme280",
98
- "loggerId": ...,
99
- "cellId": ...,
100
- "ts": ...,
101
- "data": {
102
- "pressure": ...,
103
- "temperature": ...,
104
- "humidity": ...,
105
- },
106
- "data_type": {
107
- "pressure": int,
108
- "temperature": int,
109
- "humidity": int,
110
- }
111
- }
112
- ```
113
-
114
- Type `bme280` with `raw=False`
115
- ```python
116
- meas_dict = {
117
- "type": "bme280",
118
- "loggerId": ...,
119
- "cellId": ...,
120
- "ts": ...,
121
- "data": {
122
- "pressure": ...,
123
- "temperature": ...,
124
- "humidity": ...,
125
- },
126
- "data_type": {
127
- "pressure": float,
128
- "temperature": float,
129
- "humidity": float,
130
- }
131
- }
132
- ```
133
-
134
-
135
- ## Simulator
89
+ ## Simulator (Old)
136
90
 
137
91
  Simulate WiFi sensor uploads without requiring ENTS hardware.
138
92
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ents"
7
- version = "2.3.4"
7
+ version = "2.3.6"
8
8
  authors = [
9
9
  { name="John Madden", email="jmadden173@pm.me" },
10
10
  ]
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Operating System :: OS Independent",
18
18
  ]
19
19
  dependencies = [
20
- 'protobuf==6.31.1',
20
+ 'protobuf==6.33.4',
21
21
  'matplotlib',
22
22
  'pandas',
23
23
  'pyserial',
@@ -3,10 +3,11 @@ from .proto.encode import (
3
3
  encode_power_measurement,
4
4
  encode_teros12_measurement,
5
5
  encode_phytos31_measurement,
6
+ encode_user_configuration,
6
7
  encode_bme280_measurement,
7
8
  )
8
9
 
9
- from .proto.decode import decode_response, decode_measurement
10
+ from .proto.decode import decode_response, decode_measurement, decode_user_configuration
10
11
 
11
12
  from .proto.esp32 import encode_esp32command, decode_esp32command
12
13
 
@@ -20,4 +21,6 @@ __all__ = [
20
21
  "decode_measurement",
21
22
  "encode_esp32command",
22
23
  "decode_esp32command",
24
+ "encode_user_configuration",
25
+ "decode_user_configuration",
23
26
  ]
@@ -16,7 +16,7 @@ import socket
16
16
  import serial
17
17
  from typing import Tuple
18
18
  from tqdm import tqdm
19
- from ..proto import decode_measurement
19
+ from ..proto.sensor import decode_repeated_sensor_measurements
20
20
 
21
21
 
22
22
  class SerialController:
@@ -116,10 +116,10 @@ class SoilPowerSensorController(SerialController):
116
116
 
117
117
  reply = self.ser.read(resp_len) # read said measurment
118
118
 
119
- meas_dict = decode_measurement(reply) # decode using protobuf
119
+ meas_dict = decode_repeated_sensor_measurements(reply) # decode using protobuf
120
120
 
121
- voltage_value = meas_dict["data"]["voltage"]
122
- current_value = meas_dict["data"]["current"]
121
+ voltage_value = meas_dict["measurements"][0]["decimal"]
122
+ current_value = meas_dict["measurements"][1]["decimal"]
123
123
 
124
124
  return float(voltage_value), float(current_value)
125
125