Exploring Mood-Aware Automations with GPT-4.1 in Home Assistant

I’ve been experimenting with integrating GPT-4.1 into Home Assistant to create mood-aware automations, and it’s been a fascinating journey! The idea is to have the system infer the mood of the home based on sensor data like light levels, motion, and device usage, then suggest gentle adjustments like gradually warming lights or softly playing background music. I adapted the ‘Serenity’ prompt, originally found on Reddit, to guide the LLM in compassionate interactions. While I’m not an expert in mood analysis, I’m excited about the potential for smoother, more intuitive home automation.

What I Built
I started with Serenity-1 (GPT-4o) as a mentor agent to test the concept, and now I’m working on Serenity-2 (GPT-4.1), which simulates real-time sensor input and outputs mood metrics and automation suggestions. The goal is to make automations feel more natural and responsive to the actual mood of the home.

Test Scenario
On a gray weekday morning at 8:30 AM, with one resident moving between the bedroom and kitchen and another still sleeping, the LLM generated a mood snapshot of ‘calm, gentle positivity’ with specific metrics. It suggested gradually warming the common-area lights and softly playing lo-fi music. Here’s how that translates into Home Assistant YAML:

yaml
alias: Gentle Morning Automation
trigger:

  • platform: numeric_state
    entity_id: sensor.lux_kitchen
    below: 50
  • platform: state
    entity_id: binary_sensor.motion_kitchen
    to: “on”
    condition: “{{ now().hour == 8 and states(‘sensor.home_mood’) == ‘calm’ }}”
    action:
  • service: light.turn_on
    target:
    entity_id: light.common_area
    data:
    transition: 30
    kelvin: 3000
  • service: media_player.play_media
    target:
    entity_id: media_player.kitchen_speaker
    data:
    media_content_id: “https://link-to-lofi-stream
    media_content_type: music

Current State
This setup works, but it requires manual configuration, including setting up an OpenAI key and pushing sensor data. The response latency is about 1-2 seconds, which is acceptable for ambient adjustments but might not be ideal for immediate needs. I’m curious about others’ approaches to mood-driven automation and any tips for refining the prompts or optimizing the system for better performance and privacy.

Would love to hear how others are experimenting with mood-aware automations or have suggestions for improving this concept! :rocket: