Add homeassistant skill in unpacked format

- Add complete homeassistant skill source to skills/ directory
- Includes all scripts, references, and automation templates
- Matches format of other skills in repository
This commit is contained in:
Felix Zösch
2025-12-16 12:49:56 +01:00
parent 43f3a0d0b4
commit 9be64a0696
14 changed files with 2393 additions and 0 deletions

View File

@@ -0,0 +1,284 @@
# Home Assistant API Reference
## REST API
### Authentication
All API requests require a Long-Lived Access Token passed in the Authorization header:
```
Authorization: Bearer YOUR_TOKEN_HERE
```
Obtain tokens from: `http://YOUR_HA_URL:8123/profile`
### Base URL
```
http://YOUR_HA_URL:8123/api/
```
### Key Endpoints
#### Get All Entity States
```http
GET /api/states
```
Returns array of all entities with their current states, attributes, and timestamps.
#### Get Specific Entity State
```http
GET /api/states/<entity_id>
```
Example: `/api/states/light.living_room`
Returns single entity object with state, attributes, last_changed, last_updated.
#### Call a Service
```http
POST /api/services/<domain>/<service>
```
Example: `/api/services/light/turn_on`
Request body (optional):
```json
{
"entity_id": "light.living_room",
"brightness": 255,
"color_name": "blue"
}
```
Returns array of entity states that were changed by the service call.
#### List All Services
```http
GET /api/services
```
Returns object with domains as keys, each containing available services with descriptions and field definitions.
#### Get Configuration
```http
GET /api/config
```
Returns Home Assistant configuration including version, location, unit system, time zone, etc.
#### Get Error Log
```http
GET /api/error_log
```
Returns text content of the error log.
### Response Codes
- `200` - Success (existing resource)
- `201` - Created (new resource)
- `400` - Bad Request
- `401` - Unauthorized
- `404` - Not Found
- `405` - Method Not Allowed
## WebSocket API
### Connection
Connect to: `ws://YOUR_HA_URL:8123/api/websocket`
### Authentication Flow
1. Client connects
2. Server sends `auth_required` message:
```json
{
"type": "auth_required",
"ha_version": "2024.1.0"
}
```
3. Client sends `auth` message:
```json
{
"type": "auth",
"access_token": "YOUR_TOKEN_HERE"
}
```
4. Server responds with either:
```json
{"type": "auth_ok"}
```
or
```json
{
"type": "auth_invalid",
"message": "Invalid access token"
}
```
### Message Format
All messages use JSON. Command phase messages require an `id` field for request/response correlation.
### Common Commands
#### Get All States
```json
{
"id": 1,
"type": "get_states"
}
```
Response:
```json
{
"id": 1,
"type": "result",
"success": true,
"result": [
{
"entity_id": "light.living_room",
"state": "on",
"attributes": {...},
"last_changed": "2024-01-15T10:30:00+00:00",
"last_updated": "2024-01-15T10:30:00+00:00"
}
]
}
```
#### Call Service
```json
{
"id": 2,
"type": "call_service",
"domain": "light",
"service": "turn_on",
"target": {
"entity_id": "light.kitchen"
},
"service_data": {
"brightness": 255,
"color_name": "warm_white"
},
"return_response": true
}
```
Response:
```json
{
"id": 2,
"type": "result",
"success": true,
"result": {
"context": {
"id": "326ef27d19415c60c492fe330945f954",
"parent_id": null,
"user_id": "31ddb597e03147118cf8d2f8fbea5553"
},
"response": null
}
}
```
#### Subscribe to Events
Subscribe to state changes:
```json
{
"id": 3,
"type": "subscribe_events",
"event_type": "state_changed"
}
```
Server confirms subscription:
```json
{
"id": 3,
"type": "result",
"success": true
}
```
Then sends events as they occur:
```json
{
"id": 3,
"type": "event",
"event": {
"event_type": "state_changed",
"data": {
"entity_id": "sensor.temperature",
"old_state": {...},
"new_state": {...}
}
}
}
```
#### Unsubscribe from Events
```json
{
"id": 4,
"type": "unsubscribe_events",
"subscription": 3
}
```
### Error Responses
```json
{
"id": 5,
"type": "result",
"success": false,
"error": {
"code": "invalid_format",
"message": "Message incorrectly formatted"
}
}
```
## Common Entity Domains
- `light` - Lights
- `switch` - Switches
- `sensor` - Sensors (read-only)
- `binary_sensor` - Binary sensors (on/off, open/closed)
- `climate` - Climate control (thermostats, AC)
- `cover` - Covers (blinds, garage doors)
- `fan` - Fans
- `media_player` - Media players
- `camera` - Cameras
- `lock` - Door locks
- `alarm_control_panel` - Alarm systems
- `vacuum` - Vacuum cleaners
- `automation` - Automations themselves
- `script` - Scripts
- `scene` - Scenes
## Common Service Patterns
Most domains support these services:
- `turn_on` - Turn entity on
- `turn_off` - Turn entity off
- `toggle` - Toggle entity state
Domain-specific services may include additional parameters like `brightness`, `color_temp`, `position`, etc.

