Skip to content

Commit 1d80193

Browse files
committed
update runner version
1 parent 90afe6f commit 1d80193

File tree

171 files changed

+12363
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+12363
-1
lines changed

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ vars:
99
GOIMPORTS_VERSION: v0.29.0
1010
DPRINT_VERSION: 0.48.0
1111
EXAMPLE_VERSION: "0.6.0"
12-
RUNNER_VERSION: "0.5.0"
12+
RUNNER_VERSION: "0.6.0"
1313
VERSION: # if version is not passed we hack the semver by encoding the commit as pre-release
1414
sh: echo "${VERSION:-0.0.0-$(git rev-parse --short HEAD)}"
1515

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# air_quality_monitoring API Reference
2+
3+
## Index
4+
5+
- Class `AQILevel`
6+
- Class `AirQualityData`
7+
- Class `AirQualityMonitoring`
8+
- Class `AirQualityLookupError`
9+
10+
---
11+
12+
## `AQILevel` dataclass
13+
14+
```python
15+
class AQILevel()
16+
```
17+
18+
Data class to represent AQI levels.
19+
20+
### Attributes
21+
22+
- **min_value** (*int*): Minimum AQI value for the level.
23+
- **max_value** (*int*): Maximum AQI value for the level.
24+
- **description** (*str*): Description of the AQI level.
25+
- **color** (*str*): Color associated with the AQI level in hex.
26+
27+
28+
---
29+
30+
## `AirQualityData` dataclass
31+
32+
```python
33+
class AirQualityData()
34+
```
35+
36+
Data class to represent air quality data.
37+
38+
### Attributes
39+
40+
- **city** (*str*): Name of the city.
41+
- **lat** (*float*): Latitude of the city.
42+
- **lon** (*float*): Longitude of the city.
43+
- **url** (*str*): URL for more information about the air quality data.
44+
- **last_update** (*str*): Last update timestamp of the air quality data.
45+
- **aqi** (*int*): Air Quality Index value.
46+
- **dominantpol** (*str*): Dominant pollutant in the air.
47+
- **iaqi** (*dict*): Individual AQI values for various pollutants.
48+
49+
### Methods
50+
51+
#### `pandas_dict()`
52+
53+
Return the data as a dictionary suitable for pandas DataFrame.
54+
55+
56+
---
57+
58+
## `AirQualityMonitoring` class
59+
60+
```python
61+
class AirQualityMonitoring(token: str)
62+
```
63+
64+
Class to get air quality data from AQICN API.
65+
66+
### Parameters
67+
68+
- **token** (*str*): API token for AQICN service.
69+
70+
### Raises
71+
72+
- **ValueError**: If the token is not provided.
73+
74+
### Methods
75+
76+
#### `get_air_quality_by_city(city: str)`
77+
78+
Get air quality data by city name.
79+
80+
##### Parameters
81+
82+
- **city** (*str*): Name of the city.
83+
84+
##### Returns
85+
86+
- (*AirQualityData*): Air quality assembled data.
87+
88+
##### Raises
89+
90+
- **AirQualityLookupError**: If the API request fails.
91+
92+
#### `get_air_quality_by_coords(latitude: float, longitude: float)`
93+
94+
Get air quality data by coordinates.
95+
96+
##### Parameters
97+
98+
- **latitude** (*float*): Latitude.
99+
- **longitude** (*float*): Longitude.
100+
101+
##### Returns
102+
103+
- (*AirQualityData*): Air quality assembled data.
104+
105+
##### Raises
106+
107+
- **AirQualityLookupError**: If the API request fails.
108+
109+
#### `get_air_quality_by_ip()`
110+
111+
Get air quality data by IP address.
112+
113+
##### Returns
114+
115+
- (*AirQualityData*): Air quality assembled data.
116+
117+
##### Raises
118+
119+
- **AirQualityLookupError**: If the API request fails.
120+
121+
#### `process(item: dict)`
122+
123+
Process the input dictionary to get air quality data.
124+
125+
##### Parameters
126+
127+
- **item** (*dict*): Input dictionary containing either 'city', 'latitude' and 'longitude', or 'ip'.
128+
129+
##### Returns
130+
131+
- (*dict*): Air quality data.
132+
133+
##### Raises
134+
135+
- **ValueError**: If the input dictionary is not valid.
136+
137+
#### `assemble_data(data: dict)`
138+
139+
Create a payload for the air quality data.
140+
141+
##### Parameters
142+
143+
- **data** (*dict*): Air quality data.
144+
145+
##### Returns
146+
147+
- (*dict*): Payload with relevant air quality information.
148+
149+
#### `map_aqi_level(aqi: int)`
150+
151+
Returns AQILevel class matching provided AQI.
152+
153+
154+
---
155+
156+
## `AirQualityLookupError` class
157+
158+
```python
159+
class AirQualityLookupError(message: str, status: str)
160+
```
161+
162+
Custom exception for air quality lookup errors.
163+
164+
### Parameters
165+
166+
- **message** (*str*): Error message.
167+
- **status** (*str*): Status of the error, defaults to None.
168+
169+
### Methods
170+
171+
#### `from_api_response(cls, data: dict)`
172+
173+
AirQualityLookupError error handling based on response provided by AQI API.
174+
175+
Documented errors:
176+
- {"status": "error", "data": "Invalid key"}
177+
- {"status": "error", "data": "Unknown station"}
178+
- {"status": "error", "data": "Over quota"}
179+
- {"status": "error", "data": "Invalid query"}
180+
- {"status": "error", "data": "Too Many Requests"}
181+
- {"status": "error", "data": "IP not allowed"}
182+
- {"status": "error", "data": "Unknown error"}
183+
- {"status": "error", "data": {"message": "..."}}
184+
185+
##### Parameters
186+
187+
- **data** (*dict*): Response data from the AQI API.
188+
189+
##### Returns
190+
191+
- (*AirQualityLookupError*): An instance of AirQualityLookupError with the error message and status.
192+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# arduino_cloud API Reference
2+
3+
## Index
4+
5+
- Class `ArduinoCloud`
6+
7+
---
8+
9+
## `ArduinoCloud` class
10+
11+
```python
12+
class ArduinoCloud(device_id: str, secret: str, server: str, port: int)
13+
```
14+
15+
Arduino Cloud client for managing devices and data.
16+
17+
### Parameters
18+
19+
- **device_id** (*str*): The unique identifier for the device.
20+
If omitted, uses ARDUINO_DEVICE_ID environment variable.
21+
- **secret** (*str*): The password for Arduino Cloud authentication.
22+
If omitted, uses ARDUINO_SECRET environment variable.
23+
- **server** (*str*) (optional): The server address for Arduino Cloud (default: "iot.arduino.cc").
24+
- **port** (*int*) (optional): The port to connect to the Arduino Cloud server (default: 8884).
25+
26+
### Raises
27+
28+
- **ValueError**: If either device_id or secret is not provided explicitly or via environment variable.
29+
30+
### Methods
31+
32+
#### `start()`
33+
34+
Start the Arduino IoT Cloud client.
35+
36+
#### `loop()`
37+
38+
Run a single iteration of the Arduino IoT Cloud client loop, processing commands and updating state.
39+
40+
#### `register(aiotobj: str | Any)`
41+
42+
Register a variable or object with the Arduino Cloud client.
43+
44+
##### Parameters
45+
46+
- **aiotobj** (*str | Any*): The variable name or object from which to derive the variable name to register.
47+
- ****kwargs** (*Any*): Additional keyword arguments for registration.
48+
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# audio_classification API Reference
2+
3+
## Index
4+
5+
- Class `AudioClassificationException`
6+
- Class `AudioClassification`
7+
8+
---
9+
10+
## `AudioClassificationException` class
11+
12+
```python
13+
class AudioClassificationException()
14+
```
15+
16+
Custom exception for AudioClassification errors.
17+
18+
19+
---
20+
21+
## `AudioClassification` class
22+
23+
```python
24+
class AudioClassification(mic: Microphone, confidence: float)
25+
```
26+
27+
AudioClassification module for detecting sounds and classifying audio using a specified model.
28+
29+
### Parameters
30+
31+
- **mic** (*Microphone*) (optional): Microphone instance used as the audio source. If None, a default Microphone will be initialized.
32+
- **confidence** (*float*) (optional): Minimum confidence threshold (0.01.0) required
33+
for a detection to be considered valid. Defaults to 0.8 (80%).
34+
35+
### Raises
36+
37+
- **ValueError**: If the model information cannot be retrieved, or if model parameters are missing or incomplete.
38+
39+
### Methods
40+
41+
#### `on_detect(class_name: str, callback: Callable[[], None])`
42+
43+
Register a callback function to be invoked when a specific class is detected.
44+
45+
##### Parameters
46+
47+
- **class_name** (*str*): The class to check for in the classification results.
48+
Must match one of the classes defined in the loaded model.
49+
- **callback** (*callable*): Function to execute when the class is detected.
50+
The callback must take no arguments and return None.
51+
52+
##### Raises
53+
54+
- **TypeError**: If `callback` is not callable.
55+
- **ValueError**: If `callback` accepts any argument.
56+
57+
#### `start()`
58+
59+
Start real-time audio classification.
60+
61+
Begins capturing audio from the configured microphone and
62+
continuously classifies the incoming audio stream until stopped.
63+
64+
#### `stop()`
65+
66+
Stop real-time audio classification.
67+
68+
Terminates audio capture and releases any associated resources.
69+
70+
#### `classify_from_file(audio_path: str, confidence: float)`
71+
72+
Classify audio content from a WAV file.
73+
74+
Supported sample widths:
75+
- 8-bit unsigned
76+
- 16-bit signed
77+
- 24-bit signed
78+
- 32-bit signed
79+
80+
##### Parameters
81+
82+
- **audio_path** (*str*): Path to the `.wav` audio file to classify.
83+
- **confidence** (*float*) (optional): Minimum confidence threshold (0.01.0) required
84+
for a detection to be considered valid. Defaults to 0.8 (80%).
85+
86+
##### Returns
87+
88+
-: dict | None: A dictionary with keys:
89+
- ``class_name`` (str): The detected sound class.
90+
- ``confidence`` (float): Confidence score of the detection.
91+
Returns None if no valid classification is found.
92+
93+
##### Raises
94+
95+
- **AudioClassificationException**: If the file cannot be found, read, or processed.
96+
- **ValueError**: If the file uses an unsupported sample width.
97+

0 commit comments

Comments
 (0)