Skip to content

Commit 49dc7a6

Browse files
committed
Fill out minimal README
1 parent bec3df3 commit 49dc7a6

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# micropython-thermostat
2+
3+
An advanced thermostat for micropython devices using `asyncio`.
4+
5+
## Installation
6+
7+
On a micropython device, install with `mip`:
8+
9+
```bash
10+
mip install github:solanus-systems/micropython-thermostat
11+
```
12+
13+
## Usage
14+
15+
```python
16+
from thermostat import Thermostat
17+
18+
# Create a thermostat instance
19+
therm = Thermostat()
20+
21+
# Heat to 65 degrees
22+
therm.set_setpoint(65)
23+
therm.set_mode_heat()
24+
25+
# Example sensor polling function; replace with your own
26+
def read_sensor_temp():
27+
return 60
28+
29+
# After updating temp, check the heat relay flag
30+
therm.set_temp(read_sensor_temp())
31+
assert therm.heating.is_set()
32+
```
33+
34+
See `thermostat.py` for the full API.
35+
36+
## Developing
37+
38+
You need python and a build of micropython with `asyncio` support. Follow the steps in the CI workflow to get a `micropython` binary and add it to your `PATH`.
39+
40+
Before making changes, install the development dependencies:
41+
42+
```bash
43+
pip install -r dev-requirements.txt
44+
```
45+
46+
After making changes, you can run the linter:
47+
48+
```bash
49+
ruff check
50+
```
51+
52+
Before running tests, install the test dependencies:
53+
54+
```bash
55+
cat test-requirements.txt | grep -v "^$" | xargs -n 1 micropython -m mip install
56+
```
57+
58+
Then, you can run the tests using the micropython version of `unittest`:
59+
60+
```bash
61+
micropython -m unittest
62+
```

0 commit comments

Comments
 (0)