90 lines
2.1 KiB
Markdown
90 lines
2.1 KiB
Markdown
# 🌤️ Weather or Not
|
|
|
|
A weather-based activity decision engine that tells you whether to ride your motorcycle or mow the lawn today.
|
|
|
|
## Features
|
|
|
|
- **Motorcycle ride check** — evaluates temperature, precipitation, wind, humidity, and road conditions
|
|
- **Lawn mowing check** — evaluates weather conditions AND tracks when you last mowed (with configurable cooldown)
|
|
- **Extensible** — add new activities by implementing `BaseActivity`
|
|
- **CLI tool** — run from terminal or schedule via cron
|
|
- **Notifications** — sends results via Mattermost or Hermes
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Install
|
|
pip install -e .
|
|
|
|
# Run a check (uses config.yaml for location)
|
|
weather-or-not
|
|
|
|
# With verbose output
|
|
weather-or-not -v
|
|
|
|
# Override location
|
|
weather-or-not --lat 48.8566 --lon 2.3522 # Paris
|
|
|
|
# Record that you performed an activity
|
|
weather-or-not record mow_lawn
|
|
weather-or-not record motorcycle_ride
|
|
|
|
# Send notification
|
|
weather-or-not notify send
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Copy `config.yaml` and customize:
|
|
|
|
```yaml
|
|
location:
|
|
latitude: 40.7128 # Your latitude
|
|
longitude: -74.0060 # Your longitude
|
|
|
|
activities:
|
|
motorcycle_ride:
|
|
enabled: true
|
|
min_temp_c: 10
|
|
max_temp_c: 35
|
|
max_precipitation_mm: 0
|
|
max_wind_speed_kmh: 30
|
|
mow_lawn:
|
|
enabled: true
|
|
cooldown_days: 3
|
|
max_precipitation_today_mm: 0
|
|
max_precipitation_past_24h_mm: 5
|
|
```
|
|
|
|
## Adding New Activities
|
|
|
|
Create a new file in `src/weather_or_not/` that extends `BaseActivity`:
|
|
|
|
```python
|
|
from weather_or_not.activities import BaseActivity, RuleResult, Verdict
|
|
from weather_or_not.weather import WeatherForecast
|
|
|
|
class MyActivity(BaseActivity):
|
|
name = "my_activity"
|
|
description = "Check if it's good for my activity"
|
|
|
|
async def check_rules(self, weather: WeatherForecast) -> list[RuleResult]:
|
|
return [
|
|
RuleResult(
|
|
rule_name="My Rule",
|
|
passed=weather.current_temp_c > 15,
|
|
message="Temperature is above 15°C",
|
|
),
|
|
]
|
|
```
|
|
|
|
Then register it in `cli.py`'s `run_check()` function.
|
|
|
|
## Data Storage
|
|
|
|
Activity history is stored in `~/.local/share/weather-or-not/history.json`.
|
|
|
|
## License
|
|
|
|
MIT
|