103 lines
2.8 KiB
Markdown
103 lines
2.8 KiB
Markdown
# Welcome Home Automation - Quick Reference
|
|
|
|
## Quick Test (Manual Trigger)
|
|
|
|
```bash
|
|
HA_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwZThjZmJjMzVlNDA0NzYwOTMzMjg3MTQ5ZjkwOGU2NyIsImlhdCI6MTc2NTk5MjQ4OCwiZXhwIjoyMDgxMzUyNDg4fQ.r743tsb3E5NNlrwEEu9glkZdiI4j_3SKIT1n5PGUytY"
|
|
|
|
# Test the automation now (ignores conditions)
|
|
curl -X POST \
|
|
-H "Authorization: Bearer $HA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"entity_id": "automation.welcome_home"}' \
|
|
"http://10.10.10.210:8123/api/services/automation/trigger"
|
|
```
|
|
|
|
## Current Configuration
|
|
|
|
**Lights that turn on:**
|
|
- Living Room (75%)
|
|
- Living Room Lamp (60%)
|
|
- Kitchen (80%)
|
|
|
|
**When:** After sunset (30 min early) OR before sunrise
|
|
**Trigger:** Entering home zone (100m radius)
|
|
|
|
## Quick Modifications
|
|
|
|
### Add Office Light
|
|
|
|
```bash
|
|
# Get current config
|
|
curl -s -H "Authorization: Bearer $HA_TOKEN" \
|
|
"http://10.10.10.210:8123/api/config/automation/config/welcome_home" > /tmp/welcome.json
|
|
|
|
# Edit /tmp/welcome.json and add to "actions" array:
|
|
# {
|
|
# "target": {"entity_id": "light.office"},
|
|
# "data": {"brightness_pct": 70},
|
|
# "action": "light.turn_on"
|
|
# }
|
|
|
|
# Update automation
|
|
curl -X POST \
|
|
-H "Authorization: Bearer $HA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d @/tmp/welcome.json \
|
|
"http://10.10.10.210:8123/api/config/automation/config/welcome_home"
|
|
```
|
|
|
|
### Change to Scene Instead
|
|
|
|
Replace all light actions with a single scene:
|
|
|
|
```json
|
|
{
|
|
"actions": [
|
|
{
|
|
"service": "scene.turn_on",
|
|
"target": {
|
|
"entity_id": "scene.living_room_relax"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Status Check
|
|
|
|
```bash
|
|
# Check if automation is enabled
|
|
curl -s -H "Authorization: Bearer $HA_TOKEN" \
|
|
"http://10.10.10.210:8123/api/states/automation.welcome_home" | \
|
|
python3 -c "import json, sys; data=json.load(sys.stdin); print(f\"State: {data['state']}\"); print(f\"Last triggered: {data['attributes']['last_triggered']}\")"
|
|
|
|
# Check current location
|
|
curl -s -H "Authorization: Bearer $HA_TOKEN" \
|
|
"http://10.10.10.210:8123/api/states/person.hutson" | \
|
|
python3 -c "import json, sys; data=json.load(sys.stdin); print(f\"Location: {data['state']}\"); print(f\"GPS: {data['attributes']['latitude']}, {data['attributes']['longitude']}\"); print(f\"Accuracy: {data['attributes']['gps_accuracy']}m\")"
|
|
```
|
|
|
|
## Toggle On/Off
|
|
|
|
```bash
|
|
# Disable
|
|
curl -X POST -H "Authorization: Bearer $HA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"entity_id": "automation.welcome_home"}' \
|
|
"http://10.10.10.210:8123/api/services/automation/turn_off"
|
|
|
|
# Enable
|
|
curl -X POST -H "Authorization: Bearer $HA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"entity_id": "automation.welcome_home"}' \
|
|
"http://10.10.10.210:8123/api/services/automation/turn_on"
|
|
```
|
|
|
|
## Web UI
|
|
|
|
http://10.10.10.210:8123 → Settings → Automations & Scenes → "Welcome Home"
|
|
|
|
---
|
|
*Entity ID: automation.welcome_home*
|