View File

@@ -0,0 +1,389 @@
# Home Assistant Automation Reference
## Complete Automation Structure
```yaml
automation:
- alias: "Friendly Name for Display"
id: unique_identifier_123
description: "Optional description of what this automation does"
initial_state: true
mode: single
variables:
my_variable: "some_value"
trigger:
- trigger: state
entity_id: binary_sensor.motion_sensor
to: "on"
condition:
- condition: time
after: "sunset"
before: "sunrise"
action:
- action: light.turn_on
target:
entity_id: light.living_room
data:
brightness: 255
```
## Required and Optional Fields
### Required
- `trigger` - At least one trigger that initiates the automation
### Optional (Recommended)
- `alias` - Friendly name displayed in UI
- `id` - Unique identifier (essential for UI editor)
- `description` - Documentation of automation purpose
- `action` - Actions to execute (automation does nothing without actions)
### Optional (Advanced)
- `condition` - Conditions that must be true to execute actions
- `mode` - Execution behavior: `single`, `restart`, `queued`, `parallel`
- `max` - Maximum concurrent executions (for `queued`/`parallel` modes)
- `variables` - Variables available throughout automation
- `initial_state` - Whether enabled at startup (`true`/`false`)
- `trace` - Debug trace configuration
## Triggers
Triggers define when an automation runs.
### State Trigger
Fires when entity changes state:
```yaml
trigger:
- trigger: state
entity_id: binary_sensor.motion_detector
from: "off"
to: "on"
for:
seconds: 5 # Optional: state must persist for duration
```
### Time Trigger
Fires at specific time:
```yaml
trigger:
- trigger: time
at: "15:30:00"
```
### Sun Trigger
Fires at sunrise/sunset:
```yaml
trigger:
- trigger: sun
event: sunset
offset: "-00:30:00" # 30 minutes before sunset
```
### Numeric State Trigger
Fires when sensor value crosses threshold:
```yaml
trigger:
- trigger: numeric_state
entity_id: sensor.temperature
above: 25
below: 30
```
### Template Trigger
Fires when template evaluates to true:
```yaml
trigger:
- trigger: template
value_template: "{{ states('sensor.temperature') | float > 25 }}"
```
### Event Trigger
Fires on specific event:
```yaml
trigger:
- trigger: event
event_type: custom_event
event_data:
action: button_pressed
```
### Zone Trigger
Fires when device enters/leaves zone:
```yaml
trigger:
- trigger: zone
entity_id: person.john
zone: zone.home
event: enter # or 'leave'
```
### Multiple Triggers (OR Logic)
List multiple triggers - any one firing will run the automation:
```yaml
trigger:
- trigger: state
entity_id: binary_sensor.motion_1
to: "on"
- trigger: state
entity_id: binary_sensor.motion_2
to: "on"
- trigger: time
at: "18:00:00"
```
## Conditions
Conditions must be true for actions to execute.
### State Condition
```yaml
condition:
- condition: state
entity_id: light.living_room
state: "off"
```
### Numeric State Condition
```yaml
condition:
- condition: numeric_state
entity_id: sensor.temperature
below: 20
```
### Time Condition
```yaml
condition:
- condition: time
after: "16:00:00"
before: "23:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
```
### Sun Condition
```yaml
condition:
- condition: sun
after: sunset
before: sunrise
```
### Template Condition
```yaml
condition:
- condition: template
value_template: "{{ states('sensor.battery') | int > 20 }}"
```
### Zone Condition
```yaml
condition:
- condition: zone
entity_id: person.john
zone: zone.home
```
### Multiple Conditions (AND Logic)
All conditions must be true:
```yaml
condition:
- condition: state
entity_id: person.john
state: "home"
- condition: time
after: "sunset"
```
### OR Conditions
```yaml
condition:
- condition: or
conditions:
- condition: state
entity_id: person.john
state: "home"
- condition: state
entity_id: person.mary
state: "home"
```
## Actions
Actions define what the automation does.
### Call Service
```yaml
action:
- action: light.turn_on
target:
entity_id: light.kitchen
data:
brightness: 200
color_temp: 400
```
### Multiple Entities
```yaml
action:
- action: light.turn_on
target:
entity_id:
- light.kitchen
- light.living_room
- light.bedroom
```
### Delay
```yaml
action:
- delay:
seconds: 30
```
### Wait for Trigger
```yaml
action:
- wait_for_trigger:
- trigger: state
entity_id: binary_sensor.motion
to: "off"
timeout:
minutes: 5
```
### Conditional Action
```yaml
action:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- action: light.turn_on
target:
entity_id: light.porch
```
### Choose (If-Then-Else)
```yaml
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.weather
state: "sunny"
sequence:
- action: cover.open_cover
target:
entity_id: cover.blinds
- conditions:
- condition: state
entity_id: sensor.weather
state: "rainy"
sequence:
- action: cover.close_cover
target:
entity_id: cover.blinds
default:
- action: notify.notify
data:
message: "Weather is {{ states('sensor.weather') }}"
```
### Repeat
```yaml
action:
- repeat:
count: 3
sequence:
- action: light.toggle
target:
entity_id: light.hallway
- delay:
seconds: 1
```
## Templates
Use Jinja2 templates for dynamic values:
```yaml
action:
- action: notify.notify
data:
message: "Temperature is {{ states('sensor.temperature') }}°C"
title: "Weather at {{ now().strftime('%H:%M') }}"
```
### Common Template Functions
- `{{ states('entity_id') }}` - Get entity state
- `{{ state_attr('entity_id', 'attribute') }}` - Get entity attribute
- `{{ now() }}` - Current datetime
- `{{ trigger.entity_id }}` - Triggering entity ID
- `{{ trigger.to_state.state }}` - New state value
- `{{ trigger.from_state.state }}` - Old state value
## Execution Modes
- `single` (default) - Only one instance runs at a time. New triggers ignored while running.
- `restart` - Restart automation from beginning when triggered while running.
- `queued` - Queue additional triggers, run them sequentially.
- `parallel` - Allow multiple instances to run simultaneously.
```yaml
mode: parallel
max: 5 # Maximum 5 concurrent executions
```
## Best Practices
1. Always include `id` field for UI editor compatibility
2. Use meaningful `alias` names for easy identification
3. Add `description` to document complex automations
4. Prefer specific triggers over broad templates when possible
5. Use conditions to prevent unnecessary actions
6. Test automations with trace mode enabled
7. Keep automation logic simple - split complex logic into multiple automations or scripts
8. Quote state values: `state: "on"` not `state: on`
9. Use 2-space indentation, no tabs
10. Validate YAML before deploying

