Prompt & Snippet Library

Ready-made AI prompts and code snippets for your smart home. Copy-paste ready — from LLM prompts to Home Assistant YAML to ESPHome configs.

LLM: Smart Home Anomaly AnalysisI use this
llm ha
System prompt I use in my Nova setup to analyze sensor data and detect anomalies.
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}}
LLM: Package Detection from Camera ImageI use this
llm vision
Multimodal prompt I use with LLaVA/GPT-4V to detect packages at the front door and add them to inventory.
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}
LLM: Kids TV Timer with ContextI use this
llm family
Prompt I use so Nova makes kid-friendly timer announcements when TV time is over. Considers day of week and time.
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.
LLM: Caffeine Tracker ClassificationI use this
llm health
Prompt I use in n8n to classify beverages and estimate caffeine content. Triggered via coffee machine smart plug.
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}
LLM: Telegram Intent RouterI use this
llm n8n
System prompt of my Nova Telegram router. Classifies incoming messages and routes them to the correct sub-workflow.
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.
HA: Presence-Based LightingI use this
ha automation
Automation I use in every room. Turns lights on/off based on presence and time of day.
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
HA: Washing Machine Done (Power-based)
ha automation
Detects via smart plug when the washing machine is done and sends notification.
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."
Jinja2: Energy Consumption AnomalyI use this
jinja ha
Template sensor I use to compare current consumption with 7-day average.
{# 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 %}
Jinja2: Trash Collection ReminderI use this
jinja ha
Template I use in the morning briefing. Checks which bin needs to go out tomorrow.
{# 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: Doorbell with Camera Snapshot
esphome automation
ESP32-CAM config that takes a photo on doorbell press and sends it to HA.
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: I2S Microphone Voice SatelliteI use this
esphome voice
Config I use for my voice satellite with ESP32-S3 and INMP441 microphone.
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
n8n: Telegram Inline Keyboard ButtonsI use this
n8n automation
Pattern I use in my inventory approval workflow. Telegram message with approve/reject buttons.
// 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
n8n: Webhook to HA Service Call
n8n ha
n8n workflow pattern to trigger an HA service via webhook.
// 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" }
No prompts found.

Stay in the loop

New articles, project builds, and YouTube videos delivered to your inbox. No spam, unsubscribe anytime.

Or follow me on:

YouTube