Fertige KI-Prompts und Code-Snippets für dein Smart Home. Copy-Paste ready — von LLM-Prompts über Home Assistant YAML bis ESPHome Configs.
You are a smart home AI analyst. Analyze the following sensor data and identify anomalies.
Rules:
1. Compare each sensor's current value against its typical range
2. Flag any value that deviates more than 2 standard deviations
3. Consider time of day and day of week for context
4. Distinguish between: CRITICAL (safety), WARNING (unusual), INFO (noteworthy)
5. Suggest possible causes for each anomaly
Output format:
- Status: CRITICAL | WARNING | INFO | OK
- Sensor: [entity_id]
- Value: [current] (normal: [range])
- Possible cause: [explanation]
- Suggested action: [what to do]
Sensor data:
{{sensor_data}}
Analyze this front door camera image.
1. Is there a package/parcel visible? (yes/no)
2. If yes:
- Estimated size: small / medium / large
- Carrier visible? (DHL, Amazon, DPD, Hermes, UPS, unknown)
- Location: doorstep / mailbox / behind plant / other
- Count: how many packages?
3. Is there a person visible? (yes/no)
- If yes: delivery person / resident / unknown
4. Confidence: high / medium / low
Respond in JSON format:
{"package": bool, "size": str, "carrier": str, "location": str, "count": int, "person": bool, "person_type": str, "confidence": str}
You are a friendly smart home assistant for a family with young children.
The kids have been watching TV for {{duration}} minutes.
Today is {{weekday}}, it is {{time}}.
Rules:
- Weekdays: max 30 min TV
- Weekends: max 60 min TV
- After 19:00: bedtime routine, no more TV
- Be kind and encouraging, never harsh
- Suggest an alternative activity
Generate a short, friendly announcement (2-3 sentences) in {{language}}.
If they are over the limit, gently remind them.
If they still have time, tell them how much is left.
A smart plug detected the coffee machine was used.
Time: {{timestamp}}
Power draw: {{watts}}W for {{duration}}s
User reported drink: {{drink_type}}
Classify the drink and estimate caffeine:
- espresso (short pull, ~63mg)
- double espresso (~126mg)
- lungo/americano (~80mg)
- cappuccino/latte (~63mg)
- decaf (~3mg)
- hot water only (0mg)
Also check: User has consumed {{daily_total}}mg today.
Recommended daily max: 400mg.
Respond JSON:
{"drink": str, "caffeine_mg": int, "daily_total": int, "warning": str|null}
You are a message router for a smart home Telegram bot.
Classify the user message into exactly ONE category.
Categories:
- INVENTORY: adding items, checking stock, package arrived
- SHOPPING: add to shopping list, buy something
- SMART_HOME: control lights, check sensors, automation
- QUESTION: general questions about the house/setup
- REMINDER: set a reminder or timer
- NOTEBOOK: save a note, idea, or thought
- UNKNOWN: cannot classify
User message: {{message}}
Respond with ONLY the category name, nothing else.
alias: Presence-Based Lighting
trigger:
- platform: state
entity_id: binary_sensor.living_room_presence
to: "on"
condition:
- condition: sun
after: sunset
after_offset: "-00:30:00"
action:
- choose:
- conditions:
- condition: time
after: "22:00:00"
sequence:
- service: light.turn_on
target:
entity_id: light.living_room
data:
brightness_pct: 20
color_temp_kelvin: 2700
- conditions:
- condition: time
after: "18:00:00"
sequence:
- service: light.turn_on
target:
entity_id: light.living_room
data:
brightness_pct: 80
color_temp_kelvin: 4000
alias: Washing Machine Done
trigger:
- platform: numeric_state
entity_id: sensor.washing_machine_power
below: 5
for:
minutes: 3
condition:
- condition: state
entity_id: input_boolean.washing_machine_running
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.washing_machine_running
- service: notify.mobile_app
data:
title: "Waschmaschine fertig!"
message: "Die Waesche kann aufgehaengt werden."
{# Energy Anomaly Check — use in HA template sensor #}
{% set current = states('sensor.house_power') | float(0) %}
{% set avg = state_attr('sensor.house_power_stats', 'mean') | float(0) %}
{% set threshold = 1.5 %}
{% if avg > 0 and current > avg * threshold %}
anomaly: {{ ((current / avg - 1) * 100) | round(0) }}% above normal
current: {{ current | round(0) }}W
average: {{ avg | round(0) }}W
{% else %}
normal: {{ current | round(0) }}W
{% endif %}
{# Trash reminder — use in automation action #}
{% set types = {
'sensor.waste_residual': 'Restmuell',
'sensor.waste_bio': 'Biotonne',
'sensor.waste_paper': 'Papiertonne',
'sensor.waste_plastic': 'Gelber Sack'
} %}
{% set tomorrow = (now() + timedelta(days=1)).date() %}
{% set collections = [] %}
{% for entity, name in types.items() %}
{% if as_datetime(states(entity)).date() == tomorrow %}
{% set collections = collections + [name] %}
{% endif %}
{% endfor %}
{% if collections %}
Erinnerung: Morgen wird {{ collections | join(' und ') }} abgeholt.
{% endif %}
esphome:
name: doorbell-cam
esp32:
board: esp32cam
esp32_camera:
name: Doorbell Camera
external_clock:
pin: GPIO0
frequency: 20MHz
i2c_pins:
sda: GPIO26
scl: GPIO27
data_pins: [GPIO5,GPIO18,GPIO19,GPIO21,GPIO36,GPIO39,GPIO34,GPIO35]
vsync_pin: GPIO25
href_pin: GPIO23
pixel_clock_pin: GPIO22
resolution: 800x600
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: true
name: Doorbell Button
on_press:
then:
- homeassistant.event:
event: esphome.doorbell_pressed
data:
device: doorbell-cam
esphome:
name: voice-satellite
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO6
i2s_bclk_pin: GPIO7
microphone:
- platform: i2s_audio
id: mic
i2s_audio_id: i2s_in
i2s_din_pin: GPIO8
adc_type: external
pdm: false
channel: left
voice_assistant:
microphone: mic
on_listening:
- light.turn_on:
id: status_led
effect: pulse
on_tts_end:
- light.turn_off: status_led
// In n8n Telegram node: Additional Fields > Reply Markup
// Type: Inline Keyboard
{
"inline_keyboard": [
[
{ "text": "Approve", "callback_data": "approve_ITEM_ID" },
{ "text": "Reject", "callback_data": "reject_ITEM_ID" }
],
[
{ "text": "Edit", "callback_data": "edit_ITEM_ID" }
]
]
}
// Replace ITEM_ID with {{ $json.item_id }} in n8n
// HTTP Request node in n8n
// Method: POST
// URL: http://YOUR_HA_IP:8123/api/services/light/toggle
// Authentication: Header Auth
// Name: Authorization
// Value: Bearer YOUR_HA_TOKEN
// Body (JSON):
{
"entity_id": "light.living_room"
}
// Trigger via: POST /webhook/ha-control
// Body: { "domain": "light", "service": "toggle", "entity_id": "light.office" }