View File

@@ -0,0 +1,379 @@
# Common Home Assistant Automation Patterns
## Motion-Activated Lighting
Turn on lights when motion detected, turn off after no motion:
```yaml
automation:
- alias: "Motion Light - Hallway"
id: motion_light_hallway
trigger:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "on"
condition:
- condition: state
entity_id: sun.sun
state: "below_horizon"
action:
- action: light.turn_on
target:
entity_id: light.hallway
- wait_for_trigger:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "off"
for:
minutes: 5
- action: light.turn_off
target:
entity_id: light.hallway
```
## Time-Based Automation
Execute actions at specific times:
```yaml
automation:
- alias: "Morning Routine"
id: morning_routine
trigger:
- trigger: time
at: "07:00:00"
condition:
- condition: state
entity_id: binary_sensor.workday
state: "on"
action:
- action: light.turn_on
target:
entity_id: light.bedroom
data:
brightness: 50
- action: cover.open_cover
target:
entity_id: cover.bedroom_blinds
- action: climate.set_temperature
target:
entity_id: climate.bedroom
data:
temperature: 21
```
## Sunset/Sunrise Automation
React to sun position:
```yaml
automation:
- alias: "Lights at Sunset"
id: lights_at_sunset
trigger:
- trigger: sun
event: sunset
offset: "-00:30:00" # 30 min before sunset
action:
- action: light.turn_on
target:
area_id: living_room
data:
brightness: 180
```
## Presence Detection
React to people arriving/leaving:
```yaml
automation:
- alias: "Welcome Home"
id: welcome_home
trigger:
- trigger: state
entity_id: person.john
from: "not_home"
to: "home"
action:
- action: light.turn_on
target:
area_id: entrance
- action: climate.set_temperature
target:
entity_id: climate.living_room
data:
temperature: 22
- action: notify.mobile_app
data:
message: "Welcome home, John!"
```
## Temperature-Based Climate Control
Adjust heating/cooling based on temperature:
```yaml
automation:
- alias: "Auto Climate Control"
id: auto_climate_control
trigger:
- trigger: numeric_state
entity_id: sensor.living_room_temperature
below: 19
condition:
- condition: state
entity_id: person.john
state: "home"
action:
- action: climate.set_hvac_mode
target:
entity_id: climate.living_room
data:
hvac_mode: heat
- action: climate.set_temperature
target:
entity_id: climate.living_room
data:
temperature: 21
```
## Door/Window Alert
Notify when doors/windows left open:
```yaml
automation:
- alias: "Window Open Alert"
id: window_open_alert
trigger:
- trigger: state
entity_id: binary_sensor.living_room_window
to: "on"
for:
minutes: 30
condition:
- condition: numeric_state
entity_id: sensor.outdoor_temperature
below: 10
action:
- action: notify.notify
data:
message: "Living room window has been open for 30 minutes and it's {{ states('sensor.outdoor_temperature') }}°C outside"
title: "Window Alert"
```
## Low Battery Notification
Alert when device batteries are low:
```yaml
automation:
- alias: "Low Battery Alert"
id: low_battery_alert
trigger:
- trigger: numeric_state
entity_id: sensor.motion_sensor_battery
below: 20
action:
- action: notify.notify
data:
message: "{{ trigger.to_state.attributes.friendly_name }} battery is at {{ trigger.to_state.state }}%"
title: "Low Battery"
```
## Conditional Lighting by Time
Different brightness based on time of day:
```yaml
automation:
- alias: "Motion Light with Time-Based Brightness"
id: motion_light_time_based
trigger:
- trigger: state
entity_id: binary_sensor.kitchen_motion
to: "on"
action:
- choose:
- conditions:
- condition: time
after: "22:00:00"
before: "06:00:00"
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen
data:
brightness: 30
- conditions:
- condition: time
after: "06:00:00"
before: "22:00:00"
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen
data:
brightness: 255
```
## Vacation Mode
Randomize lights when away:
```yaml
automation:
- alias: "Vacation Mode - Random Lights"
id: vacation_mode_lights
trigger:
- trigger: time_pattern
hours: "/1" # Every hour
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: "on"
- condition: sun
after: sunset
before: sunrise
action:
- action: light.turn_on
target:
entity_id: "{{ ['light.living_room', 'light.bedroom', 'light.kitchen'] | random }}"
- delay:
minutes: "{{ range(30, 120) | random }}"
- action: light.turn_off
target:
entity_id: all
```
## Media Player Automation
Pause media when phone rings:
```yaml
automation:
- alias: "Pause Media on Phone Call"
id: pause_media_phone_call
trigger:
- trigger: state
entity_id: sensor.phone_state
to: "ringing"
action:
- action: media_player.media_pause
target:
entity_id: all
```
## Garden Watering Schedule
Water garden based on weather and schedule:
```yaml
automation:
- alias: "Garden Watering"
id: garden_watering
trigger:
- trigger: time
at: "06:00:00"
condition:
- condition: state
entity_id: sensor.weather_forecast
state: "sunny"
- condition: numeric_state
entity_id: sensor.outdoor_temperature
above: 20
- condition: numeric_state
entity_id: sensor.soil_moisture
below: 30
action:
- action: switch.turn_on
target:
entity_id: switch.garden_sprinkler
- delay:
minutes: 30
- action: switch.turn_off
target:
entity_id: switch.garden_sprinkler
```
## Reminder Notifications
Remind to perform tasks:
```yaml
automation:
- alias: "Trash Day Reminder"
id: trash_day_reminder
trigger:
- trigger: time
at: "20:00:00"
condition:
- condition: time
weekday:
- sun
action:
- action: notify.notify
data:
message: "Don't forget to put out the trash tonight!"
title: "Trash Day Tomorrow"
```
## Smart Doorbell
Announce doorbell press and record:
```yaml
automation:
- alias: "Doorbell Press"
id: doorbell_press
trigger:
- trigger: state
entity_id: binary_sensor.doorbell
to: "on"
action:
- action: media_player.play_media
target:
entity_id: media_player.home_speaker
data:
media_content_id: "local/doorbell.mp3"
media_content_type: "music"
- action: camera.snapshot
target:
entity_id: camera.front_door
data:
filename: "/config/www/snapshots/doorbell_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
- action: notify.mobile_app
data:
message: "Someone is at the door"
data:
image: "/local/snapshots/doorbell_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
```
## Energy Saving
Turn off devices when nobody home:
```yaml
automation:
- alias: "Energy Saving - Away Mode"
id: energy_saving_away
trigger:
- trigger: state
entity_id: group.all_persons
to: "not_home"
for:
minutes: 15
action:
- action: light.turn_off
target:
entity_id: all
- action: climate.set_hvac_mode
target:
entity_id: all
data:
hvac_mode: "off"
- action: media_player.turn_off
target:
entity_id: all
```

