Expert AI assistant for the KI-SYSTEM smart home automation platform. Helps with development, debugging, ML models, platform integrations (Home Assistant/Homey), and bathroom automation features.
Expert assistant for developing and maintaining the KI-SYSTEM smart home automation platform - a self-learning AI system that controls lighting, heating, and bathroom automation across Home Assistant and Homey Pro platforms.
This skill provides comprehensive guidance for working with KI-SYSTEM, including:
Before making any changes:
Always validate the environment before development:
```bash
./quick_test.sh
python3 main.py test
python3 main.py status
```
When working with specific features, understand these key components:
**Decision Engine** (`src/decision_engine/engine.py`):
**Platform Abstraction** (`src/data_collector/`):
**ML Models** (`src/models/`):
**Database** (`src/utils/database.py`):
**Adding a New Sensor:**
1. Update `config.yaml` under `data_collection.sensors`
2. Modify platform collector's `get_sensor_data()` if needed
3. Update ML model's `prepare_training_data()` for new features
4. Collect data in learning mode (2-3 days)
5. Retrain: `python3 main.py train`
**Supporting a New Platform:**
1. Create collector inheriting from `SmartHomeCollector`
2. Implement: `test_connection()`, `get_state()`, `turn_on()`, `turn_off()`, `set_temperature()`
3. Register in `PlatformFactory.PLATFORMS`
4. Add config section to config.yaml
5. Test with `python3 main.py test`
**Modifying Decision Logic:**
1. Rules are in `config.yaml` under `decision_engine.rules`
2. Custom logic goes in `DecisionEngine.run_cycle()`
3. Safety checks in `_apply_safety_checks()`
4. Always log decisions to database
**Adding a New ML Model:**
1. Create file in `src/models/` (e.g., `blinds_model.py`)
2. Define features (brightness, time, temperature)
3. Implement: `train()`, `predict()`, `save()`, `load()`
4. Initialize in `DecisionEngine.__init__()`
5. Add prediction logic to `run_cycle()`
6. Add config section to config.yaml
When connection issues occur:
1. Verify `.env` has correct `PLATFORM_TYPE`, URL, TOKEN (no trailing slashes)
2. Run diagnostic: `python3 main.py test`
3. For Home Assistant:
- Test with: `curl -H "Authorization: Bearer TOKEN" http://URL:8123/api/`
- Check token hasn't been revoked
- Review Home Assistant logs
4. For Homey:
- Re-authenticate: `athom login`
- Get new token: `athom user --bearer`
- Tokens expire periodically
5. Check logs: `logs/ki_system.log`
Working with data:
```bash
sqlite3 data/ki_system.db
SELECT * FROM sensor_data ORDER BY timestamp DESC LIMIT 10;
SELECT * FROM decisions WHERE executed=1 ORDER BY timestamp DESC LIMIT 20;
SELECT * FROM bathroom_events ORDER BY start_time DESC LIMIT 10;
cp data/ki_system.db data/ki_system.db.backup
```
Two-tier system:
Access via `ConfigLoader`:
```bash
python3 main.py run
python3 main.py daemon --interval 300
python3 main.py train
python3 main.py web --host 0.0.0.0 --port 5000
```
Key components:
Features: Auto-detects showers via humidity spikes, controls dehumidifiers, learns optimal thresholds
**Safety Mechanisms:**
**Deployment Workflow:**
1. Start with `mode: "learning"` (2-3 days)
2. Switch to `mode: "manual"` (approval-based)
3. Finally `mode: "auto"` (full automation)
**Design Patterns:**
**Example 1: Adding temperature sensor to heating model**
```
User: Add outdoor temperature sensor to the heating prediction model
Assistant steps:
1. Read config.yaml to identify current sensors
2. Add new sensor entity ID under data_collection.sensors.temperature
3. Modify temperature_model.py to include outdoor temp in feature vector
4. Update prepare_training_data() method
5. Run ./quick_test.sh to validate
6. Suggest running in learning mode for 2-3 days
7. Provide command: python3 main.py train
```
**Example 2: Debugging Home Assistant connection**
```
User: Getting connection errors to Home Assistant
Assistant steps:
1. Check .env file for PLATFORM_TYPE, HA_URL, HA_TOKEN
2. Run: python3 main.py test
3. Test API manually with curl command
4. Check logs/ki_system.log for specific errors
5. Verify Home Assistant is accessible and token is valid
6. Suggest regenerating long-lived access token if needed
```
**Example 3: Analyzing bathroom automation performance**
```
User: Want to see bathroom automation insights
Assistant steps:
1. Direct user to web UI at /bathroom/analytics
2. Query bathroom_events table for recent events
3. Check bathroom_learned_parameters for current thresholds
4. Review bathroom_device_actions for control history
5. Suggest running bathroom_optimizer.py for optimization
6. Show sample queries for detailed analysis
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/smart-home-ki-system-assistant/raw