View File

@@ -0,0 +1,342 @@
# Home Assistant Troubleshooting Guide
## YAML Configuration Errors
### Tab Characters Error
**Error:** `found character '\t' that cannot start any token`
**Cause:** YAML file contains tab characters
**Solution:**
- Replace all tabs with spaces (use 2 spaces per indentation level)
- Configure editor to use spaces instead of tabs
- Run validation script: `python3 validate_yaml.py configuration.yaml`
### Boolean State Errors
**Error:** `not a valid value for dictionary value`
**Cause:** Unquoted boolean state values like `on`, `off`, `yes`, `no`
**Solution:**
- Quote state values: `state: "on"` not `state: on`
- YAML interprets `on`, `yes`, `true` as boolean `true`
- Quote them to use as strings: `"on"`, `"off"`, `"yes"`, `"no"`
### Duplicate Keys
**Error:** Automation not working as expected
**Cause:** Duplicate keys in YAML - only last value is used
**Solution:**
```yaml
# Wrong - duplicate 'action' keys
action: light.turn_on
action: notify.notify
# Correct - use list
action:
- action: light.turn_on
- action: notify.notify
```
### Indentation Errors
**Error:** `mapping values are not allowed here`
**Cause:** Incorrect indentation
**Solution:**
- Use exactly 2 spaces per indentation level
- Check that list items align properly with `-`
- Validate structure:
```yaml
# Correct
automation:
- alias: "Test"
trigger:
- trigger: state
entity_id: light.test
```
## Automation Issues
### Automation Not Triggering
**Check:**
1. Automation is enabled (check Developer Tools > States > `automation.your_automation`)
2. Trigger conditions are correct:
- Entity ID exists and is spelled correctly
- State values are quoted: `to: "on"` not `to: on`
- For numeric triggers, ensure sensor provides numeric values
3. Check automation trace (Settings > Automations > automation > Traces)
**Debug:**
```yaml
# Add notification to verify trigger fires
action:
- action: notify.notify
data:
message: "Automation triggered at {{ now() }}"
# ... rest of actions
```
### Automation Runs But Actions Don't Execute
**Check:**
1. Conditions - if any condition fails, actions won't run
2. Entity IDs in actions are correct
3. Service parameters are valid
4. Check logs for errors: Settings > System > Logs
**Debug:**
```yaml
# Temporarily remove conditions to test actions
# condition:
# - condition: state
# entity_id: sun.sun
# state: "below_horizon"
```
### Template Errors
**Error:** `TemplateError: UndefinedError`
**Cause:** Template references non-existent entity or attribute
**Solution:**
```yaml
# Use default filter for safety
{{ states('sensor.missing') | default('unknown') }}
{{ state_attr('sensor.test', 'missing_attr') | default(0) }}
# Check if entity exists
{% if states('sensor.test') != 'unknown' %}
{{ states('sensor.test') }}
{% endif %}
```
### "While" Loop Not Working
**Cause:** Using `for` when you meant duration, not iteration
**Solution:**
```yaml
# Wrong - 'for' iterates over value
trigger:
- trigger: state
entity_id: motion_sensor
to: "on"
for: 5 # This is wrong
# Correct - specify duration
trigger:
- trigger: state
entity_id: binary_sensor.motion
to: "on"
for:
seconds: 5
```
## API Issues
### 401 Unauthorized
**Cause:** Invalid or missing access token
**Solution:**
1. Generate new long-lived token at `http://YOUR_HA_URL:8123/profile`
2. Verify token in Authorization header: `Authorization: Bearer YOUR_TOKEN`
3. Check token hasn't been deleted in Home Assistant
### 404 Not Found - Entity
**Cause:** Entity ID doesn't exist or is misspelled
**Solution:**
1. List all entities: `python3 list_entities.py --url YOUR_URL --token YOUR_TOKEN`
2. Check exact entity ID spelling (case-sensitive)
3. Verify entity is not disabled in Home Assistant
### Service Call Fails
**Error:** `Service not found` or `Invalid service data`
**Solution:**
1. List available services: `python3 list_services.py --url YOUR_URL --token YOUR_TOKEN`
2. Verify service parameters match requirements
3. Check service still exists (some integrations change service names)
**Example:**
```python
# Get service details
python3 list_services.py --url YOUR_URL --token YOUR_TOKEN --domain light
# Shows required/optional fields for each service
```
## Integration Issues
### Integration Not Loading
**Check:**
1. Configuration syntax: `configuration.yaml` has correct format
2. Required parameters are provided
3. Check error log: `http://YOUR_HA_URL:8123/config/logs`
**Solution:**
1. Validate configuration: Configuration > Server Controls > Check Configuration
2. Restart Home Assistant: Configuration > Server Controls > Restart
3. Check integration documentation for required setup
### Device Unavailable
**Check:**
1. Device is powered on and connected to network
2. Integration is configured correctly
3. Check integration's specific requirements (API keys, credentials, etc.)
**Debug:**
```yaml
# Check device state in Developer Tools
# Developer Tools > States > search for entity_id
# Status shows as 'unavailable' or 'unknown'
```
## Performance Issues
### Slow Response Times
**Causes:**
- Too many entities or automations
- Database growing too large
- Inefficient automations (templates evaluating frequently)
**Solutions:**
1. Purge old data: Configuration > System > Storage
2. Optimize database: `recorder` configuration in `configuration.yaml`:
```yaml
recorder:
purge_keep_days: 7
exclude:
domains:
- automation
- updater
entity_globs:
- sensor.weather_*
```
3. Reduce template sensor update frequency
4. Use `homeassistant.reload_core_config` instead of full restart when possible
### Automations Firing Too Often
**Cause:** State changes triggering repeatedly
**Solution:**
```yaml
# Add 'for' duration to prevent rapid triggers
trigger:
- trigger: state
entity_id: sensor.temperature
for:
minutes: 5
# Or add condition to limit frequency
condition:
- condition: template
value_template: >
{{ (now() - state_attr('automation.this_automation', 'last_triggered') | default(as_datetime(0), true)).total_seconds() > 300 }}
```
## Network Issues
### Can't Connect to Home Assistant
**Check:**
1. Home Assistant is running: `systemctl status home-assistant` (if using systemd)
2. Firewall allows port 8123
3. Using correct URL (http not https, or vice versa)
4. Network connectivity between client and server
**Solutions:**
```bash
# Test connection
curl http://YOUR_HA_URL:8123/api/
# Should return: {"message": "API running."}
# Check from Home Assistant server
curl http://localhost:8123/api/
```
### SSL/Certificate Errors
**Cause:** Using HTTPS with self-signed or invalid certificate
**Solution:**
1. Use HTTP for local testing
2. For production, use valid SSL certificate (Let's Encrypt via DuckDNS)
3. For testing with self-signed cert, disable verification (not recommended for production)
## Debugging Tools
### Check Automation Trace
1. Go to Settings > Automations & Scenes
2. Click automation
3. Click "Traces" tab
4. Shows each trigger, condition check, and action execution
### Developer Tools
**Template Tab:**
- Test templates before using in automations
- See real-time template evaluation
**States Tab:**
- View all entity states and attributes
- Check last_changed and last_updated timestamps
**Services Tab:**
- Test service calls manually
- Verify service parameters
**Events Tab:**
- Listen to all events
- See what events are being fired
### Enable Debug Logging
Add to `configuration.yaml`:
```yaml
logger:
default: info
logs:
homeassistant.core: debug
homeassistant.components.automation: debug
homeassistant.helpers.script: debug
```
Restart Home Assistant to enable debug logging.
### Check Error Log
Access via:
- UI: Settings > System > Logs
- API: `GET /api/error_log`
- File: `/config/home-assistant.log`
## Common Gotchas
1. **Entity ID changed:** Integrations sometimes change entity IDs on update
2. **State is string:** All states are strings, use `| int` or `| float` for math
3. **Time zone:** Ensure Home Assistant time zone matches your location
4. **Restart required:** Some configuration changes need full restart, not just reload
5. **YAML anchors:** Not supported in automations.yaml when using UI editor
6. **Case sensitivity:** Entity IDs and states are case-sensitive
7. **Reserved words:** Avoid using YAML reserved words as keys without quotes
8. **Whitespace:** Trailing whitespace can cause parsing issues